Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'gosu'
- class Window < Gosu::Window
- def initialize
- super(500, 32, false)
- self.caption = "test gosu/ruby (Echap pour quitter)"
- @score = 0
- end
- def reset
- @score = 0
- end
- def button_down(id)
- close if id == Gosu::KbEscape
- reset if id == Gosu::KbF12
- end
- def update
- @text = Gosu::Image.from_text(self, "#{@score}", "Georgia", 24)
- @score -= 1 if button_down?(Gosu::KbDown) if @score >= 0
- @score += 1 if button_down?(Gosu::KbUp) if @score <= 200
- end
- def draw
- @text.draw(10,0,1)
- end
- end
- Window.new.show
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement