samples/05_mouse/02_mouse_move/app/main.rb
def render_player
    state.player_sprite = [state.player.x,
                           state.player.y,
                          4 * 3,
                          8 * 3, "sprites/player-#{animation_index(state.player.created_at_elapsed)}.png"] # string interpolation
    outputs.sprites << state.player_sprite

    # Outputs a small red square that previews the angles that the player can attack in.
    # It can be moved in a perfect circle around the player to show possible movements.
    # Change the 60 in the parenthesis and see what happens to the movement of the red square.
    outputs.solids <<  [state.player.x + state.player.attack_angle.vector_x(60),
                        state.player.y + state.player.attack_angle.vector_y(60),
                        3, 3, 255, 0, 0]
  end
# Outputs the player sprite using the images in the sprites folder.
Outputs the player sprite using the images in the sprites folder.
Outputs the player sprite using the images in the sprites folder .
def render_player
    state.player_sprite = [state.player.x,
                           state.player.y,
                          4 * 3,
                          8 * 3, "sprites/player-#{animation_index(state.player.created_at_elapsed)}.png"] 
    outputs.sprites << state.player_sprite
    outputs.solids <<  [state.player.x + state.player.attack_angle.vector_x(60),
                        state.player.y + state.player.attack_angle.vector_y(60),
                        3, 3, 255, 0, 0]
  end
def render_player state . player_sprite = [ state . player . x , state . player . y , 4 * 3 , 8 * 3 , "sprites/player-#{animation_index(state.player.created_at_elapsed)}.png" ] outputs . sprites << state . player_sprite outputs . solids << [ state . player . x + state . player . attack_angle . vector_x ( 60 ) , state . player . y + state . player . attack_angle . vector_y ( 60 ) , 3 , 3 , 255 , 0 , 0 ] end
Outputs the player sprite using the images in the sprites folder.
Outputs the player sprite using the images in the sprites folder .
# string interpolation # Outputs a small red square that previews the angles that the player can attack in. # It can be moved in a perfect circle around the player to show possible movements. # Change the 60 in the parenthesis and see what happens to the movement of the red square.