Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'chingu'
- class Player < Chingu::GameObject
- def initialize
- super
- self.x, self.y = 200, 200
- self.image = Gosu::Image["ship1.jpg"]
- self.input = {
- :holding_left => :move_left,
- :holding_right => :move_right,
- :holding_up => :move_up,
- :holding_down => :move_down }
- end
- def move_left; @x -= 3; end
- def move_right; @x += 3; end
- def move_up; @y -= 3; end
- def move_down; @y += 3; end
- end
- class Game < Chingu::Window
- def initialize
- super(600,600,false)
- self.input = { :y => :exit }
- @player = Player.create
- end
- def update
- super
- self.caption = "FPS: #{self.fps}"
- end
- end
- @game = Game.new
- @game.show
Add Comment
Please, Sign In to add comment