Make a hitbox inside a newImage

I've seen the question asked before, but that was in relation to SpriteLog.
1. So, is it possible to create a smaller "hitbox" inside a simple small transitioning image?
2. Is it possible to make two(this might be answered in question 1)?

I usually use this hitTest method to make the hit zone bigger or smaller than the display objects:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
function hitTestObjects(obj1, obj2, dist)
                local dist = dist or 30 -- 30 is default if dist = nil
                local sqrt = math.sqrt
                local dx =  obj1.x - obj2.x
                local dy =  obj1.y - obj2.y
                local distance = sqrt(dx*dx + dy*dy)
                -- distance = actual distance
                -- dist = hit zone radius
 
                if distance < dist then 
                        return true
                else
                        return false
                end
end

Thanks, that worked great. I actually had some similar code already in my game... just proves that interacting, even through a forum helps your brain think. Just being alone is not a formula for success. :)

views:1427 update:2011/10/11 8:57:46
corona forums © 2003-2011