I want to have different scenes for each room. In my example the "Go to Room" buttons works great.
The "Switch RM1" button is supped to take you back to Room 1 which is does, but it is also is supped to change the sprite to the "Room 1 Scene 2" sprite.
Do I need an Every Tick command here? That command is always confusing to me.
Develop games in your browser. Powerful, performant & highly capable.
Your capx fixed
You needed animation frame, global variable and a correct inclusion of sheets.
Every tick is a condition that will executes the actions setted and test the subevents each frame of the game.
What you needed was "On start of layout" to test only once and display the correct frame on beginning of the layout.
I took the liberty to implement it on Room2 as you may have seen <img src="smileys/smiley2.gif" border="0" align="middle">
Many thinks Kyatric I never thought to use the animation for anything besides, well animating. LOL
Great outside the box use for that.
Have a great day!
The Scene switch is working great, but when I hit the switch scene button in Room 2 it will not Enable my Swtich Scene Back Button in Room 1.
Any guidance apprenticed
A few notes, when going from one layout to another, consider the objects that are not global to be destroyed, and the objects in the "new" layout to be created again.
As you made your "SwitchSceneBackButton" of layout1 with the property enabled = no by default, then each time you "launch" this layout, the button will be deactivated.
You need another check on a global variable to make sure what "state" it should be in (enabled/disabled).
Also, try to keep the code for objects from a layout in the corresponding eventsheet (just to keep track of what is where).
For now it is not a big deal since you have less than 10 objects and only 2 layouts, but imagine what it will be like when having 1000 objects and 200 layouts.
You'll just lose yourself in trying to figure out what is working with what/where.
Great incite and explanation Kyatric.
That said, my game is going to be an event driven adventure. Sort for like an interactive mystery that has the same buttons for actions in each room. I was goign to have a layout for each room but after your explanation maybe I should just have 1 layout with all my sprite-backgrounds in that layout and just switch. Your thoughts?