How do I spawn just one bomb

0 favourites
  • 4 posts
From the Asset Store
Bomb Box
$3 USD
Game inspired by the classic bomberman game, with a 3D footprint!
  • I've searched the forums and I couldn't find any help and I'm new to Construct.

    I want to make a game where the player collects bombs and can plant them where ever to destroy things blocking paths. But I want it so I can only drop a bomb after the player collides with the icon on screen.

    I've played with the events/ variables for hours and after the player collects one bomb it's like they now have unlimited. How can I make the player just drop one until the player gets another one?

    Thank you!

    p.s - I want the player to press the "D" key on the keyboard to drop the bomb

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I'd do something like:

    Variable: bombs = 0

    Player takes bomb, bombs + 1

    Player uses bomb, bombs -1

    if player bombs < 1, don't allow using bombs

  • I got it so when the player walks over the bomb icon it adds 1 to the variable and I also have it set so when I press the "D" key it spawns the exploding bomb and subtracts 1 from the variable but when I still press the "D" Key it keeps spawning bombs and I can't figure out how to stop allowing the use of bombs

  • You need to add another condition to the bomb planting where it checks the variable. If the variable is < 1 you do not allow them to plant the bomb. You can do this two ways:

    1. On your plant the bomb event add a second condition that if variable is equal to 1 (Events only happen if all conditions are met)

    2. On your plant the bomb event add a condition that variable is not equal to or greater than 0 (again, if the condition is not met, the event does not fire of it's actions)

    You can check the platformer tutorial or the basic tutorial (sorry I forget which one has you add multiple conditions to an event) for an example of adding multiple conditions to an event. I believe it is in the platformer tutorial by Ashley where you set the animation for idle or running based on multiple conditions. Also the part about jumping on the snails also has multiple conditions that need to be met in order to tell if you kill the snail or take damage instead. These should give you a good starting point.

    Basically what you need to do as part of the bomb action, is to check to make sure the variable = 1 or is greater then 0. If it fails the check, the condition is not met and the action should not happen.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)