Since I’m new to Corona could you point me in the direction of tutorials or guide to do either idea? I have not worked with collisions yet and though I have been reading up on it I haven’t been able to grasp what I need to do.
The code I am working with is one I bought and am re-skining so even though I’ve been able to learn a lot from it and edit most of what I need this one issue is killing me. I have found out that 35 items need to be on the screen at all times so if you have 38 items and remove 9 then 6 item will drop immediately. At the same time one item is always dropping and as that item hits the bottom then another spawns. The higher the level the faster that happens. This is were the problem is. When the 35 spawn the constant single spaws is still happening and thus 2 items can spawn in the same spot. I think if I stop the constant single spawn while the 35 drop then I won’t have a problem but I can’t figure out how to do this within the original code. Below is what I understand to be the code that drives the items spawning.
function Board:enterFrame(event)
if self.runningScore < self.score then
self.runningScore = self.runningScore + (self.score - self.runningScore) / 17
if self.runningScore + 5 > self.score then
self.runningScore = self.score
end
self.scoreText.text = math.floor(self.runningScore)
end
if ((event.time - self.lastTime < self.speed) and (self.numOfItems > 35)) or (event.time - self.lastTime < 50) then
return
end
self.lastTime = event.time
local id = math.random(1, self.numberItem)
self:addItem(“item” … id)
end
function Board:addItems(number)
for i = 1, number do
local id = math.random(1, self.numberItem)
self:addItem(“item” … id, 500)
end
end
function Board:addItem(itemTitle, y)
local x = math.random(106, 706)
if y == nil then y = -100 end
local item = Item({
parent = self.itemLayer,
board = self,
title = itemTitle,
id = self.itemCount,
x = x,
y = y,
})
self.items[item.id] = item
self.itemCount = self.itemCount + 1
self.numOfItems = self.numOfItems + 1
print(self.itemCount)
-------Continue to search for answers on spawning--------
if itemTitle == self.holdTitle and self.mysticStickActive then
item:active()
end
end
I like both idea posted but I’m not sure how to approach doing them. Any guidance on executing those ideas or any new ideas based on the code provided?
Mahalo for your help,
Kaleo