Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Help with homing missile
- MrR0g3rs
-
9 posts
Help with homing missile
I am adding some layers to my game. One will be that you will collect powerups to enable a “homing missile weapon”. When fired the missile is supposed to go to the nearest dragon. A couple of issues, the first is that I want the missile to flu to the target point first, but sometimes it will fly sideways, the second is that sometimes there is a delay between the button press and the missile launch. Am I on the right track with the homing code? I have been looking at lots of examples.
Game link: https://scratch.mit.edu/projects/94310026/
Press Z to launch the missile.
Game link: https://scratch.mit.edu/projects/94310026/
Press Z to launch the missile.
- alberto85
-
14 posts
Help with homing missile
To make it point the right way you should rotate the image in the sprite editor so that it points to the right.
- MrR0g3rs
-
9 posts
Help with homing missile
Thanks for that tip. Now it is flying straight but not homing. Out of curiosity why does rotating it make a difference? Is it because I used the
block?
- footsocktoe
-
1000+ posts
Help with homing missile
Thanks for that tip. Now it is flying straight but not homing. Out of curiosity why does rotating it make a difference? Is it because I used theblock?
Yes. When you use a MOVE block, it moves the sprite in its DIRECTION. If you don't draw the sprite facing right, then how it looks and how it moves will not match.
- CapeMan1008
-
98 posts
Help with homing missile
If you want to make it home in on a target, and not fly straight, start by making sure you have this setup:
And not this:
- ScratchCatHELLO
-
1000+ posts
Help with homing missile
If you want to make it home in on a target, and not fly straight, start by making sure you have this setup:And not this:
This post is 4 years old.
- Oumuamua
-
1000+ posts
Help with homing missile
this is an old post
Do not spam, dear spammer. Thanks.
- wosdcs
-
100+ posts
Help with homing missile
The best thing taht you can do, is have the missile save to a list, all of the distances to all dragons, and pick the dragon that is closest, from there, just setv the program to point towards that dragon and move # of steps.
- wosdcs
-
100+ posts
Help with homing missile
The best thing taht you can do, is have the missile save to a list, all of the distances to all dragons, and pick the dragon that is closest, from there, just setv the program to point towards that dragon and move # of steps. OH! and make it in the editor face RIGHT! 

- ScratchCatHELLO
-
1000+ posts
Help with homing missile
-snap-
this topic is 5 years old and the OP left
- CapeMan1008
-
98 posts
Help with homing missile
If you want to make it home in on a target, and not fly straight, start by making sure you have this setup:And not this:
This post is 4 years old.
I'm sorry, I never check the dates on these things.
- Harakou
-
1000+ posts
Help with homing missile
Thanks to everyone for offering your help, but this thread is pretty old - I don't think it's relevant anymore. When you respond to a topic, please make sure it's recent and the original poster still needs an answer. And if someone does necropost, please report it so that we can close the topic. Otherwise it just keeps happening. Thanks! 

- Discussion Forums
- » Help with Scripts
-
» Help with homing missile