Skip to content

Instantly share code, notes, and snippets.

@msg555
Created July 28, 2017 22:59
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save msg555/24c7a2dcb7f09c70e3be2abd80d33a07 to your computer and use it in GitHub Desktop.
Create a prop and move it 1 unit per frame.
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