[Help] Problem with Go To Layout

0 favourites
  • 3 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hi! How are you?

    I'm new at Construct 2. I'm trying to make a school project about a game that i really like: Pokemon (GBA style).

    I was able to make a smooth grid movement to it following some tutorials.

    I added a sprite-based animation to the character as well.

    All was going great till i got to "travel" part.

    Everything looks buggy now, when i try to move my char, the visual object goes to random locations. I've added a little of code but everything seems to be broken. I'm loosing my mind. Anyone can help me?

    Here's the project: h t t p s : //db.tt/g5nxXytE

    Thanks a lot!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ah, found the problem.

    Here it is fixed, and annotated in the comments


    See what was happening was you were setting the player position right before you pinned your animations to the player. But you had your pin set to remember the position relative to the object. This meant that your objects were very far apart, and as the player moved and rotated your player sprite went all over the place.

    So I set them to be at the same position, then pinned. Problem solved.

    Note that it LOOKS a little funny in the player, because it will look like there are times when your player and animations don't match. However, that is a visual only bug, due to the way you have the bullet. Because you are setting the angle of the bullet, it is setting the angle of the sprite.   If you look, they always have the same position, the player sprite is just rotating around the upperleft corner, causing it to appear out of alignment when walking anything other than right. If you run it through the debugger, you can see they actually are at the same position. Just don't use that player for collision, and you'll be okay.

    If you do want to use the player for collision, I would recommend using Lerp and doing an actual linear interpolation (keep track of the move timer yourself and update it every frame, don't feed the position back into the Lerp, that performs asymptotic movement.

  • That was it! Great then, i tried the "Go To Layout" action and it works like a charm.

    Your solution works great! The example uses an object (wallDetector) that it's used to detect collisions on overlapping.

    Thanks a lot. <img src="smileys/smiley1.gif" border="0" align="middle" />

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