Help with a variable, please.

  • I am making a game with its own time frame, in other words time in the game runs faster than in real life. What I am trying to achieve is this. Player starts at the age of 10 but when she turns 20 for example I want time to run slower. Right now I have time running like this:

    I have 2 global variables (daysVariable and yearsVariable) and EVERY X SECONDS days go by and so do the years but when player turns 20, system is checking yearsVariable EVERY second, I would like to slow down time. How could I achieve that?

    Thank you.

  • You could fool around with timescale and delta time... but why not simply make the every x seconds for day change be just more seconds so the day is longer... hard to say more not knowing exactly what your game entails.

  • You would just use some if-then logic. You could have an event that runs every second with two subevents that change the day and year variables differently based on the value of the years variable.

    Every 1 second

    add 1 to yearsVariable

    add 0.5 to yearsVariable

    (Does my shorthand make sense?)

  • You could fool around with timescale and delta time... but why not simply make the every x seconds for day change be just more seconds so the day is longer... hard to say more not knowing exactly what your game entails.

    I am still learning a lot of thinks thanks to people like you. What I am trying to achieve is to slow time down when player is 10 years old, for example. I tried all your suggestions but I think my limited knowledge was a deterrent. So I created a quick, clean project just to show you what I am trying to do.

    I really appreciate all your help.

    http://www.geocities.ws/kikoriogames/SlowTime.capx

  • You would just use some if-then logic. You could have an event that runs every second with two subevents that change the day and year variables differently based on the value of the years variable.

    Every 1 second

    add 1 to yearsVariable

    add 0.5 to yearsVariable

    (Does my shorthand make sense?)

    Yes. It makes sense but I am a newbie so I think I could't get it right. Thank you, though.

    I am still learning a lot of thinks thanks to people like you. What I am trying to achieve is to slow time down when player is 10 years old, for example. I tried all your suggestions but I think my limited knowledge was a deterrent. So I created a quick, clean project just to show you what I am trying to do.

    I really appreciate all your help.

    http://www.geocities.ws/kikoriogames/SlowTime.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I couldn't open your capx cause I use the stable version of construct but I have a simple solution.

    You use every X seconds, all you have to do is using a variable as X.

    For example, if X=(yearsVariable/10) then every (10/10) 1 seconds

    when he is 20 years old ---------- every (20/10) 2 seconds

    If it's too quick, create timespeedVariable and use it as X.

    Every timespeedVariable seconds

    You change timespeedVariable when he is 20 years old.

  • I couldn't open your capx cause I use the stable version of construct but I have a simple solution.

    You use every X seconds, all you have to do is using a variable as X.

    For example, if X=(yearsVariable/10) then every (10/10) 1 seconds

    when he is 20 years old ---------- every (20/10) 2 seconds

    If it's too quick, create timespeedVariable and use it as X.

    Every timespeedVariable seconds

    You change timespeedVariable when he is 20 years old.

    So when I create this variable which value should I assign to it?

    Thank you a lot!

  • I couldn't open your capx cause I use the stable version of construct but I have a simple solution.

    You use every X seconds, all you have to do is using a variable as X.

    For example, if X=(yearsVariable/10) then every (10/10) 1 seconds

    when he is 20 years old ---------- every (20/10) 2 seconds

    If it's too quick, create timespeedVariable and use it as X.

    Every timespeedVariable seconds

    You change timespeedVariable when he is 20 years old.

    Alright, man!!! I did it!!! Thanks for the great explanation!!! Thanks everybody here!!!!!!!!!!!!!!

  • Yay!

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