Wednesday, 28 March 2012

Behaviour for Changing Scene

After I created my scenes I needed to select a starter scene, as I have not made a start page yet I will selec scene 1 as the start scene. To switch the scene I had to create a new scene behaviour, I named this behaviour "Switch Scene". For this behaviour to work I had to code it correctly in the code section, firstly I used only the "Always" block for my behaviour, I then had to click on the flow section and create an "If" statement within the "Always" block. Secondly I clicked on the attributes tab and created three attributes; "Actor", "Scene" and "Region" and these are the attributes used within the behaviour. Next I had to use the scene - region tab to select which actor to use, if you look at the screen shot below you will see the "Actor is inside Region" statement after the "If". Thent he behaviour to actually switch scene needed to be used, this is also within the Scene button, the statement that I was using was "Fade out for _ secs, then switch to scene and fade in for _ secs. I set the timing as 0.3 seconds, a screenshot of the code below will probably help you understand.
Switch Scene Behaviour
Secondly this needed to be brought into a scene, when adding this to a scene I had to create a region that when the actor passes it switches scene. When this region is created you add the "Switch Scene" behaviour to the scene, and you will have to select the appropriate region, select the actor that passes the region and select the scene it switches too. I may mark the end of the levels with a level complete sign.

No comments:

Post a Comment