Created
July 28, 2017 22:59
-
-
Save msg555/24c7a2dcb7f09c70e3be2abd80d33a07 to your computer and use it in GitHub Desktop.
Create a prop and move it 1 unit per frame.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class script { | |
/* We don't actually use the scene object in this script, but most will. */ | |
scene@ g; | |
prop@ p; | |
int frame; | |
int frame_cp; | |
script() { | |
@g = get_scene(); | |
@p = null; | |
frame = 0; | |
} | |
void step(int entities) { | |
if (@p == null) { | |
@p = create_prop(); | |
p.layer(15); | |
p.sub_layer(1); | |
p.prop_set(1); | |
p.prop_group(1); | |
p.prop_index(1); | |
p.palette(1); | |
g.add_prop(@p); | |
} | |
p.x(frame); | |
++frame; | |
} | |
void checkpoint_save() { | |
frame_cp = frame; | |
} | |
void checkpoint_load() { | |
frame = frame_cp; | |
if (@p != null) { | |
@p = prop_by_id(p.id()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment