Created
April 7, 2012 14:15
-
-
Save poemdexter/2329294 to your computer and use it in GitHub Desktop.
rub
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# in player.rb | |
class Player | |
def initialize(window) | |
@bandit_sprite = Gosu::Image.new(window, "bandit.bmp", false) | |
@x = @y = 0 | |
end | |
def draw | |
@bandit_sprite.draw(24*@x, 24*@y, 1) | |
end | |
end | |
# in test.rb which i run 'ruby test.rb' in console | |
require 'gosu' | |
class GameWindow < Gosu::Window | |
def initialize | |
super 480, 480, false | |
self.caption = "Dan's Shit Game For Idiots: Dubstep Protocol" | |
@target_sprite = Gosu::Image.new(self, "target.bmp", true) | |
@grid = Array.new(20,[]) | |
@grid = @grid.map {Array.new(20,0)} | |
@player = Player.new(self) | |
end | |
def update | |
end | |
def draw | |
@grid.each_with_index do |inner, x| | |
inner.each_index do |y| | |
@target_sprite.draw(x*24,y*24,0) | |
end | |
end | |
@player.draw | |
end | |
end | |
window = GameWindow.new | |
window.show |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment