Differences

This shows you the differences between the selected revision and the current
version of the page.


kbase:meaecode 2009/02/25 18:30 kbase:meaecode 2010/08/06 21:11 current
Line 71: Line 71:
Ok... enough background.... Ok... enough background....
 +
====Passing a global variable between scenes==== ====Passing a global variable between scenes====
-So lest do this.... The way it will work is that we will define a variable, witch is passed from one scene to the other. witch can then be tested in the hallway scene, thus enabling the hallway to identify witch scene the variable came from. And this is how you do it.+So let's do this.... The way it will work is that we will define a variable, which is passed from one scene to the other. Which can then be tested in the hallway scene, thus enabling the hallway to identify which scene the variable came from. And this is how you do it.
1) Change the transition code in the kitchen entity script from the default (written above) to this new code. 1) Change the transition code in the kitchen entity script from the default (written above) to this new code.
Line 111: Line 112:
==Pause and understand what has happened== ==Pause and understand what has happened==
-The scene initialisation script is loading the scene as it dose so it loads the global variable, it then uses a TEST, with the IF loop. It breaks down like this.+The scene initialization script is loading the scene as it dose so it loads the global variable, it then uses a TEST, with the IF loop. It breaks down like this.
1) First it dose a test to see if the previous scene was the kitchen scene 1) First it dose a test to see if the previous scene was the kitchen scene
2) It then dose a test to see if the global variable it has loaded is the correct one. (the variable was set as you left the kitchen zone) 2) It then dose a test to see if the global variable it has loaded is the correct one. (the variable was set as you left the kitchen zone)
-3) If those tests are true.. then it will execute the actor placement code. Witch is+3) If those tests are true.. then it will execute the actor placement code. Which is
<code script>actor.SkipTo(400, 400); <code script>actor.SkipTo(400, 400);
        actor.Direction = DI_DOWN;</code>         actor.Direction = DI_DOWN;</code>
 
kbase/meaecode.1235583034.txt.gz · Last modified: 2009/02/25 18:30 by Mnemonic
Recent changes RSS feed Creative Commons License Driven by DokuWiki