Does GUI Follow Player From Layout To Layout?

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

    Im wondering if the GUI can follow my player from Layout to Layout or do i have to create the GUI for each layout? Im not sure how that works,I was pondering and started to ask myself if this was possible.I would like to transfer some things from room to room if i can.

                       -Second Question-

    One of the things that i really want to do is keep the settings for my sun and moon intrevals upon entering a new layout aswell,I think this goes along with what i need to know so i will ask this as a second question to those who end up seeing this post.Thanks guys

  • Any object that's set to Global in the properties pane will not be destroyed upon changing layouts. If you want a global HUD/UI, I suggest that you create it on its own layout, and when the game starts go main menu -> UI layout -> level layout.

    Make your sun and moon objects (and anything they're attached to) global as well.

    In both instances, just be sure to manage them properly when you go back to the main menu or any non-game layouts. They'll still be there; easiest way is to just set them as invisible. For interactive UI elements, be sure to set their interaction conditions to include "is visible" so they're not activated when they're hidden.

  • GeometriX

    Thanks for the reply man,By doing this it will stay in the same position as i have it in my main Layout?I do understand you im just making sure im taking it in the right way.This is the first time i heard about this.

  • Yup, it'll stay in the same position.

  • GeometriX Awesome stuff man,

    What about the layers? How does it place it? Is there a way for me to tell what layer its on,Or is it set to the same layer as the main Layout? Im not able to add this up.

  • Oh, yeah, forgot about that. It always goes to the bottom layer. It's an unfortunately lacking function in that it doesn't respect layers at all.

    I suggest that put all the elements in the same family (or in a few, if you're got a mix of sprites, tiled, and text objects), and, at the start of each game layout, move everything in those families to their own UI layer.

  • GeometriX That sucks it dosnt respect layers at all,This will be my first time appointing objects to layers through events Thanks for that.Also before i go i have one last question about this,What do i do about my player it seems that its loading him but its not Respecting the behaviour i placed.Its not scrolling.Do you have any tips on this.Thanks GeometriX

    PS.xiw@Ashley i think you should make the Global function respect Layers if its Possible.It would be a killer time saver and i mean a killer.

  • You mean the screen isn't scrolling to the player? Are you referring to the Scroll To behaviour?

    You'd have to share your capx. The only thing I could think of without taking a look at your code is that you might have more than one object with the Scroll To behaviour.

  • GeometriX I think you are right,I will send it in a PM ok.Thanks for looking at this.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sorry to bother you again GeometriX,

    Im having issues placing Global Objects on the layers in the next layout i have made.<img src="https://www.scirra.com/images/articles/screen3.jpg" border="0" />

    here is the event i was using,I am wondering if there is another way to pick the layer for the object i want to place there.Or is this the only way?

  • You shouldn't be creating the objects on each level - they should be there already since they were never destroyed in the first place. They simply carry through from the layout on which they first appear until they're destroyed.

    You haven't said what the actual issue is though. What about that event doesn't work for you? But to answer your question, you can also specify layer names as strings. Just be sure to wrap double quotation marks around them like "this".

  • GeometriX the issue was i am creating it,I am really lost when it comes to this.Im just asking you if you can show me another way or the right way to do this.I apollogize if i was unclear.I just need your advice.The only way i know how to add the object to a layer thats on a different layout is the way i shown in my previous post.

  • But look at what I'm saying: global objects are not destroyed between layouts. So if you have Sprite01 on Layout 1 - created normally with the drag-and-drop interface, and then go to Layout 2 - which doesn't contain an instance of Sprite01, Sprite01 will be there anyway, because it's not destroyed.

    So do this: create a layout that only has your UI. Put those in the positions that you want. Assign them all to families. Set them all to Global. In that layout's event sheet, create an event On start of layout -> go to (Game Layout). Those UI elements will carry over. Then have an event in that event sheet On start of layout -> Move (Families) to Layer "UI"

  • GeometriX awesome stuff man,You explained that spot on.To tell you the truth i would of been ages trying to figure that out.Thats something a new guy wouldnt know unless he pulled out the shovel and dug.Thanks again Geo have a good day man and i promise that was the last question.

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