This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-04-18 16:36:05

Rocket-Moon
New Scratcher
Registered: 2012-04-16
Posts: 14

Bullet problem

I've made a script for bullets in my game but i can only make it go right, because my player can turn right and left, i'm trying to work out how to get the bullet to go left when i press the shoot button

Offline

 

#2 2012-04-18 17:36:20

Prestige
Scratcher
Registered: 2008-12-15
Posts: 100+

Re: Bullet problem

Could you specify a little more? Is it a top down shooter? Without knowing, can you not set the direction of the bullet to -90 (left) and

 
point in direction (-90)
move (5) steps
?

Last edited by Prestige (2012-04-18 17:37:37)


"Don't insult someone until you've walked a mile in their shoes. That way, if they don't like what you have to say, you'll be a mile away and still have their shoes  smile  "

Offline

 

#3 2012-04-19 11:13:36

PhirripSyrrip
Scratcher
Registered: 2012-02-11
Posts: 100+

Re: Bullet problem

Do you want the bullets to go the same way as the player is facing?
I think I know what you mean. Try this.
For the Player:

when gf clicked
forever
if <key [left arrow v] pressed?>
point in direction [-90]
move [5] steps
end
if <key [right arrow v] pressed?>
point in direction [90]
move [5] steps
end
if <key [any v] pressed?>
set [bullet fire v] to [fire]
end
end
For the Bullets:
when gf clicked
forever
if <(bullet fire)=[fire]>
show
go to [player v]
point in direction ([direction v] of [player v])
repeat until <touching [anything v]?>
move [10] steps
end
set [bullet fire v] to [0]
else
hide
end


http://i46.tinypic.com/ao03lk.png

Offline

 

#4 2012-04-19 15:05:37

Game-Mage
New Scratcher
Registered: 2012-04-19
Posts: 2

Re: Bullet problem

Thank you!

Offline

 

Board footer