My player moves unexpectedly to the far right of the next layout?

0 favourites
  • 5 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • Hi All,

    It seems I run into a lot of problems lately with my labyrinth game. So I do apologize for bothering this helpful community again.

    I have two layouts named "L1" and "L2". I also have a global player (sprPlayer) and an "exit" sprite (sprExit) with an instance variable "strDestiny".

    In "L1" the value of sprExit.strDestiny is "L2". So on collision with sprPlayer, the "L2" layout is shown and the player should wait in the opening on the left.

    sprPlayer has the "Tilemovement" behaviour and the grid is 48x48.

    The problem is that once layout "L2" is visible, the player moves without any keypress to the far right of the layout. This is wrong because he needs to wait in the opening at the left until the player presses one of the arrow keys.

    I created a movie of the wrong behaviour of my game together with screen captures at the end of the event sheets and sprExit and sprPlayer properties. Here is the link where you can watch the video:

    drive.google.com/file/d/1Qqbk8J9x-CxVE2V7g9vofBhvZKzTSLmA/view

    Please, can you tell me what is wrong and how I can correct it?

    Thank you so much for your help which I do appreciate.

    Kind Regards,

    Chris

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Probs share project, not sure why that would happen if they're the only events.

  • Hi Lionz,

    Thank you for your reply.

    I will try to share the project here with the following link:

    drive.google.com/file/d/1cOuRLUAnWId1lSV26sEzc31U4PiZZz-Q/view

    I have no idea why the player is behaving so strangely in L2. Even when I use:

    strPlayer Set X to 0 or to 2 or to 5, no value has any effect.

    Before I posted I searched Youtube, this forum, and the Internet but I could not find any information. Your help is much appreciated.

    Chris

  • It is because tile movement moves on a grid so it's trying to move to the grid position from the previous layout (because the object is global). Instead of set x, use set to grid position 0,4 or 0,5 they are the entrance locations.

  • Hi Lionz,

    Thank you for your help, which solved my problem completely.

    Have a lovely weekend!

    Chris

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