class Player
Public Class Methods
new(window)
click to toggle source
# File foo/foo_gosu.rb, line 24 def initialize(window) @image = Gosu::Image.new(window, IM1, false) @x = @y = @vel_x = @vel_y = @angle = 0.0 @score = 0 end
Public Instance Methods
accelerate()
click to toggle source
# File foo/foo_gosu.rb, line 42 def accelerate @vel_x += Gosu::offset_x(@angle, 0.5) @vel_y += Gosu::offset_y(@angle, 0.5) end
draw()
click to toggle source
# File foo/foo_gosu.rb, line 57 def draw @image.draw_rot(@x, @y, 1, @angle) end
move()
click to toggle source
# File foo/foo_gosu.rb, line 47 def move @x += @vel_x @y += @vel_y @x = 640 @y = 480 @vel_x *= 0.95 @vel_y *= 0.95 end
turn_left()
click to toggle source
# File foo/foo_gosu.rb, line 34 def turn_left @angle -= 4.5 end
turn_right()
click to toggle source
# File foo/foo_gosu.rb, line 38 def turn_right @angle += 4.5 end
warp(x, y)
click to toggle source
# File foo/foo_gosu.rb, line 30 def warp(x, y) @x, @y = x, y end