I have a character moving back and forth across the screen that fires a projectile, and I want the projectile to stay on screen.
The Y position part of my code is working, but I cannot get my projectiles to stay in the X position that they were launched from using a mousePress.
Does anybody have any tips on how to achieve this?
1 Like
Hello!
The idea is to have separate variables for the x position of the character and of the projectile - because they are not the same but express different things!
Therefore you need float characterX
AND float projectileX
upon firing, make sure to say projectileX=characterX;
// copy the current character pos X
Hey, and welcome to the forum, great to have you here!
Chrisir
1 Like