How do I Fix All These Mindboggling Fails?

0 favourites
  • 6 posts
  • I'm working on moving my sprite between layouts, based on this simple but brilliant .capx file:

    I have copied the logic into my project, but I have a few problems (Note: I am not a programmer; unless the solution is spelled out for me, I have no idea how to fix it).

    1) The simple .capx file above moves the sprite between 2 layouts, A <--> B.

    Right now, I have 3 layouts (and will have more). I need to know how to move the sprite A <--> B <--> C.

    I tried tinkering with the logic based on the simple .capx file, but it didn't work.

    2) My sprite is spawning all over the place. It's supposed to spawn at the position of the portals.

    On the first layout, it spawns where I have placed the sprite manually.

    On the second layout, it spawns in the margins somewhere.

    On the third layout, it is nowhere to be found.

    3) And lastly, I have defined a custom cursor, but it doesn't "appear" until the second layout.

    Can anyone explain, step by step, what I should do to fix these problems?

    Here is my file:

    Thank you for reading this!

  • 1) I think you've made this too complicated. All you need is two events, one for left and one for right. When Stapleton is overlapping the sprite on the left go to previous layout, when Stapleton is overlapping the sprite on the right go to next layout.

    2) You set Stapleton position but you don't actually create the object. When you go to a new layout you need to create Stapleton unless it's in the layout view by default.

    3) Again you don't have a cursor anywhere on the layout so it can't load it. If you look at Final Hall you'll notice that the cursor is off screen.

    Some tips :

    Previous/next layout works by using the order in which the layouts appear in the Project bar list. So next will always go to the next room if you list them in the correct order you want in the game.

    When you go to a new layout it unloads everything from the previous layout in memory, and loads everything on the current layout. This is why it can't see your objects. You need to have them in the layout already or you can spawn the player on start of layout.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi Plinkie!

    Okay, I did what you said as far as simplifying the layout changes. Please check out this simple example:

    It works great, save for 2 things:

    • How do I have only 1 Player spawn on the screen at a time? Layout A spawns 2 Player sprites, even though I moved one into the margins. Like you say, it has to be on the screen somewhere or the system won't know what I'm talking about.
    • I'm trying to make it look like the Player is moving from room to room... therefore, when it exits on the right side, I'd like to have it appear on the left side of the next layout (and vice-versa), ideally at a similar X and Y position as the previous layout. That way, when the Player exits Screen A from the bottom-corner right side, he appears on Screen B in the bottom-corner left side. Right now, it's just being spawned in a meaningless spot.

    I know I'm asking a lot, but you have to believe me, I am not intuitive to this kind of logic. Can you please, please with sugar on top tinker with my simple .capx file ( and reply with a working version?

  • Here you go: ... .capx?dl=0

    I set up an ID so if you are in starting layout, ID is 0, layout B, ID is 1, layout C, ID is 2 etc. When you enter a layout it checks your ID, which will be the ID from the layout you just left from. So if you exit to the right at the start into the second layout, your ID is 0. It checks this and spawns you on the left if it is 0. If you enter the same layout from the right hand side (layout C) your ID will be 2 from that previous room. It just does a simple check, 0 or 2 and spawns in correct place. After the checks are done, it then sets your ID to the current ID of the room. When you then go into the next layout C it will check if your ID is 1 or 3, 1 being from layout B and 3 being from a future layout D.

  • Here is an even "simpler" cap based on what you are asking.

    Comments explain what is going on.

  • You guys...



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