Two questions about turret behavior (bullet fire rates and animation triggered by firing turret)

0 favourites
  • 7 posts
From the Asset Store
Game Triggers is as versatile as a Swiss army knife, and will be a great resource for any type of game you're creating.
  • 1. I want to limit the player to one bullet at a time. Meaning that bullet must complete its journey (either impact with target or leave the screen) before another bullet can be fired. I've tried changing the rate of fire but it seems to influence absolutely nothing in the behavior at all. As fast as I can push a key, that's how often I can fire the turret.

    2. I have set the turret to be triggered by a keyboard key press down and I want an object on the screen to animate each time that happens. Nothing fancy, just change colors to indicate the turret was fired. I've given the sprite two frames to toggle between but instead of ping ponging when the key is pressed, it does it as soon as I hit play and never again.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 1. You can add another condition to the event where you spawn a bullet:

    System Compare Two Values Bullet.count=0

    2. You can try something simple like this:

    Turret set animation frame 1
    Wait 0.1s
    Turret set animation frame 0
    

    Make sure to set the default animation speed to 0 in the sprite editor.

  • Thanks! That helped tremendously. The turret still goes through the animation at the start for no apparent reason but now it also does it when it's supposed to!

    Any thoughts on how to limit the number of bullets the turret can spawn?

  • 1. You can add another condition to the event where you spawn a bullet:

    System Compare Two Values Bullet.count=0

    Dop2000 was telling you to add a compare that makes sure you have 0 bullets at the time you try to make a bullet fire. If Bullet.count = 0 it shoots If Bullet.count != 0 it wont shoot

    (!= means does not equal)

  • Ohh, see I'm so new at this I didn't even know what that meant! And I still don't. I go to add a system or a bullet action and I can't get any thing like "compare" or "count" or an "if/then" option. Help?

  • Add a new condition or press "C" to add condition to an existing event. Select "System" object, find "Compare two values" condition in the list.

    In the first field put Bullet.count, in the second field choose =Equal to and in the third field put 0.

  • Thanks all! The factor I didn't include was that multiple keys can spawn a bullet from the turret... sort of like a multiple choice quiz that only destroys the correct answer. After trying various things, the way to get it to do what I wanted was the actually set each key that spawns a bullet to Bullet.Count = 1 and create a different (identical) bullet for each of the keys.

    Thanks for helping me figure it out!

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