pin two global variable

0 favourites
  • 15 posts
From the Asset Store
Globals 2.0
$3.99 USD
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • https://

    drive.google.com/open?id=0BxuM6uiMrxpqaHlCMktFbUdyLWM

    see this and then exit the game and back again. you saw "amount" after 10 second subtract . and the "build time" (for exp is 28). the system don't calculation this 2 second of "build time".

    I should pin this two variable together . when "amount" is 4 "build time " is 40 . and when "build time" go to 30 subtract 1 of "amount, "build time=10" subtract another one. and when go to 0 subtract another one.

  • Dont store the amount. It is changing while offline. Buildtime can be negative !

    On item 'time' get

    set buildtime to max(0 , (ItemValue - awaytime))

    set amount to (buildtime) - (round(buildtime/10) *10)

  • thanks bro

  • i set those you are said. "build time" is perfect but "amount" has problem.

    when build time is (last number < 5) :

    94 ,844 ,54, 1014 : "amount"= 4

    23 , 2543 , 3 , 83 : "amount"= 3

    when build time is (last number >= 5) :

    99 , 1059, 729 : "amount"= -1

    597, 67 , 337 , 4597 : "amount"= -3

    when build time is (last number = 0) :

    "amount"= 0

  • Dont store the amount. It is changing while offline. Buildtime can be negative !

    On item 'time' get

    set buildtime to max(0 , (ItemValue - awaytime))

    set amount to (buildtime) - (round(buildtime/10) *10)

    i set those you are said. "build time" is perfect but "amount" has problem.

    when build time is (last number < 5) :

    94 ,844 ,54, 1014 : "amount"= 4

    23 , 2543 , 3 , 83 : "amount"= 3

    when build time is (last number >= 5) :

    99 , 1059, 729 : "amount"= -1

    597, 67 , 337 , 4597 : "amount"= -3

    when build time is (last number = 0) :

    "amount"= 0

  • The "on exist" triggers every tick, everything got calculated every tick. Because those things just are in the Local Storage = true.

    I should have used ceil(), my error, forgot you made it zero based.

    That 10 seconds trigger did things wrong, if the local storage returns a build time like 7 seconds (3 of 10 done previous time) it still took 10 seonds in stead of 7.

    Hope i corrected everything in this, else yell.

    https://www.dropbox.com/s/2051txbqsderb ... .capx?dl=0

  • thanks for your help

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • i test it but here is a problem and i can't fix it . when we start and click to buy and then exit the game and back again we don't have problem .

    1: don't touch any thing and exit again for 10 seconds , when games open our total change , refresh game(or click play on C2) total return to true number.

    2: don't touch any thing and refresh game the amount come back again, build time too.

    i'm exporting to apk file and i'm testing on device (the problems had exist)

    i try to say the system when build time = 0 ,set total = itemvalue + amount ,but this is have problem too.

  • And with those exceptions in place ?

    https://www.dropbox.com/s/5j3qvloug3nzi ... .capx?dl=0

  • the problem is that : we set MaxWhileGone towice .

    the first time we set amount value to it and the second time we set total amount + MaxWhileGone

    you can see it when you set the MaxWhileGone to text. you can see then when amount value = 0 , MaxWhleGone is not zero . we should set MaxWhileGone to zero when device or browser refreshed. i used on start of layout but not working . and i change place of "on get: time with amount" not working again.

  • You are right, you can scrap the second one. (in event 10)

    It is set to zero allready in event 4 when saved amount is zero.

  • i found a new problem

    when " away time<10" , system don't adding any to total.

    exp : buildtime = 23 and exit the game, after 6 seconds open game again . buildtime = 17 but total is not changing .

    if yo know a way please say it to fix this.

  • i'm thinking about it i don't found the problem where start from ?

  • I was a bit tired with a few things. Dealing with async getting. Adjust a code that i would not do that way. Player who could start clicking before all was loaded and set up.

    So, i just did it all over from scratch.

    https://www.dropbox.com/s/sm5sstnjjr3fg ... .capx?dl=0

    Now you have 2 layouts. 1 that handles loading from local storage. 1 that handles the game. Things cant go Async anymore, not by the Local Storage, not by the player starting to click to soon. Also means that you have to run/debug the project. If you mess up the local storage because you by accident run/debug the second layout, then click your green sprite to clean out the local storage. This can not happen when the game is run regulary (not from a layout).

    Plz, debug this trough. I dont think it has errors no more. I think it is very logic now. But i said that before.

  • thanks bro

    in this project we used every thing

    and that's nice to me,i understand more of plugins.

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