Need help with clone rotation

Hey everyone. I’ve been recently working on an asteroids-like game, currently with the player controls and bullet physics. However, the bullets don’t change rotation to be the same as the player’s ship when shot. You can check out the project here. Any help to fix this would be appreciated.

-thiseaglet_01

it’s because the script that sets Player Ship Direction never runs. but using a variable here is unneccesary, because you can use the

[direction V] of [Player 1 Ship V]

block to get the direction

Alright, but how do I make the bullets fire in the ships direction? They only shoot up.

Something like this?
point in direction ([direction V] of [Player 1 ship V] ::sensing)::movement repeat until <> { move () steps :: motion } :: control delete this clone ::

Just tried it, it works but you have to stay moving to keep it in the same direction, when your not moving the ship the bullets default to shooting up

I just edited and tried it, and it works perfectly fine for me. Can you send a picture of your script?

I put the script you made into this custom block. Is it because of that or something else?

You should first make the little bullet face in the direction Asteroids Test script pic (1). Since you set it to point in the direction (Player Ship Direction) and it always set to 0, the little bullet always shoots up.

The reason (Player Ship Direction) is always set to 0 is because of this script:


If you check the definition of Asteroids Test script pic (3):

The Asteroids Test script pic (3) block will forever run, meaning there won’t be a chance for the variable (Player Ship Direction) to be set in the script that comes after the custom block.

Ah I see, so how would I be able to make the variable be able to change to the player ship’s direction?

What you can do is either remove the forever loop inside the Player 1 Movement:: #603501 definition and stick the Player 1 Movement:: #603501 inside the forever loop with set [Player Ship Direction V] to (direction), or put the Player 1 Movement:: #603501 under another when green flag clicked block.

This worked. Thanks for the help!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.