How do I Make these "Wait"s Frame-rate independant

0 favourites
  • 4 posts
  • I am trying to get the timing right to make a monsters body segments follow its heads path. like a snake but in all directions. I need a way to account for any frame-rate by using dt but I don't really understand how to get it right....


    Can I make these wait commands frame-rate independent?

    The timing needs to be perfect otherwise the whole thing falls apart.

    .capx attached

    Also side note: If I use dt in a "On Start of Layout" event does it not work right? I did some testing with a textbox to see if that was so and it seems to not like taking any dt values on the first tick

  • Before getting into fixing this, I'm going to stress something: wait is already frame rate independent, although weird things may happen if you wait really small amounts of time, such as 1/60 of a second(i.e., less than the length of one frame).

    That being said, the method you've chosen isn't the best way to go about this, and seems overly complicated for what it is. I've modified your example to demonstrate the behavior I believe you're wanting.


    I've replaced all of the complicated timing with some basic math. If you're not familiar with trigonometry -- cos and sin are used here -- I'd highly recommend doing a bit of research, as even the most basic trig is an indispensable tool for game creation.

    Let me know if you want a more detailed explanation of what's going on.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Time measured in seconds is framerate independent! This seems to be a common point of confusion, including with 'Every X seconds'.

    Believe it or not, waiting 1 second waits for 1 second regardless of the framerate. 1 second doesn't suddenly become longer at 30 FPS

  • Thank you so much! I have literally spent over 30 hours on trying to get this movement correct..... (I am still very new to this stuff so hopefully that's not too pathetic heh). Your updated version is 90% what I want and I can definitely use it to make the movement like I want. Thank you again. I'm going for a movement pattern like "Moldorm" from "Zelda a Link to the Past" if you want to see how the enemy moves.

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