About Bullets!

0 favourites
  • 9 posts
  • So Constructers what is the best way to do these,I tried but they are not working the way I want:

    1- I want the character to wait like 2 seconds before it's able to shoot again.

    2- is there any way around to make yor bullet draw a line behind it wherever it goes before it hits the target and fades away? Like a path tracing more or less.

  • both are possible.

  • fawdda

    1 - Add a cooldown to your fire action. Something like :

    Var Cooldown = 0;

    On fire event (if Cooldown <= 0) Fire bullet; Set Cooldown to 2;

    Every tick (if cooldown > 0) substract dt (delta time) from cooldown.

    2 - You can create a sprite behind your bullet at every tick. And destroy this sprite after few secs.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Check out this tutorial by Ashley, he explain of to do this kind of thing using the Wait and Every N second conditions

  • Joskin OlivierC thanks a lot I'll give it a try.

  • here a capx

  • fawdda

    1 - Add a cooldown to your fire action. Something like :

    Var Cooldown = 0;

    On fire event (if Cooldown <= 0) Fire bullet; Set Cooldown to 2;

    Every tick (if cooldown > 0) substract dt (delta time) from cooldown.

    2 - You can create a sprite behind your bullet at every tick. And destroy this sprite after few secs.

    I'm curious about this approach versus using a timer. It basically does the same thing (I beleive), doesn't it? I have an InstanceVar on the player, canShoot set to true. Then when the player shoots, the instancevar gets set to false, and I set a unique timer. When the timer event fires, I set the instancevar back to true. I know the dt is the real time in seconds, whereas the timer would be affected by the fps the game was currently ruuning at. Is this correct? Is the approach you outline here more efficient and optimized than a timer approach that I'm currently using?

  • yonda thanks a lot for the capx file.

    I like the trail fx but when I boosted up the bullet speed it's become into pieces, showing the fact that it's just a rectangle sprite.

    I actually want to achieve your effect but with sequential trial that follows the bullet no matter where it goes.

  • you could use an effect

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