well I have almost finished my collision detection algorithm.
collision
I am going back to my stubbed out code, to better understand my coding problem
yeah!!! I finally figured out my stubbed out code, for my next step I have to integrate my code into my game project, it always feels good when I solve a project.
well I have integrated my stubbed out into my game project, now all I have to do is get the ball to hit the brick and turn it off. I have got my brick to turn off when I hit the space bar and move the ball a small amount of space, however I want the block to disappear when I actually hit the brick with my bullet. I am learning how to push it through a problem. thank you for voting up my posts.
The method you were trying in the stub code you submitted didn't seem to be the best implementation. What does your stub code look like now?
LennyLen's method would be the best implementation to start with, I think.
The basic idea I would go with is:
- bullet has an X and Y position(int, float, etc.), and isFired(boolean)
- brick has X and Y position(int, float, etc.), isActive(boolean), and width and height (int, float, etc.)
- button press sets bullet's isFired bool to True
- update function checks bool for bullet(s) and moves it up a bit when needed
- update function checks if bullet X and Y are inside any of the (active) bricks, if it is in a brick change that brick's isActive to false
- draw everything to the screen (except bricks that aren't active)
well I have integrated some of my stubbed out code into my game program, I am still working on my collision detection routine, thank you for your ideas.
well I am still working on my stubbed out code, I am learning a lot of oop programming fundamentals