>ruby main.rb
gem_original_require': no such file to load -- ./fps (LoadError)
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require'>Exit code: 1
class Player < Char
def initialize(image)
super(0, 0, image)
end
def update
animate! if animating?
walk! if walking?
if @step >= 16
@step = 0
else
@step += 2
end
return [@x, @y]
end
protected
def walk!
raise "not walking" unless walking?
if @step >= 16
@walking = false
return :finished
end
# Move on screen
case @direction
when :up
@y_off -= 2
when :down
@y_off += 2
when :left
@x_off -= 2
when :right
@x_off += 2
end
if @y_off < 0
@y_off += 16
@y -= 1
elsif @y_off > 15
@y_off -= 16
@y += 1
end
if @x_off < 0
@x_off += 16
@x -= 1
elsif @x_off > 15
@x_off -= 16
@x += 1
end
end
end
def animate_scrolling
if @steps >= TILE_SIZE
@scrolling = false
return :finished
end
case @direction
when :up
@scrolled_y -= 2
when :down
@scrolled_y += 2
when :left
@scrolled_x -= 2
when :right
@scrolled_x += 2
end
@steps += 2
end
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill