So, I'm trying to get my head around doing a Dig Dug type game. I decided to try with drawing rectangles. I've got something that looks promising but doesn't behave very well.
--local tunnelHalfHeight = PLAYER.tunnel:getHeight()/2
local tunnelY = PLAYER.tunnel:getY()
--local playerHalfHeight = PLAYER:getHeight()/2
local playerY = PLAYER:getY()
local distance = playerY - tunnelY
print("Tunnel distance is: "..distance)
if distance > 1 then
The rectangle expands but the Y stays static. If I uncomment setY(), it never resizes as it moves with the player. (I'm using http://giderosmobile.com/forum/discussion/100/any-chance-of-a-setwidth-and-setheight-for-bitmaps/p1
I thought of just creating a new rectangle with every +1 playerY but that sounds like it could turn into a performance nightmare.
Perhaps this is entirely the wrong approach though and I would be better off drawing straight onto canvas somehow. Assuming I can then limit monster movement to stay inside what is drawn, i.e. the tunnels (I was originally going to do rectangle collision checks)...
I'm guessing the way they used to do it was to calculate every line with every frame (or something?).