Forgive Google Translate for my English.
The situation: there is a sprite image on it - how do you know that I clicked on the visible part of the picture, and not by its transparent area? Sprite: hitTestPoint (x, y) - will not work. It is necessary to tie to the bitmap array with polygon vertices, which determines the visible part of the picture, and the function of checking whether the point of the plane of the polygon. This function is described here:
http://www.giderosmobile.com/forum/discussion/comment/775#Comment_775And to make it easier to make a polygon that defines the visible part of the picture, did such tool:
- Instead image.png - add existing fails to correct you picture;
- Run the project and start the mouse draw path picture;
- If clicked is not there - grab this point and drag to the right place;
- If the point you want to delete - doubleclick on it;
- If you go to add a point not at the end, and in the middle, - highlight by clicking the place in front of which should be a new window, and then click there where it should appear.
I wanted to add triangulation to Box2D, but the algorithm Feronato (
http://www.emanueleferonato.com/2012/06/27/polygon-triangulation-decomposition-of-a-polygon-into-triangles-with-as3/) is unstable - threw.
Comments
thank you @sslivka
At line 105 in main.lua, change
Website: http://www.castlegateinteractive.com
https://play.google.com/store/apps/developer?id=Castlegate+Interactive
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
Note: Double Tap visually removes a vertex but not from the table. and that causes multiple entries in the vertices table. Perhaps because of the fact that a point is added after the selected vertex under the -- добавляем новую вершину loop.
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
main.lua - line 65
[lua]
if (os.time () - t0) == 0 and vertices [i]. isFocus then
stage: removeChild (vertices [i])
table.remove (vertices, i)
[/ lua]
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps