So I’m working on my first game and I am setting it up to where balloons fly up through the screen and you have to pop them and the only thing i need to do now is make them disappear after being touched.
Here is my current code
[lua]system.activate(“multitouch”)
local physics = require(“physics”)
physics.start()
physics.setGravity(0, -9.8)
local background = display.newImage(“Graphics/sky.png”)
local balloons = 100
local balloonsLEFT = display.newText(“You Have “… balloons …” Balloons Left”, 20, 45, nil, 26)
balloonsLEFT:setTextColor(255,0,0)
local score = 0
local scoreTEXT = display.newText(“You Popped " … score … " Balloons”, 20, 20, nil, 26)
scoreTEXT:setTextColor(0,0,255)
local function spawnBalloon()
local balloon = display.newImage(“Graphics/balloon1.png”)
balloon.x = display.contentWidth/2
balloon.y = display.contentHeight + 150
physics.addBody(balloon)
function killBalloon(event)
score = score + 1
local text = display.newText(“You Popped Another Balloon!”, 50, 100, nil, 26)
text:setTextColor(0,0,0)
transition.to(text, {time = 2000, alpha = 0, x = 300, y = 400})
end
balloon:addEventListener(“touch”, killBalloon)
end
timer.performWithDelay( 500, spawnBalloon, balloons)
display.setStatusBar( display.HiddenStatusBar )[/lua]
What can i add to this to make it pop/remove?
I will be making audio and such but that is otherwise.
And also I realized that the score isnt adding up either when you touch a balloon. Any idea on how to fix that?
Thanks in Advanced,
Brennan [import]uid: 81383 topic_id: 18569 reply_id: 318569[/import]