Permalink
Browse files

threw out overcomplicated Timer::Constructors (kyoto2-style) stuff an…

…d integrated every (kyoto1-style)
  • Loading branch information...
1 parent 1c8b9ea commit 4370f0bdb4aa857e625c818a5fb788baa808040f @oneup committed Jul 6, 2009
Showing with 21 additions and 0 deletions.
  1. +21 −0 spaceinvaders/spaceinvaders.rb
@@ -4,12 +4,22 @@
# code (cc) oneup <hello@geeq.at>
# graphics (cc) kingpepe
+require "activesupport"
+require "kyoto_reconstruction"
+
+def game
+ $game
+end
+
class Spaceinvaders < Game
attr_accessor :player
include Collideable
+ include Timer
resolution [640, 480]
def setup
+ $game = self
+
@x, @y = 0, 0
@player = PlayerShip.new
@objects << @player
@@ -24,6 +34,17 @@ def setup
end
row += 1
end
+
+ every(2.seconds) do
+ row = 0
+ x = 10 # fixme: calculate from EnemyShip.rows
+ EnemyShip.cols.times do
+ enemy = EnemyShip.new(x, row)
+ @objects << enemy
+ x += (enemy.width + 10)
+ end
+ row += 1
+ end
end
def font

0 comments on commit 4370f0b

Please sign in to comment.