Layout Question

This forum is currently in read-only mode.
  • How could I do a thing where like I go to the left and it loads a new layout but you spawn on the right in the right place? My game I'm making requires this, and I don't know how to pull it off. Like the MM games except each screen shift is a layout and it just instantly changes. I need halp.

  • Something like this(note: not actually code, but easy to understand):

    + = conditions

    • = actions

    FIRST LAYOUT:

    + Character reaches left of screen

    - Set global variable 'yposition' to character.Y

    - Set global variable 'side' to "left"

    SECOND LAYOUT:

    + On Start of Layout

    + If global variable 'side' is equal to "left"

    - Set character.X to 640

    - Set character.Y to global('yposition')

    + If global variable 'side' is equal to "right"

    - Set character.X to 0

    - Set character.Y to global('yposition')

    If you want, I could probably rig up an example file pretty quickly. Hope that helps.

  • I was thinking he should just divide his large level into smaller parts by repositioning the camera. It's more efficient than creating multiple layouts.

  • I was thinking he should just divide his large level into smaller parts by repositioning the camera. It's more efficient than creating multiple layouts.

    I actually created something like that for the MM2 remake I had been working on. I just had two different screen-sized bricks which I placed in a grid, alternating between the two. If you collided with one that was different than the one you were already in, it would scroll. Unfortunately, that code is pretty cluttered and hard to understand. I need to figure up a better way of doing it.

  • We should ask DeadEye. This Cursed Rock clearly has what we're looking for.

  • Er, that depends, I guess. Do you mean that at the end of the whole level you want to change screens automatically and start your character off in the right place, or do you mean you want the screen to scroll one screen at a time on a grid like I did in my game?

    If you want the first one you just need to set your character's x,y in the Start of Layout.

    If you want the second one, you don't need a layout for each screen. Just make one large layout like normal. Here's how I did the scrolling in TCR:

    +Always
       ->System: Scroll X to floor(playerSprite.X/640)*640+320
       ->System: Scroll Y to floor(playerSprite.Y/480)*480+240
    [/code:32brt6iw]
    
    This splits the level up into a 640*480 grid, basically.  You have to make sure your layout size is a multiple of your display size in order for it to work right*.  And, naturally, if your display size is different than 640*480 the numbers would be different.
    
    *(For example, my whole level is six screens by six screens, so the layout size is 640*6 = 3840 pixels wide and 480*6 = 2880 pixels tall.)
  • Screw you, deadeye, I was about to post an example I had whipped up. Yours uses one less event.

    Ah, well. Here it is anyways if anbody is interested: Grid Scrolling Example

  • Hehe well, that works too

  • I only need this because it's an open world game and Construct lags HORRIFICALLY when I try and do anything in the layout, so I need different layouts for different towns/locations so it isn't laggy and I can actually complete it.(Construct lags, not the game, the game runs fine)

  • How big is it?

    And if your not doing so already, why don't you make the buildings smaller and when you go inside you would go too a new layout and you would be in the proper building?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I only need this because it's an open world game and Construct lags HORRIFICALLY when I try and do anything in the layout, so I need different layouts for different towns/locations so it isn't laggy and I can actually complete it.(Construct lags, not the game, the game runs fine)

    Do you mean the IDE lags while you're working with layouts/events?

  • Yes it lags horribly. I want it to just go to another LAYOUT in the right place(like MM except each scroll is a layout )

  • Might we see your .cap file to ascertain the source of this lag? And your system specs for that matter?

  • For the lagging, that's not normal. Does your system meet the requirements? Do you have a lot of other stuff running at once?

    As for the megaman style scrolling, you don't need to have separate layouts at all. You can build a scrolling system that does all the scrolling in one layout.

    Make a separate object called "camera" or something like that. When your player is moving normally, have the system center to the player's x,y position, and have the camera set itself to the center of the screen. When they're in certain areas (at the edge of the place where you want to scroll) then stop the system from centering on the player. Then when they leave the screen, freeze the movement and have the camera move one screen forward (or down, whatever) and have the system center on the camera instead. When the camera stops, resume the player's movement.

  • My system is fine, runs Construct well except on a 100,000 x 100,000 field with a grass texture covering the entire thing I think it's normal.

    Now, can anyone just tell me how to do what I asked? I don't want it to be on the same layout.

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