alright umm... i get what your saying but when i do that i get a
message saying:
my_game.rb:80: syntax error, unexpected keyword_end, expecting $end
so could you show me where i would put it exactly
heres my code:
$: << File.expand_path(File.dirname(__FILE__))
require 'rubygems'
require 'gosu'
require 'player'
require 'ball'
class MyGame < Gosu::Window
def initialize
super(600, 600, false)
@player = Player.new(self)
@balls = 3.times.map {Ball.new(self)}
@running = true
@pause = false
@font = Gosu::Font.new(self, 'system', 32)
@font2 = Gosu::Font.new(self,'system', 32)
end
def button_down(id)
if id == Gosu::Button::KbP
if @pause== false
@pause = true
else
@pause = false
end
end
end
def update
if @pause == false
if @running
if button_down? Gosu::Button::KbLeft
@player.move_left
end
if button_down? Gosu::Button::KbRight
@player.move_right
end
if button_down? Gosu::Button::KbUp
@player.move_up
end
if button_down? Gosu::Button::KbDown
@player.move_down
end
@balls.each {|ball| ball.update}
if @player.hit_by? @balls
stop_game!
end
else
#the game is currently stopped
if button_down? Gosu::Button::KbEscape
restart_game
end
end
end
end
def draw
@player.draw
@balls.each {|ball| ball.draw}
end
def stop_game!
@running = false
end
end
def restart_game
@running = true
@balls.each {|ball| ball.reset!}
end
end
window = MyGame.new
window.show
thank you