Targeting code update
I looked at the batari source code for a very simple game, and was a sequence in the code to allow you to have a crosshair fire at a blue circle, and it used sprite collision to tell if you were aiming at the circle or not. I couldn't get it to consistently score a hit even when the crosshair was visually on the target, and I didn't know how to make it work better. So that's why I'm going to focus on learning the language now instead of experimenting with code. Although I think I might have conceptually figured out a way to do it; based on the coordinates, but it would be hard to implement. The code used x/y coordinates to tell where the sprites were on the screen. You could say if the xy coordinates of the crosshair were within an arbitrarily defined range of the targets x/y coordinates, && (Boolean and) f (fire button) = 1 then you have a hit. But it would be difficult to figure out the ranges and avoid false hits and failure to hit when you were over the target.
I did some work with sprites and colors, I'm unsatisfied with the target sprite. It's too small and looks nothing like a plane. Next I think is a better target algorithm but that sprite has to get better. Maybe I have to look at more example code?
2 Comments
Recommended Comments