Lachlan's misadventures in games programming

Saturday, 8 October 2011

Platform Progress - Saving and loading levels

10/08/2011 05:45:00 pm Posted by Lachlan No comments
Wow... 3 posts in one day!? But - achievements get posts.

I can now save and load levels! So:
 gameexec
FatController bind_wing_keys K_LEFT "Actor inst 100" K_RIGHT "Actor inst 101" "Actor inst 102"
FatController bind_key_down K_SPACE "Actor inst 103"
FatController bind_key_up K_SPACE "Actor inst 104"
FatController bind_key_down K_ESCAPE "Game quit_signal"
FatController bind_key_down K_BACKQUOTE "Game toggle_console"
FatController bind_key_down K_e "Game toggle_editor"

run "level" "levels"

Game gravity_ddy = 400;
Game gravity_max_dy = 500;
Game gravity_ddx = 0;
Game gravity_max_dx = 0;

and

 level


Game new_feature "f_1" 
x1 = -20
x2 = 600
y1 = 500
y2 = 550
z = 0
collision_function = 1
visible = 1
.

Game new_feature "f_2" "f_1"
x1 = 150
x2 = 200
y1 = 450
y2 = 500
z = 0
collision_function = 1
visible = 1
.

Game new_feature "f_3" "f_1"
x1 = 700
x2 = 1500
y1 = 500
y2 = 550
z = 0
collision_function = 1
visible = 1
.

Game new_feature "f_4" "f_1"
x1 = 900
x2 = 950
y1 = 400
y2 = 500
z = 0
collision_function = 1
visible = 1
.

Game new_feature "f_5" "f_1"
x1 = 500
x2 = 800
y1 = 350
y2 = 400
z = 0
collision_function = 1
visible = 1
.

lead to an end result of:

Note - as well, this script is the actual save file, and was saved from within the game! Boo yeah!

0 comments:

Post a Comment