lib/share/player.rb
# TODO: check for collision before update
# if move_left or move_right set u on a collided field
# dont update the position or slow down speed
# idk make sure to not get stuck in walls
check for collision before update
if move_left or move_right set u on a collided field
dont update the position or slow down speed
idk make sure to not get stuck in walls
check for collision before update if move_left or move_right set u on a collided field dont update the position or slow down speed idk make sure to not get stuck in walls
def check_move_left(game_map)
    col = game_map.collision?(@x / TILE_SIZE, (@y + @h - 1) / TILE_SIZE)
    if col
      @x = (col[:x] + 1) * TILE_SIZE
      @x += 1
      do_collide(:left, true)
    end
    col = game_map.collision?(@x / TILE_SIZE, (@y + 1) / TILE_SIZE)
    if col
      @x = (col[:x] + 1) * TILE_SIZE
      @x += 1
      do_collide(:left, true)
    end
    nil
  end
def check_move_left ( game_map ) col = game_map . collision? ( @x / TILE_SIZE , ( @y + @h - 1 ) / TILE_SIZE ) if col @x = ( col [ :x ] + 1 ) * TILE_SIZE @x += 1 do_collide ( :left , true ) end col = game_map . collision? ( @x / TILE_SIZE , ( @y + 1 ) / TILE_SIZE ) if col @x = ( col [ :x ] + 1 ) * TILE_SIZE @x += 1 do_collide ( :left , true ) end nil end
TODO: check for collision before update
if move_left or move_right set u on a collided field
dont update the position or slow down speed
idk make sure to not get stuck in walls
TODO : check for collision before update if move_left or move_right set u on a collided field dont update the position or slow down speed idk make sure to not get stuck in walls
# left bottom # left top
game_map
<not_specific>