Wrap alignment issue

Get help using Construct 2

Post » Sat Jul 28, 2012 6:21 pm

Hi All,

New to C2 and new to the forum.

Not sure if this is better in the bugs section or the how to section.

I'm just trying to get my head around a few differences from Gamesalad and this is an issue I've run into.

In GS the wrap behavior will wrap an object as soon as part of it is off the screen. In C2 the object does not wrap until it is completely off the screen.

In trying to replicate the GS wrap bahavior I've run into an issue with alignment.

In the attched demo there is coloured screen width rectangles beside each other, moving at the same speed, so as one begins to leave the screen the other should enter.
This works ok at low speeds and when little is on screen however gets very sporadic at varied speeds (use left/right arrows to test) or if more events are happening.

I'm running windows 7, IE9, Chrome and C2 beta r99. The problem seems a little worse in IE9 but is still obvious in Chrome. Pixel rounding is switched on (however I've tried both ways)

I've also tried turning off the wrapping and 'teleporting' the sprite with variations on the following:
    If Sprite X > LayoutWidth+(Sprite.Width/2) then Set X to 0 - (Sprite Width/2)

Which seems to work a little better however still has the same issue.

So my questions are as follows:

Is this a know issue/bug?

Is there a workaround?

Am I missing something obvious or is it just my system?

How does the wrap behavior work? (what position triggers the wrap? Is the object wrapped to just on or just off screen? Does velocity effect this behavior?)

Is the a way in C2 to create a looping wrap with a single sprite with perfect alignment? (no overlap as textures won't align)

Wrap alignment issue demo capx

Video in case my issue doesn't replicate

Thanks for any solutions/help/advice

Cheers

ChrisChrisoS2012-07-28 18:22:55
B
2
Posts: 3
Reputation: 656

Post » Sat Jul 28, 2012 7:35 pm

Perhaps the warp behavior does something similar to what you tried with events.
Do it with these two events instead:

X > LayoutWidth+self.Width/2
set X to self.X-LayoutWidth-self.Width

X < -self.Width/2
set X to self.X+LayoutWidth+self.Width
B
79
S
24
G
53
Posts: 4,728
Reputation: 40,219

Post » Sun Jul 29, 2012 4:17 am

Thanks You,

I make a few changes to the your formulas however that pointed me in the right direction.

The alignment using this method is very stable in comparison to the wrap bahavior. Of course this method is limited to one axis in its current form, but that suits my current needs.

X > LayoutWidth+(self.Width/2)
set X to self.X-(LayoutWidth+self.Width)

X < (LayoutWidth-LayoutWidth)-(Self.Width/2)
set X to self.X+(LayoutWidth+self.Width)

Wrap alignment issue fixed

Thanks for your help :)ChrisoS2012-07-29 06:56:39
B
2
Posts: 3
Reputation: 656

Post » Sun Jul 29, 2012 8:04 pm

Glad it was useful. You can reduce you event count to 2 by putting all the objects you want to wrap into a family.

I'm curious about the changes to the formulas, namely this:
LayoutWidth-LayoutWidth
Couldn't you just use 0 since it will evaluate to 0 no matter the value of LayoutWidth.R0J0hound2012-07-29 20:06:43
B
79
S
24
G
53
Posts: 4,728
Reputation: 40,219

Post » Mon Jul 30, 2012 12:45 am

Just trying to avoid any references to actual values, but yes, that was unnecessary.

I haven't experimented with families yet, thanks for the tip!
B
2
Posts: 3
Reputation: 656


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 34 guests