I have a student who’s wants her player in her game to “grab” a weapon that’s in the level, and only once it is overlapped be able to fire the projectile using A button.
I certainly know how to get a projectile to come from the player, but can’t seem to figure out how to get a projectile to activate only once a sprite has been overlapped.
Thanks for the help!
Here I made a little example of this with comments in the code so you can understand what is going on:
hope this helps!
1 Like
Very easy to implement.
Do these lines of code:
On SpriteType Player overlap with OtherSpriteType (Gunsprite Type):
- Destroy OtherSpriteType
- Set picked_up_gun variable to true
On Start:
- Set picked_up_gun variable to false
On press A:
- If picked_up_gun variable = true then:
- Set projectile [image], vx, vy
Let me know if anything goes wrong. I did this from the back of my head.
1 Like
Thank you both! That’s very helpful and solved the problem.
1 Like