How do I get these events working/make game run in realtime

  • I'm making a tamagotchi-esque virtual pet game, and obviously a major element needs to be that it runs in real time. I've got the "Clock" plugin (https://www.scirra.com/forum/viewtopic.php?f=153&t=61090) and some events running that keeps track of the pet's total age in minutes and seems to work properly.

    So then I added some more variables with the idea to save the age in minutes at the save (and it saves every 5 seconds), and then on loading the layout compare the old age to the new, figure the difference, and then subtract accordingly from the ValueHungry variable (440 is the max value for that).

    Problem is, it doesn't do it. I don't know why not, it seems fairly straight forward, but I'm really new to this software so maybe I'm missing something?

    This is a game-breaking issue and if I could get some help I would really, REALLY appreciate it. I've tried all kinds of stuff and haven't been able to get it to work

    There seems to be very little information on making a game run in real-time in construct like this so any imput on other ways to go about it would also be welcome

  • I could be wrong but on load, age_minute, at the moment of the loading itself, could be the same as age_minutes_atsave, since the save function will save all global variables too.

    Maybe checking the value of these two variables in the debugger, to see if the problems comes from that.

  • Yes, this doesn't work because it's based on the data generated by the project. It doesn't go look for current system time.

    You're going to need to use the Node-Webkit object to write a text file containing system time.

    And on game startup load these files and set variables according to what it contains.

  • Thanks for the help but the value age_minutes is made based on information from the system clock. But since it can only get a value from 0-60 for the current minutes I have some other events that use current system time out the total age in minutes (also days and hours) and that seems to be working correctly.

    And I've already checked in debugger and the age_minutes and age_minutes_atsave are different values but it doesn't seem to run the calculations to find minutes_aged for some reason. maybe the system runs the events to figure out the minutes aged before it calculates how many minutes old it is? Could that be it? AAG I'll mess around with it some more.

    I attached more screenshots of the events that calculate age and a screenshot of the debugger paused right after it loads. (I made the save yesterday so that's why age_minutes is large)

    Thanks so much for your imput

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yeah that was the problem! It was running the events to figure out minutes_aged_sincesave before finished running the events to figure out the age_minutes.

    Thanks for helping me brainstorm it out

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