4
functions="#looks for the player and turns to face it#
5
def set_facing(obj,level) if(desired_facing != obj.facing, [animation('turn'),set(obj.facing, desired_facing)], animation('walk')
6
) where desired_facing = if(level.player.x < obj.x, -1, 1);
9
#if the player is in an opportune spot, attack it#
10
def consider_attacking(obj,level) if((desired_facing = obj.facing) and (abs(level.player.x - obj.x) < 150) and (abs(level.player.y - obj.y) < 50), animation('prepare_jump'), animation('walk')
11
) where desired_facing = if(level.player.x < obj.x, -1, 1);
16
on_create="set(level.gui.vars.bosses, level.gui.vars.bosses + [me])"
17
on_bounced_on="if(is_invincible_posthit,null(),[add(hitpoints, -2),set(tmp.time_last_hit, cycle), set(me.green, 0), set(me.blue, 0), schedule(4, [set(me.green, 255), set(me.blue, 255)]), if(jumped_on_by.mass >= 1000, die(), animation('spring'))])"
19
if(collide_with = level.player,
20
#make it so if we collide with the player we immediately jump/attack.
21
this ensures the kitty can't simply get stuck between the player and a wall#
24
if(animation = 'lunge_attack' and (not collide_with),
25
[animation('lunge_stuck'), add(x,-50*facing),set(velocity_x,0), set(tmp.stuck_count, 0)]),
26
if(not (animation in ['jump_attack', 'lunge_attack', 'lunge_stuck', 'lunge_unstuck']), [set(facing, -facing), animation('turn'), set(velocity_x, 0)])
28
on_die="[score(level,points_value), spawn_item(self), spawn('die_cloud', midpoint_x, midpoint_y, facing)]"
29
on_end_hurt_anim="animation('stand')"
30
on_end_jump_attack_anim="[animation('walk'), set(tmp.can_attack_at, cycle+50)]"
31
on_end_lunge_anim="animation('walk')"
32
on_end_lunge_attack_anim="[animation('walk')]"
33
on_end_prepare_lunge_anim="if(cycle - vars.began_charging > consts.charge_duration,animation('lunge'),animation('prepare_lunge'))"
34
on_end_prepare_jump_anim="if(cycle - vars.began_charging > consts.charge_duration,fire_event('initiate_jump'),animation('prepare_jump'))"
37
on_end_lunge_stuck_anim="if(tmp.stuck_count > 4, animation('lunge_unstuck'), [animation('lunge_stuck'), set(tmp.stuck_count, tmp.stuck_count+1)])"
38
on_end_lunge_unstuck_anim="animation('stand')"
39
on_end_spring_anim="animation('stand')"
40
on_end_stand_anim="if(is_standing, animation('walk'), animation('stand'))"
41
on_end_turn_anim="animation('walk')"
42
on_end_walk_anim="if((not facing_player),
43
if(abs(level.player.midpoint_x - midpoint_x) < 800, set(facing, -facing)),
45
if(cycle > tmp.can_attack_at and abs(level.player.midpoint_x - midpoint_x) < (300 + 1d200),
47
if((1d4 = 1) or (abs(level.player.y - y) > 50),
48
[animation('prepare_jump'),set(vars.began_charging,cycle)],
49
[animation('prepare_lunge'),set(vars.began_charging,cycle)]
52
if(distance_to_cliff < 80, [set(facing, -facing), animation('turn')], animation('walk'))))"
55
on_initiate_jump="[animation('jump'), if(level.player.x > midpoint_x,facing(1),facing(-1)),set(velocity_x, (level.player.midpoint_x - midpoint_x)*4), if(level.player.y > y2 and is_standing_on_platform, [set(fall_through_platforms, 20), set(velocity_y, 0)], if(midpoint_y - level.player.midpoint_y > 200, [set(velocity_y, -2200)]))]"
57
on_enter_anim="set(tmp.already_hit, [])"
58
on_enter_water="die()"
59
on_process_jump="if(abs(level.player.midpoint_x - midpoint_x) < 80 and level.player.y2 > y,
60
[animation('jump_attack')],
61
if(is_standing, animation('stand')))"
62
on_process_lunge="if(abs(level.player.midpoint_x - midpoint_x) < 200,
63
animation('lunge_attack'))"
67
on_timer=" if(is_invincible_posthit, set(alpha,(wave(cycle*300)+1000)/10 + 100), set(alpha,255))"
70
solid_area="13,9,33,34"
71
solid_dimensions="common"
79
facing_player="if(level.player.x < x, facing < 0, facing > 0)"
89
turns_towards_player="1"
95
posthit_invicibility_period=150
107
image="enemies/kitty-sword.png"
139
#blink variation of walking
161
events="6:12:18:hurtflicker"
179
rect="133,79,173,114"
185
attack_area="12,0,40,34"
199
solid_area="10,10,30,35"
210
solid_area="13,29,33,54"
219
rect="207,242,247,290"
226
attack_area="12,0,40,34"
238
solid_area="10,10,30,35"
239
rect="181,157,235,192"