Discuss Scratch

somskies
Scratcher
10 posts

can anybody teach me how to shoot a gun in rpg scrolling game?

I'm making a scrolling rpg game and I don't know how to shoot a gun in scrolling rpg. Can anybody teach me the code? thank you.
https://scratch.mit.edu/projects/984208316/ this is the link to my game.
PhiPhenomenon
Scratcher
500+ posts

can anybody teach me how to shoot a gun in rpg scrolling game?

I tried to follow what your code intended to do for the shooting script. If I got something mixed up, let me know.

In the boomerang sprite, replace the when space key script with this:


Then make a new sprite called bullet and add these scripts:


The trigonometry is needed to make the bullets move with the scrolling.
somskies
Scratcher
10 posts

can anybody teach me how to shoot a gun in rpg scrolling game?

I was almost able to do it but as you can see the player has to be a little high than the “y” of the bullet. Can you teach me how to fix that too? sorry for a lot of questions. https://scratch.mit.edu/projects/984208316/
deck26
Scratcher
1000+ posts

can anybody teach me how to shoot a gun in rpg scrolling game?

So calculate the y value for the bullet and then subtract a constant.
somskies
Scratcher
10 posts

can anybody teach me how to shoot a gun in rpg scrolling game?

How do I do that?
MineTurte
Scratcher
1000+ posts

can anybody teach me how to shoot a gun in rpg scrolling game?

somskies wrote:

How do I do that?
((bulletY) - (wherever the player is))
I believe
somskies
Scratcher
10 posts

can anybody teach me how to shoot a gun in rpg scrolling game?

sorry but zi couldn't do that. It didn't work. someone please help me with this code
Eason_9
Scratcher
1000+ posts

can anybody teach me how to shoot a gun in rpg scrolling game?

I remixed your project and change some scripts, it probably works now. I also added notes in the code so you can change it easier.

Powered by DjangoBB