examples/rmagick_integration.rb
# Magic numbers considered harmful! This is the height of the
# player as used for collision detection.
Magic numbers considered harmful. This is the height of the
player as used for collision detection.
Magic numbers considered harmful . This is the height of the player as used for collision detection .
def update
    @show_walk_anim = false
    @vy += 1
    if @vy > 1
      @vy.times do
        if @window.map.solid?(x, y + 1)
          @vy = 0
          break
        else
          @y += 1
        end
      end
    else
      (-@vy).times do
        if @window.map.solid?(x, y - HEIGHT - 1)
          @vy = 0
          break
        else
          @y -= 1
        end
      end
    end
    true
  end
def update @show_walk_anim = false @vy += 1 if @vy > 1 @vy . times do if @window . map . solid? ( x , y + 1 ) @vy = 0 break else @y += 1 end end else ( - @vy ) . times do if @window . map . solid? ( x , y - HEIGHT - 1 ) @vy = 0 break else @y -= 1 end end end true end
Magic numbers considered harmful!
Magic numbers considered harmful!
# First, assume that no walking happened this frame. # Gravity. # Move upwards until hitting something. # Move downwards until hitting something. # Soldiers are never deleted (they may die, but that is a different thing).