Bullet trajectories

id: 750333

category: Help with Scripts

posts: 8

20140069G 20140069G loading
So I made this project where its not a 2d game facing upwards, but sideways, what i mean by this is:
https://scratch.mit.edu/projects/693308387/

But a game like this:
https://imagetolink.com/ib/cYl1pM4nBg

So my doubt is how do i make the bullets face the mouse pointer and travelling to it, while going past the mouse cursor up until they reach the edge.

Right now the bullet is very weird and i need help fixing it, the following video will show how:

https://l1nq.com/fvDsS

Thanks for anyone helping me!

P.S: Sorry for using a shortened link, I know most people don't like to use them, but i had to use one otherwise scratch would censor it, if you want you can use those short url previewers so you know you are safe with this link.

20140069G wrote:

So I made this project where its not a 2d game facing upwards, but sideways, what i mean by this is:
https://scratch.mit.edu/projects/693308387/

But a game like this:
https://imagetolink.com/ib/cYl1pM4nBg

So my doubt is how do i make the bullets face the mouse pointer and travelling to it, while going past the mouse cursor up until they reach the edge.

Right now the bullet is very weird and i need help fixing it, the following video will show how:

https://l1nq.com/fvDsS

Thanks for anyone helping me!

P.S: Sorry for using a shortened link, I know most people don't like to use them, but i had to use one otherwise scratch would censor it, if you want you can use those short url previewers so you know you are safe with this link.

Would this help?:

repeat until <touching [Edge v] ?>
if <touching [Mouse pointer v] ?> then

else
point towards [Mouse pointer v]
end
move (10) steps
end
20140069G 20140069G loading
Thanks, theres an issue tho, it will always follow the cursor, therefore it will not continue on its own and will follow the cursor forever, unless you put the cursor on the edge.

Nice idead though!
Malicondi Malicondi loading

20140069G wrote:

Thanks, theres an issue tho, it will always follow the cursor, therefore it will not continue on its own and will follow the cursor forever, unless you put the cursor on the edge.

Nice idead though!
take the “point to mouse pointer” and out it at the start of the repeat loop, not inside and it should work.
ramenecho ramenecho loading

20140069G wrote:

Thanks, theres an issue tho, it will always follow the cursor, therefore it will not continue on its own and will follow the cursor forever, unless you put the cursor on the edge.

Nice idead though!
Ok, hello again, so im assuming you just want it to go in the direction of the cursor when launched but then just stop going towards the cursor, and just continue moving in the direction where the cursor was when it launched, like if you shot something in a fps game, the bullet just moves in the direction you were facing when it was launched. Try this
when I receive [Shoot Bullet v]
point towards [Mouse pointer v]
repeat until <touching [edge v] ?>
move (2) steps
end
This, in theory, should work. The receive block is just so you know when it should start at
Happy to help, again
20140069G 20140069G loading
Thanks again, by the way even though the project you said was complicated, yours is still as good, dont give up and keep making more awesome games like mining idle!
20140069G 20140069G loading
Yup! It worked! Thanks alot everyone!
ramenecho ramenecho loading

20140069G wrote:

Yup! It worked! Thanks alot everyone!
Happy to help!