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

Get help using Construct 2

Post » Tue May 13, 2014 7:33 am

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
You do not have the required permissions to view the files attached to this post.
B
4
Posts: 5
Reputation: 210

Post » Tue May 13, 2014 9:38 am

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.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
52
S
22
G
18
Posts: 2,122
Reputation: 17,093

Post » Tue May 13, 2014 3:13 pm

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.
B
17
S
3
G
3
Posts: 89
Reputation: 2,825

Post » Tue May 13, 2014 6:47 pm

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
You do not have the required permissions to view the files attached to this post.
B
4
Posts: 5
Reputation: 210

Post » Tue May 13, 2014 7:44 pm

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
B
4
Posts: 5
Reputation: 210


Return to How do I....?

Who is online

Users browsing this forum: marc254 and 9 guests