Revisions
-
vaxinate revised this gist
Apr 7, 2012 . 2 changed files with 13 additions and 15 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ 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 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 charactersOriginal file line number Diff line number Diff line change @@ -1,19 +1,5 @@ require 'gosu' require_relative 'player' class GameWindow < Gosu::Window def initialize -
poemdexter created this gist
Apr 7, 2012 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ # 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