I am trying to make it so there is a limited amount of ammo the player can use, in other words, they cannot shoot so much that the counter goes into minuses
I am expecting that the player can no longer shoot after running out of ammo, and is forced to pick up more
The player is completely barred from firing in general, nothing happens when you press the button
Note: I am completely aware that the ammo is actually the score, this was on purpose to make it so that the player has to choose wisely when they shoot, because when they do it’ll lower their score
You might want to check out the fire bullets extension, it does a lot of these mechanics for you.
I’m very new to Gdevelop, started about a week ago, and have learnt without much help, but those extensions make me completely clueless, is there anywhere to learn? Also after having a quick skim through it, I couldn’t find a way to attach the ammo count to my score, so im not sure itll work as I want it to, but thank you for the recommendation
You’re subtracting from a scene variable named scene but checking an object variable named scene. Are they supposed to be the same or is the scene variable set somewhere else. Also, make sure they start with a score above zero or they’ll never be able to shoot.
You can attach virtually every property of the fire bullets extension (or any extension) to a variable (like score) using expressions like this
Extensions might look confusing but they do all the work for you (which is a good and a bad thing, depending on how you look at it).
If I had to be honest with you, what you just said sounded like some ancient witchcraft to someone like me who’s understanding is very very, limited, but I will try my best to dissect it slowly. 1. I’m subtracting from a scene variable named “score”. 2. Im aware that normally, yes they need to start with a score above zero, but, what im trying to accomplish isnt normal, what im attempting to do, is subtract 1 from the score, whenever the player fires a bullet (or fireball in this case), the player receives score by picking up hearts (instead of coins) around the map
What others suggested is 100% accurate about fire bullet extension
You should watch some tutorials how to use it or other extensions
And then ask some questions if you still don’t understand how extensions work
As for your question
You could simply add condition to your event which fire your bullets
To check if score variable is greater than some value for example 20
And so player will be able only to shoot if score is 21 or higher
But that would also mean that if player starts game with 0 score he will be locked out from shooting
On the left side, you have a condition checking if the variable Score of object NewText >= 1 but on the right side you only have an action that lowers the scene variable named score. Do you set the object variable somewhere else or are they both supposed to be the same scene variable?