Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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