Hello,
I’m using director and I have a system so that when you click it spawns a crate on the screen. I have a restart button which goes to a loading page. It works for everything but the crates - the crates stay where they are, and each time I restart it adds +1 crate per click each time, so first go each click is one crate, the restarted it’s 2 crates per click.
Any ideas on how to make it work. Here’s my restart button:
[code]local function res(event)
goToScene = “level1”
fxMode = “crossfade”
crate:removeSelf()
director:changeScene(“loadlevel”, crossfade)
end
resBt:addEventListener(“tap”, res)[/code]
and this is the code for spawning crates:
[code]local function spawnCrate(event)
local crate = display.newImage(“images/crate.png”)
crate.x = event.x; crate.y = event.y;
physics.addBody( crate, { density=15.0, friction=0.5, bounce=0.2} )
end
Runtime:addEventListener(“tap”, spawnCrate)[/code]
Thanks, any help is much appreciated. [import]uid: 68047 topic_id: 11656 reply_id: 311656[/import]
[import]uid: 52491 topic_id: 11656 reply_id: 42392[/import]