How can I make a rocket, that moves all around the screen and turns 360 degrees in both directions, fire bullets in the direction it's facing and not just up, down, left and right. Any help is greatly appreciated.
Offline
x key turns it left by 15 degrees each press, the c key turns it right 15 degrees each press, the space gives it a boost which ever direction it is going in and z key fires the bullet. I can make the bullets go up, down, left and right but I want more than that. I'm just puzzled how to get the bullet to fire in the direction the rocket is travelling at the time.
Offline
Here is the script for the rocket:
when gf clicked forever if <key [x v] pressed?> turn ccw [15] degrees end if <key [c v] pressed?> turn cw [15] degrees end if <key [space v] pressed?> move [7] stepsAnd the bullet script:
when gf clicked forever point in direction ([direction v] of [rocket v]) if <key [z v] pressed?> repeat until <<touching [enemy v]?> or <touching [edge v] ?>> move [5] steps end go to [rocket v] endHope that helped!
Offline
7734f wrote:
Here is the script for the rocket:
when gf clicked forever if <key [x v] pressed?> turn ccw [15] degrees end if <key [c v] pressed?> turn cw [15] degrees end if <key [space v] pressed?> move [7] steps//Wouldn't that just make it move 7 steps and then be done?And the bullet script:when gf clicked forever point in direction ([direction v] of [rocket v]) if <key [z v] pressed?> repeat until <<touching [enemy v]?> or <touching [edge v] ?>> move [5] steps end go to [rocket v] endHope that helped!
~7734f
Offline
Maltese_Falcon wrote:
7734f wrote:
Here is the script for the rocket:
when gf clicked forever if <key [x v] pressed?> turn ccw [15] degrees end if <key [c v] pressed?> turn cw [15] degrees end if <key [space v] pressed?> move [7] steps//Wouldn't that just make it move 7 steps and then be done?And the bullet script:when gf clicked forever point in direction ([direction v] of [rocket v]) if <key [z v] pressed?> repeat until <<touching [enemy v]?> or <touching [edge v] ?>> move [5] steps end go to [rocket v] endHope that helped!
~7734f
If you hold down space then it moves. I think that's what he meant.
Offline
Thanks for the scripts. They wasn't exactly what I wanted but with a few tweeks and bit of luck I finally got what I wanted. Thanks 7734f
Offline