4 Commits 2ad653fb44 ... 54f62fa7fb

Author SHA1 Message Date
  Eric Santos 54f62fa7fb added two backgrounds 5 years ago
  Eric Santos 8d4294f518 Merge branch 'master' of notabug.org:ericsantosbr/Navy 5 years ago
  Eric Santos 90fd4f2925 Merge branch 'master' of notabug.org:ericsantosbr/Navy 5 years ago
  Eric Santos e9bf388fbc main update 5 years ago
2 changed files with 8 additions and 4 deletions
  1. 3 3
      background.lua
  2. 5 1
      main.lua

+ 3 - 3
background.lua

@@ -1,10 +1,10 @@
 -- background file for Navy
 local bg = {}
 
-function bg.new()
+function bg.new(width, height, elements, speed)
 	local newBg = {}
-	local objects = objGen(800, 600, 64)
-	newBg.speed = 8
+	local objects = objGen(width, height, elements)
+	newBg.speed = speed or 8
 	newBg.objects = objects
 
 	newBg.getObjNum = function(self)

+ 5 - 1
main.lua

@@ -79,8 +79,12 @@ function love.load(args)
 	table.insert(enemyPile, enemy2)
 
 	-- background creaiton
-	bg = background.new()
+	bg = background.new(800, 600, 32)
+	bg2 = background.new(800, 600, 24, 4)
+	bg3 = background.new(800, 600, 16, 2)
 	table.insert(bgPile, bg)
+	table.insert(bgPile, bg2)
+	table.insert(bgPile, bg3)
 	table.insert(objectPile, bgPile)
 end