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 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
|
[prototype]
friction="1000"
has_feet="no"
hitpoints="2"
id="fish_purple"
mass="6"
on_change_animation_failure="die()"
on_collide="[set(velocity_x, 0), facing(-facing)]"
on_collide_object_body="if(collide_with.vars.team != vars.team and collide_with_area = 'attack', get_hit_by(collide_with))"
on_die="[score(level,20), spawn_item(me), spawn('die_cloud', midpoint_x, midpoint_y, facing)]"
on_end_anim="[set(tmp.already_hit, [])]"
on_end_hurt_anim="set(animation, 'swim')"
on_end_swim_anim="if(facing < 0 and x < vars.x_bound or
facing > 0 and x2 > vars.x2_bound,
[facing(-facing), animation('swim')],
animation('swim'))"
on_exit_water="die()"
on_hit_by_player="die()"
on_hurtflicker="if(green = 100,[set(green, 255), set(blue, 255)],[set(green, 100), set(blue, 100)])"
on_leave_hurt_anim="[set(green, 255), set(blue, 255)]"
on_process_swim="if(abs(y - target_y()) > 10, set(accel_y, (20*if(target_y() < y, -1, 1))), [set(accel_y,0)])"
on_timer="if(solid(level, front + facing*90, y, 1, y2 - y),
[facing(-facing)])"
solid_area="3,3,27,19"
timer_frequency="10"
traction_in_air="0"
traction_in_water="1000"
[properties]
get_hit_by="def(collide_with) execute(me,
if(not (me in collide_with.tmp.already_hit), [
set(collide_with.tmp, 'already_hit', collide_with.tmp.already_hit + [me]),
if((not is_invincible_posthit) and (collide_with.vars.damage > 0),
if(collide_with.vars.damage > consts.armor,
[
if(me.hitpoints > collide_with.vars.damage,
[
if(collide_with.vars.damage <= consts.flinch_threshold,
schedule(4, [set(me.green, 255), set(me.blue, 255)]),
set(me.animation, 'hurt')),
set(me.green, 100), set(me.blue, 100)
]),
set(me.hitpoints, me.hitpoints - collide_with.vars.damage),
set(tmp.time_last_hit, me.cycle)
])),
if(collide_with.vars.damage > consts.flinch_threshold and me.hurt_velocity_y and (not collide_with.tmp.no_flinch_attack), set(me.velocity_y,(me.hurt_velocity_y))),
if(collide_with.vars.damage > consts.flinch_threshold and me.hurt_velocity_x and (not collide_with.tmp.no_flinch_attack), set(me.velocity_x, ((me.hurt_velocity_x * collide_with.facing + collide_with.velocity_x/2)*collide_with.mass*if(collide_with.attack_force, collide_with.attack_force, 100))/(me.mass*100)))]))"
hurt_velocity_x="400"
hurt_velocity_y="-800"
is_invincible_posthit="if(tmp.time_last_hit and (abs(tmp.time_last_hit - me.cycle) < consts.posthit_invicibility_period), 1, 0)"
[/properties]
[tmp]
time_last_hit="0"
[/tmp]
[animation]
accel_x="20"
attack_area="all"
body_area="all"
duplicates="6"
duration="6"
frame_info="3,4,11,3,446,302,27,22,4,3,11,3,473,302,26,23,7,2,10,4,499,302,24,23,4,3,11,3,523,302,26,23"
frames="4"
id="swim"
image="compiled-2.png"
rect="443,298,483,326"
[/animation]
[animation]
accel_x="20"
attack_area="all"
body_area="all"
duration="6"
frame_info="3,4,11,3,0,325,27,22,4,3,11,3,27,325,26,23,7,2,10,4,53,325,24,23,4,3,11,3,77,325,26,23"
frames="4"
id="swim"
image="compiled-2.png"
rect="-3,321,37,349"
[/animation]
[animation]
attack_area="all"
body_area="all"
duration="10"
frame_info="7,3,11,3,197,302,23,23"
frames="1"
id="startle"
image="compiled-2.png"
rect="190,299,230,327"
[/animation]
[animation]
attack_area="all"
body_area="all"
duration="10"
frame_info="6,2,9,2,720,252,26,25"
frames="1"
id="hurt"
image="compiled-2.png"
rect="714,250,754,278"
[/animation]
[animation]
accel_x="30"
attack_area="all"
body_area="all"
duration="6"
frame_info="41,29,0,0,1023,585,0,0,41,29,0,0,1023,585,0,0,41,29,0,0,1023,585,0,0,41,29,0,0,1023,585,0,0"
frames="4"
id="swimMad"
image="compiled-0.png"
rect="982,556,1022,584"
[/animation]
[vars]
damage="1"
points_value="5"
team="'evil'"
[/vars]
[properties]
ideal_x="def() ((vars.x2_bound + vars.x_bound) / 2)"
inside_aggro_range="def(distance) if(abs(ideal_x() - midpoint_x) < distance, 1, 0)"
player_within="def(distance) if((level.player.midpoint_x > midpoint_x - distance) and (level.player.midpoint_x < midpoint_x + distance) and (level.player.midpoint_y > midpoint_y - distance) and (level.player.midpoint_y < midpoint_y + distance), 1, 0)"
target_y="def() (vars.desired_height + (wave(cycle*10+1000)/15))"
[/properties]
[/prototype]
|