Need help with wrap

Get help using Construct 2

Post » Wed Nov 20, 2013 5:42 pm

Hello guys,
so, I was having some problems trying to use the wrap behavior and now i'm using events to do the same, as you can see at the new version of my demo rpg:     

scirra.com/arcade/action/11246/my-rpg

But the problem is: when the character wraps he always go back to the same position! If I try to wrap while jumping, for example, when he collides to the wrap event, the character gets back to the ground!
(If you didn't understand, just try it out at my demo on the link above ok?)

Anyone knows how to solve this problem?alan3492013-11-20 17:45:12
B
12
S
3
G
1
Posts: 80
Reputation: 2,109

Post » Wed Nov 20, 2013 11:25 pm

@alan349

Have you already tried setting the character's Y-position when the wrap happens? Record Y, wrap, set Y--he should end up in the same relative position.

I haven't used the wrap functionality too much, so it may be unavoidable. From your demo, assuming it's just wrap you're using, it definitely seems to reset the character.

Try setting the X/Y position of the character in relation to the current viewport. Assuming the camera is following the character, that shouldn't affect the view at all. Sort of like manual wrapping?
B
16
S
6
G
2
Posts: 152
Reputation: 3,764

Post » Fri Nov 22, 2013 9:57 pm

@Space Ape

You have said me to record the character's Y, right?
But.. how can i do that?
Sorry, i'm still a newbie..
B
12
S
3
G
1
Posts: 80
Reputation: 2,109

Post » Fri Nov 22, 2013 10:13 pm

I don't like the wrap behaviour. I once used it with a large object, and it just moved it back to the edge, so half the object always popped into view.

I would recommend you use an event based on the following:

If object's xPos > Layout.Width+(Sprite.Width/2) set x position to 0-(sprite.Width/2)
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
80
S
12
G
7
Posts: 965
Reputation: 10,750

Post » Fri Nov 22, 2013 10:30 pm

What about changing layout?
How can i do the same thing?alan3492013-11-22 22:35:16
B
12
S
3
G
1
Posts: 80
Reputation: 2,109

Post » Sat Nov 23, 2013 1:52 am

@alan349

Sorry, buddy, I didn't know where you were with C2 yet. :)

You have many different options to record the character's Y-position on the screen. You can use a global variable, setting it to the character's Y-position when they contact the edge or whatever causes them to wrap. When it happens, set the character's Y position to that variable and their X position to where they should emerge.

You could also instance variables, which would accomplish the same thing but prevent the variable from being manipulated by other parts of your game.

The manual has more details on how to use variables, but it looks like that might be a viable option.
B
16
S
6
G
2
Posts: 152
Reputation: 3,764


Return to How do I....?

Who is online

Users browsing this forum: Euduardo, Kin, mikehive, ratboy3, tinhofiel and 45 guests