简体   繁体   中英

Detect collision of 2 images +iphone/ipad

I am developing a game where 2 persons are fighting. And both of these are images with layouts of man. Now what i want is I want to detect the collision of those men.

Is there any way to do this out? The image frame is 284X270 and the layout of the person is somewhere inside it and rest of all the image part is transparent.

So I want when the person on image1 touches the filled area of image 2 only then collision occurs.

Any help would be really appreciated. Thanks in advance.

For this purpose you will follow 2d mathmatics. Just change x and y coordinates of images(persons) and check intersection point of these images.

check the link , it contains a 2d game checking intersection of two images.

When intersection will occur your logic will make whatever you want.

http://icodeblog.com/2009/02/18/iphone-game-programming-tutorial-part-2-user-interaction-simple-ai-game-logic/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM