Your game runs at 67fps? Or is that a bug :V
Was pretty interesting, would be much better with added graphics and whatnot. I like the bullet death animation and various other features like that though, this shows a lot of potential. I hope you continue working on it.
As for your question regarding point detection within an ellipse...
Recall that an ellipse is respesented with the equation:
(x^2/a^2) + (y^2/b^2) = 1or
(x*x/a*a) + (y*y/b*b) = 1x = x coordinate of the center point
y = y coordinate of the center point
a = horizontal stretch
b = vertical strech
We can substitute variables for all these values, as well as the coordinates of the point we're trying to detect, and then combine them into an equation that will return
true if the point is less than
radius pixels away from the ellipse, otherwise it will return
false.
(x, y) = position of the center of the ellipse
(a, b) = radiants (horizontal and vertical stretch, respectively) of the ellipse
(px, py) = center of possible collision point
radius = radius of the circle centered on the point (px, py)
First, find the difference between the coordinates of both the collision circle, and the ellipse's center point.
dx = px - x;
dy = py - y;Then, using the equation of an ellipse and the differences between the two points, we'll derive an equation that will return the distance between the edge of the ellipse and that point. We can detect if that distance is less than the circle's radius (colliding with it) to form a hitbox detection statement for the ellipse:
(dx*dx)/(a*a) + (dy*dy)/(b*b) <= radiusThis equation returns true if the point is less than
radius pixels away from the ellipse. After some coordinate grid angling tomfoolery, this equation should suffice for elliptical hitbox detection. Best of all, it doesn't use processor whoring trigonometry! Hooray!
EDIT: Whoops! Noticed you asked about 3d rendering as well. Since you're using C++ and this is only a hobby/side project for you, I'd recommend using one of the
free libraries from
this site to handle everything for you, if possible. Wouldn't want to spend too much time on it :V