Welcome!

Hey, I'm Skylar, a kid aspiring to become a competent programmer. This blog is here to detail my dabbles in development.

My dream is to one day become a professional programmer and do some game development in my spare time.

Thanks for visiting my blog, and I hope you'll come back!

Pages

Making up for Lost Time.








Well This isn't the actual development post for today. I woke up about three hours ago, and got to work. I finished everything I wanted in the rewrite. All my code is finally nicely commented and it's real clean and organized, the task now is to keep it that way. So as I go along I'll have to make sure I'm keeping those good habits. Anyways, this post is just about the day void of development, and the post I made like at 2 AM this morning that had no screen shots. I decided to make up for that with 3 screen shots. The first shows all 5 enemies and the player and bullets within the level. The second is after the player has been destroyed, and one enemy destroyed. The last is 2 enemies alive and the player alive.

Anyways, I fixed the collision glitch. The problem was the rendering. The collisions were completely fine.

So down in the code I had something like this:

//Note: This is a function from LazyFoo's tutorials, so if you want more information on how
//it works, check out LazyFoo's site.

apply_surface(circle.x + circle.radius, circle.y + circle.radius, surEnemy, surScreen);


So now what's the problem with this... In my Circle struct, (x,y) is the center of the circle. Surfaces are applied from the top left. Adding the radius to x and y means that the bottom right corner of the actual graphic on the screen will be treated as the top left when calculating the collisions. This meant that sometimes the bullet could completely miss it, and the collision would turn up true. It also meant that the bullet could go right through it and the collision would turn up false. The latter is how I found the glitch. I shot the bullet so perfectly that it went through the center of the first enemy and nothing happened
and it continued up straight through all the enemies and the collision never registered. I just did a little searching and found the problem pretty quickly. Subtracting the radius instead of adding it completely fixed it.

Well that's all I wanted to talk about. Today I'm gonna take a shot at the quad tree decomposition, so I'll make a post tonight about how it goes. Ciao!

0 Response to "Making up for Lost Time."

Post a Comment