Hey Guys and ladies
I need some help on my project. what i’m trying to do is to spawn the enemy’s for ever/infinite and as you progress through the game, more and more enemy’s are spawned . At the moment its only spawning one enemy. I would really appreciate it if you modify my code and then just post it back on this topic so i can get an idea of what i’m doing wrong and what i can put in my project
Here is my code.
function spawnEnemy() local enemyBalloon = display.newImage(Balloons,”Balloon.png”) physics.addBody(enemyBalloon,”dynamic”, physicsData:get(“balloon”) ) if math.random(2) == 1 then enemyBalloon.x = math.random(-100,-10) else enemyBalloon.x = math.random(display.contentWidth+10,display.contentWidth +100) end enemyBalloon.x = math.random(display.contentWidth) enemyBalloon.y = -60 end spawnEnemy()
cheers, Hazza