Majinboo's Forum Posts

  • I have 4 spritefont objects, i want to fill these objects with 3 random answers and 1 with the correct answer, i tried to use pick a random instance and didn't work, i tried now to use pick instance with UID and didn't work ( sometimes 1 or 2 spritefont objects are empty without text and without the boolean true) , i tried to set a random number in a variable (1 to 4) to each spritefont but didnt work too because the number repeat byself and i dont know how to avoid this, i want to use different positions to the answers each time i call the function. please help!

    why?

  • Rex date plugin

  • 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.

  • try :

    System Repeat 5 times............System Wait loopindex (seconds)

    Using Wait in loops

    thank you man, this help me a lot!

  • 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.

  • 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!!!!!!!!!!!!

  • 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.

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

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

  • 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.

  • 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

  • i want to spawn this enemies in order and with little pauses between each spawn, for example i want to spawn 5 enemies but each enemy will appear each one with 0.5-1.0 second of difference and in order, right now they spawn in disorder and not in order like they are in the json array.

  • 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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok, got it. From what I see I think you should approach this from other side.

    Don't add enemies to the Array when they are spawned, but rather add them when they are destroyed. In short it means that you don't need to ....

    I need the values of the array because of what i explain you in the PM, level time countdown in the capx was an example, i will set countdowns even of 6 months, 43 hours etc..

  • Ok, got it. From what I see I think you should approach this from other side.

    Don't add enemies to the Array when they are spawned, but rather add them when they are destroyed. In short it means that you don't need to ....

    5 Unseen enemies spawn each time , after you destroy these 5 enemies without clicking then they level up +1 so the countdown start, after the 5 unseen enemies are destroyed then the old enemies spawn 5 each time too of course when the countdown ends, so i will have a queue list of time out enemies, after you don't have old enemies to spawn then more unseen enemies will spawn 5 each time.

  • Ok, got it. From what I see I think you should approach this from other side.

    Don't add enemies to the Array when they are spawned, but rather add them when they are destroyed. In short it means that you don't need to ....

    level up will be simple, destroy 1 enemy without clicking then enemy +1

    Check your PM's