Same Speeds, Yet Different Movement, HELP!

Get help using Construct 2

Post » Thu Jun 13, 2013 12:50 pm

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!

https://dl.dropboxusercontent.com/u/113382849/Problem01.capx
bigproblem012013-06-13 12:51:32
B
6
S
1
Posts: 32
Reputation: 789

Post » Fri Jun 14, 2013 9:47 am

bump.

Construct masters hear my call :D
B
6
S
1
Posts: 32
Reputation: 789

Post » Sat Jun 15, 2013 2:02 pm

bump :/
B
6
S
1
Posts: 32
Reputation: 789

Post » Sat Jun 15, 2013 2:10 pm

try maeking them bullets?????
B
39
S
10
G
7
Posts: 514
Reputation: 9,546

Post » Sat Jun 15, 2013 2:27 pm

already tried that, doesn't work, actually makes it worse : (
B
6
S
1
Posts: 32
Reputation: 789

Post » Wed Jun 19, 2013 9:48 am

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
B
6
S
1
Posts: 32
Reputation: 789

Post » Wed Jun 19, 2013 2:32 pm

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.
B
55
S
28
G
18
Posts: 1,520
Reputation: 25,315

Post » Wed Jun 19, 2013 3:06 pm

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.
B
15
S
6
G
6
Posts: 512
Reputation: 5,555

Post » Thu Jun 20, 2013 9:11 pm

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)
B
6
S
1
Posts: 32
Reputation: 789


Return to How do I....?

Who is online

Users browsing this forum: ivosb, Moordhuis, omnipaws, rayray, xshina171, Youtopize and 8 guests