ThomasP's Recent Forum Activity

  • You don't restart the layout, you simply make the layer invisible when the menu isn't open and then visible when it is. It doesn't require changing layouts at all except that initial load to pull the objects on the layer in.

  • As for the second question, are you talking about something like a global UI or menu system that can be used on multiple layouts? Here's a good tutorial for one of those: https://www.scirra.com/tutorials/594/bu ... terface-ui

  • Event sheets have layers? I thought only layouts have layers.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can add a sub event to the function to choose that IID, but I don't think choosing something by IID is available as an action.

  • Great graphics, I'll be coming out to check this out with more content. Keep up the good work!

  • Do the cannonballs spawn far enough away from the cannon so the sprites aren't touching when it spawns initially?

    What is happening when you get that error, or does that pop up as soon as you hit the play button?

  • I should mention that I set the x and y to be slightly on the side of next level's exit object, to avoid the infinite teleporting. But I suppose it's actually more versatile to have a destination object ( like you do) instead of setting the x and y. That way if you change the level you don't have change the coordinates in a lot of places, but rather just move the object.

    Yeah, that versatility and making level-building easy was what I was going for, but if I can't get that to work, at least your method works!

    Although, you could probably set something up so that when the layout loads, or on start of layout, each exit variable is set to whatever the sprite's X and Y coordinates are, so it is automated like my method but thorough enough to work like your method...

    EDIT: Ignore the preceding paragraph because I'm an idiot.

    Also, I got it to work using mindragon73's method, but adding a variable called ExitAvailable that is made false on start of layout, and then made true once the player is no longer overlapping an exit sprite. Thanks everybody!

  • Hi!

    I´m actually trying to do the same thing, and what I´ve done and which seems to work ok so far (even if I´m sure there is a smarter way of doing it), is something like this (pretty close to what you have done)

    I have two global variables: DestinationX and DestinationY

    I have an "Exit Sprite" with three instance variables: nextX, nextY and NextLayout.

    I place the sprite where I want an exit to be.

    Then I set the variables in that sprite instance to where I want the player to "teleport" to.

    Then I have an event saying something like (if I recall correctly):

    Player -On collision with ExitSprite -> set DestinationX to ExitSprite.NextX

    -> set DestinationY to ExitSprite.NextY

    -> go to Layout(ExitSprite.NextLayout)

    And on each layout I have an event saying:

    On start of layout->create player at DestinationX, DestinationY

    Also, I noticed that I had to have the player sprites (I have a hitbox, a "movebox" and the actual animated sprite) on a separate layout not used in the game to avoid duplicate players to spawn in the layouts.

    So you're recording the X and Y coordinates of the destination and just sending the sprite there instead of onto an object? I'll give that a shot when I get home, thanks. I have had the duplicate players issue, so I'll move them all do a separate layer also. Thank you!

  • As you have the events, when you go to a different layout from Layout1, you have not recorded where you came from, so on the next layout you try to create an object at Exit.LeadsTo where neither LeadsTo equals the previous layout's name. You could use On End of Layout and store the current layout's name in a variable, then compare that variable to the Exit.LeadsTo in the create function. There's another problem you will encounter when you fix that issue - when you create a player on top of an exit, the on collision trigger will fire and you'll end up travelling to a different room, only for the player to be created on top of an exit again, and so on, every tick...

    I actually have a CurrentLevel which holds where the player left from and an EnteringLevel (both global variables), and the Exit.LeadsTo is supposed to match the CurrentLevel, which the player just left. I can't check the capx right now, so I'm not sure if that is showing that. I did run into the problem you described once and it kept bouncing me back and forth between two layouts. I didn't know what was happening, so thank you for that explanation, it makes perfect sense!

  • CurrentLevel is a global variable

  • I have mine as sub-events.

    Mouse -> On Left button Clicked

    System -> [variable name] = 1 ..... here are events for that

    Else

    System -> [variable name] = 2 ..... here are events for that

    Note, you do need the "Else" condition for the second sub-event and beyond. And to get to the variable name part, it's called Compare Variable after you select the System event.

ThomasP's avatar

ThomasP

Member since 26 Mar, 2014

None one is following ThomasP yet!

Trophy Case

  • 10-Year Club
  • Email Verified

Progress

11/44
How to earn trophies