3 커밋 54f62fa7fb ... 2e8df10570

작성자 SHA1 메시지 날짜
  Eric Santos 2e8df10570 Background atualizado para receber automaticamente a informação do tamanho da tela 5 년 전
  Eric Santos 123f75c22c Background atualizado para receber automaticamente a informação do tamanho da tela 5 년 전
  Eric Santos 0daca45119 Readme atualizado 5 년 전
3개의 변경된 파일23개의 추가작업 그리고 4개의 파일을 삭제
  1. 9 0
      README.md
  2. 7 1
      background.lua
  3. 7 3
      main.lua

+ 9 - 0
README.md

@@ -0,0 +1,9 @@
+**BEM VINDO AO MEU JOGO!**
+
+Deseja rodá-lo?
+
+Para tal, é necessário estar rodando a versão mais atualizada da biblioteca Love2D. Após isso, você deve realizar um clone deste repositório. Após isso, basta rodar o Love2D passando a pasta raíz do jogo como um parâmetro.
+
+Divirta-se!
+
+Este projeto está em desenvolvimento constante, caso tenha alguma crítica, sugestão ou queira meu contato, me procure no e-mail ericsantosbr2@gmail.com

+ 7 - 1
background.lua

@@ -1,9 +1,14 @@
 -- background file for Navy
 local bg = {}
 
-function bg.new(width, height, elements, speed)
+function bg.new(elements, speed)
 	local newBg = {}
+
+	local width = love.graphics.getWidth()
+	local height = love.graphics.getHeight()
+	
 	local objects = objGen(width, height, elements)
+
 	newBg.speed = speed or 8
 	newBg.objects = objects
 
@@ -14,6 +19,7 @@ function bg.new(width, height, elements, speed)
 	newBg.update = function(self)
 		for i, k in pairs(self.objects) do
 			if k.x < 0 then
+				k.y = math.random(1, love.graphics.getHeight())
 				k.x = love.graphics.getWidth() + 10
 			else
 				k.x = k.x - self.speed

+ 7 - 3
main.lua

@@ -10,6 +10,9 @@
 -- TODO: Implementar reset dos padrões de draw
 -- TODO: Implementar sprites básicos do personagem
 -- TODO: Implementar sprites de inimigos
+-- TODO: Implementar nova origem de tiros para receber como parâmetro a posição de um objeto (jogador no caso)
+-- TODO: Refatorar o update do background para mudar a posição das "estrelas" quando elas atingirem o limite da tela
+
 
 -- table piles that will be used on iteratons
 local objectPile = {}
@@ -35,7 +38,6 @@ local points = 0
 local enemy = require("enemy")
 local enemyPile = {}
 
 local downKeys = dofile("keys.lua")
 
 -- background object
@@ -79,13 +81,14 @@ function love.load(args)
 	table.insert(enemyPile, enemy2)
 
 	-- background creaiton
-	bg = background.new(800, 600, 32)
-	bg2 = background.new(800, 600, 24, 4)
-	bg3 = background.new(800, 600, 16, 2)
+	bg = background.new(32)
+	bg2 = background.new(24, 4)
+	bg3 = background.new(16, 2)
 	table.insert(bgPile, bg)
 	table.insert(bgPile, bg2)
 	table.insert(bgPile, bg3)
 	table.insert(objectPile, bgPile)
+
 end
 
 function love.update(dt)