how find solution

0 favourites
  • 5 posts
From the Asset Store
Use this game pack to create your own game, modify the existing game or simply take a look and see how it was made.
  • https://dl.dropboxusercontent.com/u/44710358/cooldown.capx

    Each enemy have variable called 'cooldown'

    so when one enemy have cooldown=1 he should shoot every one second

    but second enemy have 3 in cooldown but problem is because all enemies shoot at the same time

    Maybe someone find a solution of this issue

  • Hi, so the problem is you aren't calling the code for each enemy, you are running it for both at the same time.

    A way around this is to use a timer system for both enemies.

    I added another variable to your enemies, called Timer. Timer is the part that changes, cooldown is simply the total cooldown for each enemy.

    http://imgur.com/vjGziP1

  • TMAJA thanks that worked

    i have else problem

    i add other variables

    recoil (how fast enemy gun shoots)

    burst (how many projectiles spawn when timer is 0)

    Your timer for each enemy working

    but recoil and burst is for all enemy at once

    Please download again this same capx

    Or someone else please

  • bump

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • TMAJA thanks that worked

    i have else problem

    i add other variables

    recoil (how fast enemy gun shoots)

    burst (how many projectiles spawn when timer is 0)

    Your timer for each enemy working

    but recoil and burst is for all enemy at once

    Please download again this same capx

    Or someone else please

    Hi IGDev,

    (Im on my mobile, cant load/open your project, so I hope I can help otherwise ;D )

    you could try giving your enemy objects instance variables (or if you are working with families, give it to them), one for each. With a "for each" event you could check every enemy on your layout; reduce their individual variables by X every X triggers (or seconds, however you want it to be). A third condition inside your for-each loop could check if the variable is = X (compare instance variable) and then trigger other events (hope you got how I mean it ).

    But be warned (if you have not had performance issues ever with C2), speaking about mobile games, "Every X seconds"-events *may* have a *huge* impact on cpu usage; if you plan having many enemies onscreen you possibly need an another solution for this (of course it depends on which device you have, its cpu, GHz, etc....).

    Hope I helped. Regards

    Proxy

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