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
|
[prototype]
collide_dimensions="~key"
friction="1000"
id="key_silver"
mass="5"
on_add_object_fail="[if(collide_with.team != team and collide_with.get_hit_by, collide_with.get_hit_by(me)), die()]"
on_change_animation_failure="fire_event('solidity_fail')"
on_change_solid_dimensions_fail="fire_event('solidity_fail')"
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 in ['attack'], get_hit_by(collide_with))"
on_collide_side="set(velocity_x, -(velocity_x*70)/100)"
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_solidity_fail="if(tmp.in_solidity_fail, die(),
[set(tmp.in_solidity_fail, 1),
resolve_solid(me,0,-1,60),
resolve_solid(me,2,-1,250),
resolve_solid(me,-2,-1,250),
resolve_solid(me,0,-1,500),
set(tmp.in_solidity_fail, 0)
])"
solid_area="0,0,15,15"
solid_dimensions="thrown"
tags="swallowable"
zorder="-1"
[consts]
flinch_threshold="3"
[/consts]
[properties]
attack_damage="0"
attack_knockback="0"
cause_flinch="def(collide_with) execute(me, [add(me.velocity_x,me.hurt_velocity_x * sign(collide_with.midpoint_x - me.midpoint_x)),
add(me.velocity_y,me.hurt_velocity_y)])"
damage_cooldown="0"
display_hurt_visuals="def() execute(me,
[if('hurt' in available_animations,set(me.animation, 'hurt')),
hurt_flash_sequence()
])"
display_posthit_invincibility_flash_sequence="def() if(consts.posthit_invicibility_period,
map(range(consts.posthit_invicibility_period/2), 'step' ,schedule(step*2, if(step%2=0,set(alpha,50),set(alpha,255)) ) ) )"
flash_bright="def() [set(me.brightness, 1023)]"
flash_off="def() [set(me.brightness, 255),set(me.red, 255),set(me.green, 255), set(me.blue, 255)]"
flash_red="def() [set(me.red, 255),set(me.green, 100), set(me.blue, 100)]"
get_hit_by="def(collide_with) execute(me, [
if((not is_invincible) and (collide_with.attack_damage > 0) and (collide_with.attack_damage > consts.armor) and (collide_with.damage_cooldown < (cycle - vars.time_last_hit)),
[display_hurt_visuals(),
display_posthit_invincibility_flash_sequence(),
handle_flinch(collide_with),
handle_damage(collide_with),
set(vars.time_last_hit, me.cycle)]),
handle_damage_type(collide_with),
handle_knockback(collide_with)])"
handle_damage="def(collide_with) execute(me,add(me.hitpoints, - collide_with.attack_damage))"
handle_damage_type="def(collide_with) null() #virtual#"
handle_flinch="def(collide_with)
execute(me, if(collide_with.attack_damage > consts.flinch_threshold, cause_flinch(collide_with)))"
handle_knockback="def(collide_with) execute(me,add(velocity_x, collide_with.facing * collide_with.attack_knockback))"
hurt_flash_sequence="def() [ flash_bright(),
schedule(3, flash_red()),
schedule(6, flash_bright()),
schedule(9, flash_red()),
schedule(12, flash_bright()),
schedule(15, flash_off())]"
hurt_velocity_x="-200"
hurt_velocity_y="-400"
is_invincible="if(invincible or level.in_dialog or is_invincible_posthit, 1, 0)"
is_invincible_posthit="if(vars.time_last_hit and (abs(vars.time_last_hit - me.cycle) < consts.posthit_invicibility_period), 1, 0)"
[/properties]
[editor_info]
category="keys_&_triggers"
[/editor_info]
[properties]
get_hit_by="def(collide_with) null()"
[/properties]
[animation]
accel_y="80"
body_area="all"
frame_info="0,0,0,0,704,523,16,16"
id="normal"
image="compiled-0.png"
rect="704,523,719,538"
[/animation]
[animation]
accel_y="80"
body_area="all"
frame_info="0,0,0,0,704,523,16,16"
id="thrown"
image="compiled-0.png"
rect="704,523,719,538"
[/animation]
[/prototype]
|