1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
# Generic controller designed to be used as a trigger for scripts.
# Various usages include modifying:
# - on_create to trigger something on the start of a level.
# - on_triggered to trigger something when the player reaches a certain spot
{
id: "controller",
next_animation: "'normal'",
always_active: true,
hidden_in_game: true,
vars: {
last_triggered: -400,
},
on_end_anim: "animation('normal')",
zorder: 50,
timer_frequency: 10,
on_timer: "if(level.player.midpoint_x > vars.x_bound and level.player.midpoint_x < vars.x2_bound and level.player.midpoint_y > vars.y_bound and level.player.midpoint_y < vars.y2_bound and cycle - vars.last_triggered > 250, [fire_event('triggered'),set(vars.last_triggered,cycle)])",
on_triggered: "[sound('MenuConfirm.ogg')]",
editor_info: {
category: "controllers",
var: [
{
name: "x_bound",
type: "x",
value: "x-100",
},
{
name: "x2_bound",
type: "x",
value: "x+150",
},
{
name: "y_bound",
type: "y",
value: "y-100",
},
{
name: "y2_bound",
type: "y",
value: "y+150",
},
],
},
animation: {
id: "normal",
image: "effects/particles.png",
x: 86,
y: 73,
w: 28,
h: 28,
collide: [0,0,28,28],
frames: 1,
duration: 100000,
},
}
|