Game Development Reference
In-Depth Information
So we are going to use tables. Go into the Tables section and create a new table
by clicking on the + button, name it Saved Data . Change it to two rows and one
column. Change the first row header to an Integer , and rename the first cell Score
and the second one Level .
Leave all the values at 0 for now, we will write the tables during gameplay. Now let's
go back to our first level and, at the very end, create a goal for Kevin to reach. This
can be an actor off the edge of the screen, or it can be a castle, like in Super Mario.
Once you have your goal placed and you've turned off the Movable option in the
Physics drop down so it's not bouncing around or falling through the floor, we
are going to edit this actor a bit. First off, let's create a new rule, change it to Actor
receives event | overlaps or collides | with actor of type | Kevin . First, we are
going to save the score. We are then going to add a Change Table Value behavior,
change the Table value to game.Saved Data , Row: 1 , Column: 1 , and Value: game.
Score . Now this will write the current score at the end of each level. Finally, we need
to drag in a Save Table behavior, and select our Saved Data table so we can finalize
the writing on the table.
Alternatively, you can do this within the Score actor and have it write and save the
table every second, or faster.
Now all we have to do is go back to our main menu, double-click on our Continue
button, add in a Touch rule and add in a Change Attribute, and change it to Change
Attribute: game.Score | to: | tableCellValue(game.Saved Data, 1, 1) .
 
Search WWH ::




Custom Search