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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
|
# Dialog controllers are generic objects designed to be used as triggers 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: "dialog_controller",
next_animation: "'normal'",
always_active: true,
hidden_in_game: true,
use_absolute_screen_coordinates: true,
vars: {
last_triggered: -400,
player_dialog_shown: false,
player_dialog_lockout: 0,
player_dialog: {
type: "dialog",
cursor: [15, 15],
rect: [0,0,300,400],
background_frame: "empty_window",
children: [
{
xy: [15, 15],
type: "label",
text: "Health",
size: 10,
on_process: "set(vars.pdo.children[0].text, 'Health: ${level.player.hitpoints}')",
tooltip: "Frogatto's current health",
},
{
xy: [15, 30],
type: "label",
text: "Coins",
size: 10,
on_process: "set(vars.pdo.children[1].text, 'Coins: ${level.player.coins}')",
tooltip: "Frogatto's current wealth",
},
{
xy: [15, 45],
type: "label",
text: "Mana: ",
size: 10,
on_process: "set(vars.pdo.children[2].text, 'Mana: ${level.player.vars.mana}')",
tooltip: "Frogatto's current mana",
},
{
type: "animation_widget",
rect:[86,252,128,128],
animation:[
{image: "characters/frogatto-spritesheet1.png",pad:3,id:"stand",duplicates:6,rect:[2,2,33,34],frames:3,duration:6,reverse: true},
],
},
],
},
},
on_load: "set(vars.pdo, dialog(self, vars.player_dialog))",
on_process: "[if(vars.player_dialog_lockout > 0, add(vars.player_dialog_lockout, -1)),
if('c' in level.player.ctrl_keys and vars.player_dialog_lockout = 0, if(vars.player_dialog_shown, [set(vars.player_dialog_lockout, 10), set(vars.player_dialog_shown, false), clear_widgets(me)],[set(vars.player_dialog_lockout, 10), set(vars.player_dialog_shown, true), set_widgets(vars.pdo)]))]",
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: 1000,
},
}
|