I’m playing around with a Breakout-type game and dealing with bricks. I created an array (table?) of bricks across the top of the screen and when a brick is hit, that brick is deleted and a new brick is put in the same place (so you have to hit a brick multiple times, each time cracking it a little more).
When I do that with two clicks it works but when I try to make a brick break on 3 clicks I’m running into problems.
Here’s a 2.5 minute video that shows the problem:
http://instantvideowebpages.com/play/notmplvid.php?384
And this is the listener code as seen in the video:
[code]local hitBrick = function( event )
local t = event.target
local phase = event.phase
if “began” == phase then
local myIndex = t.myIndex
local x = t.x
local y = t.y
bricks[myIndex].bricknum = bricks[myIndex].bricknum + 1
if bricks[myIndex].bricknum > 2 then
playBeep()
bricks[myIndex]:removeSelf()
t:removeSelf() – destroy object
else
playTileHit()
BuildABrick(bricks[myIndex].bricknum, x, y, myIndex)
end
end
return true
end
[/code]
Thanks to anyone who can point me in the right direction.
Jay
[import]uid: 9440 topic_id: 2968 reply_id: 302968[/import]