Hello again!.
I am designing a game whose layout emulates the buttons of a game machine.
That’s the reason because I need to copy all the buttons of the main scene in all the other scenes that are indeed the “preinstalled” games of my multigame.
I’ve been thinking about making all the elements of the UI global and use external events to copy the logic of the controls.
My question is this:
Would you please tell me if there is a faster or more efficient way to copy these UI elements?.
Thank you very much in advance.
Kind Regards,
Eva
Have you looked into external layouts? If you use global objects in the external layout, then this will do what you’re after. The result is the objects positioned the same way every scene it’s loaded into.
@Spite@MrMen I think you both missed the point
Thevirtualmadness made mistake calling them events while i guess it should be layout
And then from what i understand we have FOR EXAMPLE 100 scenes here
And goal is not to add something to each of them 1 by 1
But like automatically deploy it on all of them
Cause with many scenes where majority of them will be game scenes and need whatever same objects
It will be easier to add to all them same thing and then on few of them either delete or hide it
I’m sorry if I didn`t explain myself properly.
Please, let me try once again.
I meant that if I could use external events to be linked to the scenes in order not to have to copy all the logic (movement, shoot, etc) of the characters in every single scene that I need to create. As you effectively point in your post I would need something automatic that works for all the scenes.
Thank you very much for your answer!.
That is what Spite and MrMen suggested to you
You can use external events for that
But you will still need to add it in each scene manually
Like instead of copy pasting whole logic you will need to add event to include stuff from external events into THIS scene
From your description it looks to me like you was asking how to do it automatically
So its part of each scene by default
And on top of that you speak in your 1st message about layout of buttons
Did you mean like layout of touch controls on screen?
Cause in this case you are talking about both external layouts for object and events for logic
And in both cases you will need add to each scene event to include them
So each scene should uses the same UI layout, with the same logic for every single UI element? What is differents about the individual scenes? What do the buttons control? What do they interact with?
As MrMen stated an ExternalLayout is most likely the best solution for the placement of the elements, while the logic could be embedded in either ExternalEvents, as ZeroX4 pointed out, or inside CustomObjects, as I would do. Going for the previous (ExternalEvents) requires the inclusion of thoes in each scene and it can only use whatever you code in an external event sheet, while the latter (CustomObject) would contain all logic automatically, and can be fed with further parameters and objects via behaviors.
Thank you very much all three for your answers and your help.
The idea of my game is, as I mentioned in my first post, a machine where you can play different games so I need a main scene that contains the buttons that are used to control the characters movement, etc and the game area in the center that works like a canvas that it’s indeed the screen of the game.
The other scenes would contain the games but in this case the main scene would be “over” the game scene as if they were two layers overlapped so the only parts that change are the elements inside the canvas.
That’s the reason I thought about using external layouts and external events.
THEN
Solution for you would be other way around
For now you been told to use external events / layout to load buttons and their logic
Well go vice versa
Make scene with your buttons and their logic main scene
And now make all your game scenes external layouts
Which you load into main scene
It would mean creating an external layout and external events for each level, which is what scenes are except scenes have those two bundled together. If there are lots of levels then it could become an unnecessarily large project in terms of events & layouts.
In that case what i suggest in my eyes makes most sense
Cause multiple games will share same logic so making them their own scenes would be wrong
They should be external layout and have logic loaded from external events
When it comes to games that have more or less same kind of gameplay elements
Thank you very much again for your help! @ZeroX4@MrMen@Spite
In fact the two options that you are suggesting could be valid for my project because the games that I’m going to create for the machine (not exactly a NES, they are more like single game cartridges) aren’t going to be very complex. I want them to be funny but not overloaded. That’s what I asked if there was a way to make this process (external events and layout) more automated.
The only “conflictive” point I see is how can I switch among the games if they have to be loaded in the “At the beginning of the scene” condition, because I would need to load each external layout depending on the cartridge selected; I would need a variable that controls the game (layout) to load. I’ve tried with a global variable that contains the name of the external layout but it doesn’t work properly yet.
NES was example of what you possibly mean
A lot of your logic will be the same
I see no reason to make it into individual scenes
Something like player movement with WASD don’t need to be in every scene but can be loaded from external layout
And so 2 things
You don’t need to load everything at beginning of the scene but you can at any given moment
You could delete everything from scene and then load external stuff on demand when you need it
But also you could simply set some variable to something reset scene
And based on that variable load different external stuff