• entries
686
1952
• views
387442

# Day 3: success

59 views

It took 3 days of work, but I got it working quite well. So what was the problem?

After checking, double checking, and triple checking my code, I finally found the error.

Here was the code I used for the platform collision, which checks if a point is inside a bounding box:
bool Inside(int x, int y, SDL_Rect rect){	if(x >= rect.x && x <= rect.x + rect.h && y >= rect.y && y <= rect.y + rect.h)	   return true;	return false;}

Yeah, spot the error.

copy and paste for the loose? :D

rect.w

It's already fixed. I actually didn't copy that code as it may look like, it's just sometimes I will make such errors when writing code like that.

I made almost the same mistake this morning with Bresenham's algorithm. I put in a deltaX where a deltaY should have been. And then I ended up doing some other stupid stuff.

Don't you love brainbashing code? :D

I tend to make those type of errors alot, but see them almost immedietly.

I wrote that function back in december, and haven't caught it tell now[grin]

Oh yes, I love those bugs. I do them all of the time. Like the other day when the player moved his velocity changed based on his Y and Y speeds. Oh yes, confusion galore when I kept on running on weird angles into the walls. :)

Stompy is starting to look much sleeker and professional every time I look at it. Or maybe my eyes are starting to attune to programmer art, hehe.

That screen looks pretty interesting, I'm excited to play the new level, even though I still haven't gotten to level 3 yet.....

I've found that my copy-paste skills are getting much better, as I'm producing errors like that a lot less often, practice makes perfect I guess[grin]

HopeDagger, your eyes are getting used to the programmer art. GO AND RINSE THEM NOW![grin]

I'm ashamed(well, not really) to say that I've often used the power of copy and paste in my code. And it has resulted many times in bizarre type errors.

tried your game and I really liked it. still there are some smaller points which could imho be changed:
-it would be nice if the camera would show more of the right side, its quite hard with some enemys if you can only see them so late
-I found it a bit strange that the main game only plays in the lower 1/3 of the screen, maybe you could use more use of plattforms for the level design?

what suprised me was how got these simple explosions look animated.
I tried to animate an explosion for my game, frame by frame and while the frames might look okay, it looks really ugly animated :/

btw: wouldnt it be faster to use a pointer for the SDL_Rect?
I mean if you call this function very often per frame, and since you dont change the Rect you could easily exchange it..

well I really think too much about optimization ;)

Thanks for trying it out!

Changing the scrolling back could be a good idea. Level 4 will be almost purely based on a moving platform design, and you'll have to fight flying enemies, so the top of the screen will get more exposure.

A pointer to an SDL_Rect would work too, but as of right now, I don't think there is a need for any optimization. However, it's something I should keep in mind.

## Create an account

Register a new account

×

## Important Information

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!