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
|
[object_type]
always_active="yes"
id="match_lock_controller"
next_animation="'normal'"
on_create="[set(alpha,0), #invisible when playing#
set(vars.locks, all_locks),
transform(range(size(all_locks)), [
set(all_locks[v].x, new_location[v][0]),
set(all_locks[v].y, new_location[v][1])
]) where new_location = shuffle(transform(all_locks, [v.x, v.y])),
] where all_locks =
filter(level.chars, 'char',
char.type in match_lock_types and char.vars.group = context.self.vars.group
) where match_lock_types = transform(range(17), 'match_lock_{v}')"
on_end_anim="animation('normal')"
on_match="if(matched,
if(not not_all, [
transform(now_lit, fire_event(v, 'win')),
set(vars.won, vars.won + [arg.type]),
set(vars.lit, []),
if(size(filter(vars.locks, 'lock', not lock.type in context.vars.won + [context.arg.type])) = 0,
if(linked, fire_event(linked, 'button_pressed'),
debug('ERROR: No linked object for {self.type} (group {vars.group}).')
) where linked = get_object(level, vars.linked_object))
],
set(vars.lit, now_lit),
) where not_all = find(filter(self.vars.locks, 'lock', not lock in now_lit), 'lock', lock.type = context.arg.type),
[ set(vars.lit, []),
transform(now_lit, fire_event(v, 'fail')),
])
where now_lit = vars.lit + [arg],
where matched = (size(vars.lit) = size(filter(vars.lit, 'item', item.type = arg.type)))"
zorder="100"
[editor_info]
category="keys_&_triggers"
help="One of these is required for every match_lock group.
Place a pair of match_locks, in the keys_&_triggers
folder, and when matched they will fire an event in the
object specified in this controller's linked_object.
Make sure the group variable matches! :)"
[var]
name="group"
type="int"
value="1"
[/var]
[var]
name="linked_object"
type="label"
[/var]
[/editor_info]
[vars]
lit="[]"
won="[]"
[/vars]
[animation]
collide="0,0,32,32"
duration="1000000000"
frame_info="0,0,0,0,775,101,32,32"
frames="1"
id="normal"
image="compiled-2.png"
rect="775,101,806,132"
[/animation]
[/object_type]
|