Advertisement

collision

Started by January 07, 2017 11:51 PM
77 comments, last by jpetrie 7 years, 8 months ago

well I have almost finished my collision detection algorithm.

somebody voted me up 15 points, thanks a lot!!!

Advertisement

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)

Advertisement

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.

I am reworking my stubbed out code as per tomd1013 suggestion.

well I am still working on my stubbed out code, I am learning a lot of oop programming fundamentals

Maybe ask more questions if you've been working on stuff. You could show your code for critique.

Also don't get stuck thinking about how you're going to implement something, you have to actually work on implementing some of it too.

This topic is closed to new replies.

Advertisement