class Pacman::GameObject
Super class for game entities
Attributes
x[R]
y[R]
Public Class Methods
new()
click to toggle source
# File lib/pacman/GameObject.rb, line 6 def initialize @direction = UNDEF @x = 0 @y = 0 end
Public Instance Methods
grid_pos()
click to toggle source
# File lib/pacman/GameObject.rb, line 16 def grid_pos Coordinate.new((@x / BLOCK_SIZE).floor, (@y / BLOCK_SIZE).floor) end
grid_x()
click to toggle source
# File lib/pacman/GameObject.rb, line 20 def grid_x (@x / BLOCK_SIZE).floor end
grid_y()
click to toggle source
# File lib/pacman/GameObject.rb, line 24 def grid_y (@y / BLOCK_SIZE).floor end
warp(x, y)
click to toggle source
# File lib/pacman/GameObject.rb, line 12 def warp(x, y) @x, @y = x, y end