Bitmap hittesting in AS3

£可爱£侵袭症+ 提交于 2019-12-25 18:59:13

问题


I'm building a 16 bit game for my final project and have completed all the objects and environments, I exported all the images as png files into flash as well as my character, breaking the environment up into background, objects and foreground. I can't however find a simple tutorial explaining how to do bitmap hit testing or another simple way of making my character not be able to move into the objects.

Could someone recommend a simple tutorial or an alternative method of achieving this ?

Thanks in advance


回答1:


Take a look at this great tutorial about using BitmapData.hitTest for collision detection:

http://www.mikechambers.com/blog/2009/06/24/using-bitmapdata-hittest-for-collision-detection/

Also, if you are building a flash game I think you should look into using a Flash Game Engine, for example for 2D games, plataformers and such I'd recommend:

  • FlashPunk

  • or Flixel

Both will help you A LOT with game development specific stuff such as collision detection, user input, etc which should speed up your workflow. Hope this helps!



来源:https://stackoverflow.com/questions/13046930/bitmap-hittesting-in-as3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!