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
|
[prototype]
collide_dimensions="~key"
friction="1000"
id="key_red"
mass="5"
on_collide="set(velocity_x, -(velocity_x*70)/100)"
on_collide_feet="[set(velocity_x, (velocity_x*50)/100), if(abs(velocity_x) < 50, set(velocity_x, 0)), set(velocity_y, if(abs(velocity_y) > 50, -velocity_y/2, 0))]"
on_collide_head="set(velocity_y, -velocity_y)"
on_collide_object_body="if(collide_with_area = 'attack', get_hit_by(collide_with))"
on_enter_water="[
add_wave(midpoint_x, y2, -2000, 5*velocity_y/2, 30*velocity_y, 300, 300),
add_wave(midpoint_x, y2, 2000, 5*velocity_y/2, 30*velocity_y, 300, 300),
add_wave(midpoint_x, y2, -1000, 3*velocity_y/2, 20*velocity_y, 200, 200),
add_wave(midpoint_x, y2, 1000, 3*velocity_y/2, 20*velocity_y, 200, 200),
add_wave(midpoint_x, y2, -500, 2*velocity_y/2, 10*velocity_y, 100, 100),
add_wave(midpoint_x, y2, 500, 2*velocity_y/2, 10*velocity_y, 100, 100)
]"
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)]"
solid_area="0,0,15,15"
solid_dimensions="thrown"
tags="swallowable"
zorder="-1"
[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]
[vars]
damage="1"
[/vars]
[properties]
get_hit_by="def(collide_with) null()"
[/properties]
[animation]
accel_y="80"
body_area="all"
frame_info="0,0,0,0,612,400,16,16"
id="normal"
image="compiled-0.png"
rect="612,400,627,415"
[/animation]
[animation]
accel_y="80"
body_area="all"
frame_info="0,0,0,0,612,400,16,16"
id="thrown"
image="compiled-0.png"
rect="612,400,627,415"
[/animation]
[/prototype]
|