I really need help with this,.
It’s hard to help with so few details. But you can use a filter behavior (if the arrow amount is greater than 0) before you shoot/emit/spawn an arrow.
ok i fixed it but i need to make it where if you have 0 arrows, it wont let you shoot arrows
like when it goes to zero, its where i can still be pressing the button and the number still decreases
i can help.
Thanks! Im new to making rpgs, espaically in platformer, so thanks!
And no problem, this should help you.
how to replenish the arrows one by one by collecting an item?
I don’t have a working example to share, but basically if my understanding is correct, you will want to create an item that will add + [number] to your arrows when your character collides with it (and also make sure the item gets destroyed after, otherwise the character will be able to collect infinite arrows).
Actually I do have something somewhat similar…
It’s an unrelated game to what you’re making, but when my player character collides with fish, it adds to the “food” number… basically you will need a collision block set to a “get” number and connected to the + arrows number.
WOW! thanks for the advice. SO here’s the issue, everything works except this concept.
I have to pick up one item to replenish my spell capacity and later to use it against monsters. In short, I pick up an object and i use it as a spell to shoot an enemy and if my ammo has run out then i should stop shooting.
Can you please help me here? If this is fixed my game concept is done!.
I’m still pretty new at this stuff, but that shouldn’t be too hard to code…
I’m thinking you will want a filter and a switch. A filter to check that your ammo is greater than 0. Pass, it turns the switch on. Fail, it turns it off.
Then you will have to run your “shooting” thing through the switch.
Essentially you want to disable your ability to shoot once you run out of ammo.
Off switch to the emitter. I’m thinking you will want to link your shooting key to the “in” position of the switch, then have the “out” go to the emitter. That way when it’s turned off, it shouldn’t emit.
Though I’m assuming you also have it set up to -1 arrow every time the arrow shooting key is pressed. You want to make sure that is set to not go below zero, otherwise you could end up with -999 arrows by pressing the key too many times.
Easiest way I have found to solve that is to connect a filter to the “arrow” value… say I want the max number of arrows to be 100 and the minimum to be 0, I set a filter “greater than 100” to a “get” 100 value rerouted back to the arrow number (or is it set? now I don’t remember for sure). Do the same with another filter on “less than zero” to reset the number at 0 to avoid having a negative arrow balance.
There might be an easier way to do it, but that’s how I’ve made mine work so far.
Not sure if this helps, as it’s what I used for a timed speed boost when holding down a key, but it’s the same general concept, you just need to adjust it for individual key presses rather than time…
When the stamina bar runs empty, the player character can’t speed boost any more until it recharges. But I also made sure that pressing the boost key will not drive the stamina bar into negative by holding it down after it’s empty, by adding a filter to set the “minimum” value at zero.
I hope some of this makes sense.
Your first advice giving, good job TGW.
Just passing along some of the tricks I’ve learned. I’m always happy to share knowledge once I have it.