How can I make my Spite(Soldier)shot in 4 directions left,right,up,down and also move in the same?
I made 4 diferent Cosumes,for each direction(one for moving one for shoting) and I wont to combine costumes and direction of fire,so that I can shot and move up,down.left and right.
Offline
Well, make a variable called 'direction' and say 'forever set direction to sprite1's direction. if key space pressed broadcast shoot'. and for the bullet 'when I receive 'shoot' point in direction 'direction'. repeat until touching edge: move 5 steps' That might work.
Last edited by Graham (2007-07-27 19:43:00)
Offline
Graham wrote:
Well, make a variable called 'direction' and say 'forever set direction to sprite1's direction if key space pressed broadcast shoot' and for the bullet 'when I receive 'shoot' point in direction 'direction' repeat until touching edge move 5 steps' That might work.
Wha?
That took me about half a minute to process.
eyra
Last edited by AngelEyra (2007-07-26 15:38:52)
Offline
Actually, lubigor, another way to do this would be to have the arrow keys or the w, a, s, and d keys be for the soldier's movements and then have a sight for his gun that follows the mouse pointer. That way you could aim anywhere, smoothly, and still be able to move. Alternatively, you could set the soldier's movements to the arrow keys and the gun's aim to the w, a, s, and d keys or vice-versa, though with that settup the controls would be much clunkier.
Offline
Put simply here it is:
Variables you need: direction
now on the player sprite put this.
When flag clicked
forever if {key right down}
change x by 3 ( or however many units you want to move him)
And repeat this and alter for each direction
Now the bullet sprite put this
When flag clicked
forever if {key right down}
set direction to 90
and again repeat for each direction
now for firing
when space (or any firing key) pressed
goto "player"
show
point in direction "direction" ("direction" is the variable)
repeat until touching edge or enemies
hide
move 3 ( or move however many you like)
Thats all
Offline