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
|
[object_type]
id=anthill
[vars]
generation_counter=0
generation_time=20
max_objects=3
spawned_objects="[]"
zone_x1=0
zone_x2=0
[/vars]
[editor_info]
category=bugs
[var]
name=zone_x1
type=x
value="x - 300"
[/var]
[var]
name=zone_x2
type=x
value="x + 400"
[/var]
[var]
name=max_objects
value=3
[/var]
[var]
name=generation_time
value=20
[/var]
[/editor_info]
[tmp]
spawning="null()"
[/tmp]
on_end_normal_anim="[
set(vars.spawned_objects, filter(vars.spawned_objects, 'ant', ant.hitpoints > 0 and ant.x > context.vars.zone_x1 and ant.x2 < context.vars.zone_x2)),
animation('normal'),
if(size(vars.spawned_objects) < vars.max_objects,
set(vars.generation_counter, vars.generation_counter+1),
set(vars.generation_counter, 0)),
if(vars.generation_counter >= 5 and tmp.spawning,
[set(attached_objects, []), set(tmp.spawning, null()),
set(tmp.spawning.velocity_y, -400),
set(vars.spawned_objects, vars.spawned_objects + [tmp.spawning]),
add_object(tmp.spawning)]),
if(vars.generation_counter >= vars.generation_time,
[spawn('ant_red', midpoint_x, midpoint_y, facing),
set(vars.generation_counter, 0)])
]"
on_child_spawned="[
remove_object(child),
set(attached_objects, [child]),
set(tmp.spawning, child)
]"
[base:animation]
image=enemies/ant-flying-red.png
[/animation]
[animation]
id=normal
rect=126,165,164,197
frames=1
duration=10
[/animation]
[/object_type]
|