Question

I want to have a curved shield in front of my space ship to block incoming attacks.

Any ideas on how to use an image and make it only detect where the pixels are or something similar? Even if I have two objects, being the image and something else like a curved line, this should be possible right? Thanks!

Was it helpful?

Solution

In a real MVC (Model-View-Controller) design you would have a model that just describes where your spaceship is and perhaps a math formula describing your shield. Then the view component draws images based on that. If you check for collision you don't need to work on pixels. You can calculate the path of a shot (like the path the shot has moved since the last cycle of your game engine which will only cover milliseconds) and then check whether it collided with anything using plain math.

OTHER TIPS

Any tutorials…?

This kinetic model of elastic collisions uses an MVC design, and this paper on 2-Dimensional Elastic Collisions may be instructive.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top