I have this little function which checks for collision. What I have to do, though, is first navigate through the large table that houses the numbers for my enemies. The table looks something like this (note: this isn't my real code; it's just for this example):
Code: Select all
group.enemy = {}
group.enemy[1] = {x = 20, y = 20, radius = 16, hasBeenHit = false}
group.enemy[2] = {
buzzard1 = { x = 20, y = 20, radius = 21, hasBeenHit = false}
buzzard2 = {x = 40, y = 40, radius = 21, hasBeenHit = false}
buzzard3 = {x = 60, y = 60, radius = 21, hasBeenHit = false}
}
group.enemy[3] = {
guy1 = {x = 20, y = 30, radius = 22, hasBeenHit = false}
guy2 = { x = 40, y = 70, radius = 22, hasBeenHit = false}
}