Topic was automatically imported from the old Question2Answer platform.
Asked By
elmatchobas
Hello guys, I am a brazilian student and I have to reproduce an old school game in godot, but I cant figure it out how to make the shooting mechanics from Missile Command.
The aim moves following the mouse and when a press a buttom the shot have to go up to the mouse location when I pressed and explode.
If someone with more experience in the engine could help me with some idea or a solution I would be very pleased.
Use the _input() function to capture the mouse click event and set a target position using get_global_mouse_position().
Interpolate the position of the missile from the start point to the destination. Alternatively, you could use Line2D to draw the line as in the original game.
Sorry too late for your school project, but if someone else searches for this, I created a clone of Missile Command in Godot.
The part that answers your question is mostly in the Missile scene:
The ready() function calculates the direction, then the move_missile() function adds a velocity vector each time the scene is processed until the missile gets to the destination.