Not sure of this is the right section… But I’m running in a bit of a problem here
I’m working on a game, and I’m using the Director class to transition between scenes. I’m trying to get a reset button in my game, so the user can quickly restart the level, but it’s not exactly working as I’d hope.The problem, is that when I reset the game, it does reset my bomb (its an Angry Birds-esque game where you fling a bomb to a tower), but not the tower.
*EDIT*Okay, what is up with this form? It cuts off my code halfway, and when I try to post it without code tags, it turns into one giant soup of gibberish.
module(..., package.seeall) new = function () ------------------ -- Groups ------------------ local localGroup = display.newGroup() ------------------ -- Your code here ------------------ local physics = require("physics") physics.start() physics.setScale(50) local HUD = display.newGroup ( ) local game = display.newGroup() local background = display.newGroup() local bg = display.newImage( "images/bg.png", 0,0 ) background:insert(bg) local bomb = display.newCircle( \_W / 2, \_H / 2, 40) physics.addBody ( bomb, "dynamic", {density=1, friction=0.3, bounce=0.2, radius=40} ) game:insert(bomb) local floor = display.newRect( 0, \_H, 2048, 20 ) physics.addBody(floor, "static", {density = 1.0, friction = 0.3, bounce = 0.2, isSensor = false}) game:insert(floor) local resetBtn = display.newRect( 15, 15, 20, 20 ) resetBtn:setFillColor ( 253, 0, 2 ) HUD:insert(resetBtn) --Create tower of blocks for i=0, 3 do for j =0,i+1 do local x = 1600 + (120\*(j - (i/2))) local y = (i\*160) - 305 local rect = display.newRect( 0, 0, 30, 120 ) rect.x = x rect.y = y+80 physics.addBody(rect, "dynamic", {density = 2.0, friction = 0.3, bounce = 0.2, isSensor = false}) game:insert(rect) if j