Day 3: success

Published March 23, 2006
Advertisement


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.
Previous Entry Ok...
0 likes 9 comments

Comments

MustEatYemen
copy and paste for the loose? :D

rect.w
March 23, 2006 04:42 PM
Stompy9999
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.
March 23, 2006 04:49 PM
Mushu
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
March 23, 2006 05:29 PM
Stompy9999
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]
March 23, 2006 07:17 PM
HopeDagger
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.
March 23, 2006 11:33 PM
Sir Sapo
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]
March 23, 2006 11:42 PM
Stompy9999
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.
March 24, 2006 07:14 AM
........................................
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 ;)
March 25, 2006 03:48 PM
Stompy9999
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.
March 25, 2006 04:50 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement