samples/05_mouse/02_mouse_move/app/main.rb
# Outputs sprites of killed zombies, and displays a slash image to show that a zombie has been killed.
Outputs sprites of killed zombies, and displays a slash image to show that a zombie has been killed.
Outputs sprites of killed zombies and displays a slash image to show that a zombie has been killed .
def render_killed_zombies
    outputs.sprites << state.killed_zombies.map do |z| 
      z.sprite = [z.x,
                  z.y,
                  4 * 3,
                  8 * 3,
                  animation_sprite(z, z.death_at), 
                  0, 
                  255 * z.death_at.ease(30, :flip)].sprite 
      [z.sprite, [z.sprite.rect, 'sprites/slash.png', 45 + state.player.attack_angle_on_click, z.sprite.a].scale_rect(3, 0.5, 0.5)]
    end
  end
def render_killed_zombies outputs . sprites << state . killed_zombies . map do | z | z . sprite = [ z . x , z . y , 4 * 3 , 8 * 3 , animation_sprite ( z , z . death_at ) , 0 , 255 * z . death_at . ease ( 30 , :flip ) ] . sprite [ z . sprite , [ z . sprite . rect , 'sprites/slash.png' , 45 + state . player . attack_angle_on_click , z . sprite . a ] . scale_rect ( 3 , 0.5 , 0.5 ) ] end end
Outputs sprites of killed zombies, and displays a slash image to show that a zombie has been killed.
Outputs sprites of killed zombies and displays a slash image to show that a zombie has been killed .
# performs action on all killed zombies in collection # calls animation_sprite method # angle # transparency of a zombie changes when they die # change the value of 30 and see what happens when a zombie is killed # Sets values to output the slash over the zombie's sprite when a zombie is killed. # The slash is tilted 45 degrees from the angle of the player's attack. # Change the 3 inside scale_rect to 30 and the slash will be HUGE! Scale_rect positions # the slash over the killed zombie's sprite.