Respawn Array Enemies using real time countdown.

0 favourites
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • Finally i make this work, please give me a hand to subtract the time away to the countdowns,

    http://www.filedropper.com/countdownandspawnarray

    I used localstorage to save the countdowns, the capx makes exactly what i want.

    Now i just need to fix a 3 issues:

    1. When i refresh the browser new objects disappears because the value 2 is saved in the array before i destroy the enemies. (i tried to fix this but i cant find the logic to do it)

    2. Respawn each enemy with interval of time between each spawn to looks more natural (right now sometimes spawn 4 or 5 enemies all at the same time) , and spawn in order, like a queue list.

    3. Subtract the away time to all countdowns, i used the rex_time_awayL then right now i can see the away time in a text object to debug but i need to subtract it to all countdowns when you reopen the game, i tried on start of layout:

    UPDATE: now didn't work, i don't understand why <img src="{SMILIES_PATH}/icon_e_sad.gif" alt=":(" title="Sad">

    Maybe i am doing unnecessary things with this loops but if you see with the debugger visor and you see what the capx makes then you will understand perfectly what i want to do, thank you so much for your help!!! i cant believe that i progressed so much xD

  • Hey, sorry man was away all day. Had a brief look at your capx and try this.

    When all enemies are destroyed (all 5 of them) maybe then make a loop to subtract countdown time for all saved enemies in the array. And when that loop is done spawn new wave of enemies. Loop through huge array will take some time, but if nothing currently will happen on the screen it should be fine.

    As of the subtracting TimeAway from countdowns. You don't need to check them all the time in game. There is no need for that. What you want to do is a quick check only at the Start of layout.

    In short something like that.

    +On start of layout

    ++For Each value > 0 - > set value to value - time away.

    This works as a "game initialization" you only need to run in once, when player starts the game.

  • Hey, sorry man was away all day. Had a brief look at your capx and try this.

    When all enemies are destroyed (all 5 of them) maybe then make a loop to subtract countdown time for all saved enemies in the array. And when that loop is done spawn new wave of enemies. Loop through huge array will take some time, but if nothing currently will happen on the screen it should be fine.

    As of the subtracting TimeAway from countdowns. You don't need to check them all the time in game. There is no need for that. What you want to do is a quick check only at the Start of layout.

    In short something like that.

    +On start of layout

    ++For Each value > 0 - > set value to value - time away.

    This works as a "game initialization" you only need to run in once, when player starts the game.

    i optimized a lot the events, right now my main issue is subtract the away time, i tried on start of layout but didn't work, i tried a lot of things but for some reason this didn't work.

    http://www.filedropper.com/v2_3

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • In even 3 where you have System: Set elapsedTime to TimeAwayL.ElapsedTime you need to put a (tag) at the end so it should look like

    System: Set elapsedTime to TimeAwayL.ElapsedTime("t") in your case

  • In even 3 where you have System: Set elapsedTime to TimeAwayL.ElapsedTime you need to put a (tag) at the end so it should look like

    System: Set elapsedTime to TimeAwayL.ElapsedTime("t") in your case

    Didn't worked , i don't why this don't subtract the elapsed time to all array countdowns.

  • On start of layout...you have a empty Array..

  • On start of layout...you have a empty Array..

    I need to create another start of layout under the array event?

  • you need to move event "For each X element"..

    ..after you load Array from Json or Local Storage...substact time...

    another thing...

    I see only zeros et "Cur.X,6"...and you have a condition.... if Value at Cur.X,6>1....

  • you need to move event "For each X element"..

    ..after you load Array from Json or Local Storage...substact time...

    another thing...

    I see only zeros et "Cur.X,6"...and you have a condition.... if Value at Cur.X,6>1....

    I want subtract the away time one time only when the player opens the game, i cant move the event outside the start of layout because if i do this then i cant countdown the time values in the array, i tried to create another start of layout event but didn't worked, i cant subtract the away time, the only way that this worked if is i put the event outside start of layout but the event subtract the away time all the time and this is not the intentions.

    You only see zeros but they aren't zeros because i have another event that countdown time values inside the array.

  • I'm sorry I do not know how to help you....

    event "For each X....." simply can not be executed..because "on start of layout" you do not have "Cur.X,6"...

    ...you do not have "Apples","Oranges","Bananas" ..

    ..just a empty array

  • I'm sorry I do not know how to help you....

    event "For each X....." simply can not be executed..because "on start of layout" you do not have "Cur.X,6"...

    ...you do not have "Apples","Oranges","Bananas" ..

    ..just a empty array

    Yes thank you! , i notice this and i tried to fix it, i just want to run this subtract thing 1 time when the player opens the game, i don't if this is the good way to do this:

    UPDATE: Now its working in this position, i just add tigger once!!!! thank you so much!!!!!!!!!!!!

  • Thank you for your help! now its working! , after several hours of trying i solved the loops issues, Your capx examples in other threads saves me a lot! , thank you all for helping me in this thread, without you guys I would have given up weeks ago.

  • Remember KISS! Keep It Simple Stupid. (Not calling you stupid, that is actually what this acronym stands for)

    If you use rex_time or rex_date, it pulls that time from the players local system clock, which means that they can manipulate the clock to hack your game, like this:

    Subscribe to Construct videos now

    Games are complicated enough to make, you should always be looking for the easiest, simplest, and stupidest way to do things. Like my mentor said: "I know my code is stupid, but it works."

  • Remember KISS! Keep It Simple Stupid. (Not calling you stupid, that is actually what this acronym stands for)

    If you use rex_time or rex_date, it pulls that time from the players local system clock, which means that they can manipulate the clock to hack your game, like this:

    Subscribe to Construct videos now

    Games are complicated enough to make, you should always be looking for the easiest, simplest, and stupidest way to do things. Like my mentor said: "I know my code is stupid, but it works."

    I know, but i am not programmer, ironically the KISS way to make my game its using rex time plugins otherwise i cant make my game lol.

  • Yea, but the same principles still apply. And you are becoming a programmer simply by working with C2.

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