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)?
Label: corona android iphone ipad building error inmobi problem display screen View image tableView failed object physics touch button game lua config event listener |
Make a hitbox inside a newImage
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:1428 update:2011/10/11 8:57:46
热门文章
GameCenter LeaderBoards and Achievements Enabled Through OpenFeint
send message and call to a person
Forum: Report Spam + PM
[INSTALL_PARSE_FAILED_NO_CERTIFICATES]
[SOLVED] Director ERROR: Failed to execute new( params ) function on 'screen1'
Too many (200) local variables
Corona SVG Level Builder released. Drag and drop physics level editor with Inkscape and SVG.
Small bug in Collectible Items example
Pivot Joints and apparent elasticity
Can't make removeSelf() delayed
send message and call to a person
Forum: Report Spam + PM
[INSTALL_PARSE_FAILED_NO_CERTIFICATES]
[SOLVED] Director ERROR: Failed to execute new( params ) function on 'screen1'
Too many (200) local variables
Corona SVG Level Builder released. Drag and drop physics level editor with Inkscape and SVG.
Small bug in Collectible Items example
Pivot Joints and apparent elasticity
Can't make removeSelf() delayed
corona forums © 2003-2011