Improve Attack animations

Ported my own animations from Bay.

Also improved code for /atom/movable/do_attack_animation.
This commit is contained in:
Bjorn Neergaard
2015-11-28 21:18:36 -06:00
parent ea47934d07
commit f52cf6fd2a
+46 -37
View File
@@ -777,28 +777,17 @@ Sorry Giacom. Please don't be mad :(
var/final_pixel_y = initial(pixel_y)
if(end_pixel_y)
final_pixel_y = end_pixel_y
var/direction = get_dir(src, A)
switch(direction)
if(NORTH)
pixel_y_diff = 8
if(SOUTH)
pixel_y_diff = -8
if(EAST)
pixel_x_diff = 8
if(WEST)
pixel_x_diff = -8
if(NORTHEAST)
pixel_x_diff = 8
pixel_y_diff = 8
if(NORTHWEST)
pixel_x_diff = -8
pixel_y_diff = 8
if(SOUTHEAST)
pixel_x_diff = 8
pixel_y_diff = -8
if(SOUTHWEST)
pixel_x_diff = -8
pixel_y_diff = -8
if(direction & NORTH)
pixel_y_diff = 8
else if(direction & SOUTH)
pixel_y_diff = -8
if(direction & EAST)
pixel_x_diff = 8
else if(direction & WEST)
pixel_x_diff = -8
animate(src, pixel_x = pixel_x + pixel_x_diff, pixel_y = pixel_y + pixel_y_diff, time = 2)
animate(pixel_x = initial(pixel_x), pixel_y = final_pixel_y, time = 2)
@@ -807,24 +796,44 @@ Sorry Giacom. Please don't be mad :(
/mob/living/do_attack_animation(atom/A)
var/final_pixel_y = get_standard_pixel_y_offset(lying)
..(A, final_pixel_y)
floating = 0 // If we were without gravity, the bouncing animation got stopped, so we make sure to restart it in next life().
floating = 0 // If we were without gravity, the bouncing animation got stopped, so we make sure we restart the bouncing after the next movement.
//Show an image of the wielded weapon over the person who got dunked.
// What icon do we use for the attack?
var/image/I
if(hand)
if(l_hand)
I = image(l_hand.icon,A,l_hand.icon_state,A.layer+1)
else
if(r_hand)
I = image(r_hand.icon,A,r_hand.icon_state,A.layer+1)
if(I)
var/list/viewing = list()
for(var/mob/M in viewers(A))
if(M.client)
viewing |= M.client
flick_overlay(I,viewing,5)
I.pixel_z = 16 //lift it up...
animate(I, pixel_z = 0, alpha = 125, time = 3) //smash it down into them!
if(hand && l_hand) // Attacked with item in left hand.
I = image(l_hand.icon, A, l_hand.icon_state, A.layer + 1)
else if (!hand && r_hand) // Attacked with item in right hand.
I = image(r_hand.icon, A, r_hand.icon_state, A.layer + 1)
else // Attacked with a fist?
return
// Who can see the attack?
var/list/viewing = list()
for (var/mob/M in viewers(A))
if (M.client)
viewing |= M.client
flick_overlay(I, viewing, 5) // 5 ticks/half a second
// Scale the icon.
I.transform *= 0.75
// Set the direction of the icon animation.
var/direction = get_dir(src, A)
if(direction & NORTH)
I.pixel_y = -16
else if(direction & SOUTH)
I.pixel_y = 16
if(direction & EAST)
I.pixel_x = -16
else if(direction & WEST)
I.pixel_x = 16
if(!direction) // Attacked self?!
I.pixel_z = 16
// And animate the attack!
animate(I, alpha = 175, pixel_x = 0, pixel_y = 0, pixel_z = 0, time = 3)
/mob/living/proc/do_jitter_animation(jitteriness)
var/amplitude = min(4, (jitteriness/100) + 1)