From 1ed130326a2db1054a639738716acc29c51c1206 Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Mon, 11 Oct 2021 14:27:34 +0200 Subject: [PATCH] Stuff --- prog2/gametest/app.rb | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/prog2/gametest/app.rb b/prog2/gametest/app.rb index 12195e5..ace17d8 100755 --- a/prog2/gametest/app.rb +++ b/prog2/gametest/app.rb @@ -40,23 +40,28 @@ class Game < Gosu::Window attr_accessor :caption attr_reader :width, :height - def initialize(width, height) + def initialize(width, height, physobjs = []) super width, height @width, @height = width, height self.caption = "Test | #{width}x#{height}" - - @arch = Arch.new("arch.png", 10, 0, 0, 0.1, -0.8) - + @physobjs = physobjs end def update - @arch.physics(self.width, self.height) + @physobjs.each do |obj| + obj.physics(self.width, self.height) + end end def draw - @arch.draw(@arch.x, @arch.y, 0) + @physobjs.each do |obj| + obj.draw(obj.x, obj.y, 0) + end end end -game = Game.new(640, 480) +@arch = Arch.new("arch.png", 10, 0, 0, 0.1, -0.8) +@arch2 = Arch.new("arch.png", -10, 0, 0, 0.1, -0.8, 164) + +game = Game.new(640, 480, [@arch, @arch2]) game.show