Need help with wrap

0 favourites
  • 6 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • 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?

  • 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?

  • 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..

  • 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)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What about changing layout?

    How can i do the same thing?

  • 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.

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