Same Speeds, Yet Different Movement, HELP!

0 favourites
  • 9 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hi All,

    I have this weird problem where two objects are moving at exactly the same speed (BG1.Y + InstanceVariables.Speed_Ground*dt AND Tree.Y + InstanceVariables.Speed_Ground*dt) but sometimes one of them jumps 1 pixel ahead..

    I've tried turning pixel rounding ON, it corrected the jumping but resulted in strange jittering which is worse (you'll see what I'm talkin about once you download the capx and turn it on)..

    I am attaching the capx here. Please take a look at the trees and the ground, sometimes the trees will jump one pixel down as if they're ahead of the background although they're moving at the same speed, I don't get what's the problem.. I though that the jumps may be connected to the ground looping itself but that does not seem to be the case since the "jump" does not occur at evenly spaced time intervals, it happens randomly..

    Could it be that it happens because the sizes of objects are different?

    I'd greatly appreciate if someone can tell me how to fix this since it's a major problem and I just can't seem to find a way around it

    Thanks all in advance!

    dl.dropboxusercontent.com/u/113382849/Problem01.capx

  • bump.

    Construct masters hear my call :D

  • bump :/

  • try maeking them bullets????? <img src="smileys/smiley29.gif" border="0" align="middle" /> <img src="smileys/smiley38.gif" border="0" align="middle" />

  • already tried that, doesn't work, actually makes it worse : (

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I floored the speeds and it helped, but did not correct the problem.. it's like at certain points one gets ahead/behind for some reason.. The only thing I could think of was size but it doesn't really make sense still

  • You want to move the background up by a fixed amount instead of moving it to a fixed position.

    In event 12 when y >= 0 you set it to (0, -512). y might be 0 or 0.05 or 0.1 - so you're moving it up 512px or 512.05px or 512.1px - it varies every time.

    Instead of 'set position to (0, -512)' change it to 'set Y to BG1.Y - 512' so it will always move up by 512px and you won't get the stutter.

  • Just a question, could it be that in the same tick the dt (deltatime) is different ? I mean if this is possible this could cause this problem. Try it an use instead of dt just for an try a constant number.

  • ramones! you're the man! it helped!

    Thanks for taking the time to review and understand my capx, I stripped it from the game as much as I could.

    Darklinki, I've tried before putting a constant number instead of dt-ing it but the result was the same. What ramones wrote above pretty much explains the real reason. since the ground speed increases over time, the Y of BG would end up at variable 'above zero' numbers, causing the stutter since the background wouldn't loop smoothly and the trees would make it apparent (while without them it might not have been obvious)

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