I am working on an endless runner and so far, I have basic scenes set-up, functions such as buttons and scene change are going o.k. The issue I am having in having my player shoot from the x position 121 (when shoot button is pressed.) What am I doing wrong here? Alternatively. I am having issues with the enemy movement. I just want the enemy to move up and down to block player’s path and the player can shoot them down.![:thinking: :thinking:](https://forum.gdevelop.io/images/emoji/apple/thinking.png?v=12)
Last but not least, lives! I can’t set that up for the life of me. I have been watching youtube tutorials but I think my issue is coordinating the Global variables. any help would be great.
I can’t understand the bullet problem. Can you describe it as detailed as possible?
For life variables. Just add an object variable for your player called “Health” then set its default valueto whatever you like. And then when Player collides with enemy, do minus x to your player’s health variable. Also add a condition when Health is less than 1, then delete the player or do whatever you like with it.
1 Like
Hi! Looking at your actions, you create a bullet in position 121,0 whenever the player touch the shoot button, but you only assign force to the bullets if the X position of the player is 121 (and his angle is 121).
I think you want to create a bullet from the player’s position that flyes trough the screen to the right, so you could do this (in pseudocode):
- If the player touches de shoot button, create a bullet at player’s position.
- Select the bullet that is nearest to the player’s position.
- Add a permanent horizontal force to that bullet
If you want to reduce the amount of bullets shooted (this creates a bullet every frame), use a counter, for example.
And remember to destroy the bullet once it leaves the screen.
1 Like
Ah, ok. I will try this. Thanks!!