Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Day 3: success

Sign in to follow this  


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.
Sign in to follow this  


Recommended Comments

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.

Share this comment

Link to comment
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

Share this comment

Link to comment
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]

Share this comment

Link to comment
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.

Share this comment

Link to comment
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]

Share this comment

Link to comment
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.

Share this comment

Link to comment
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 ;)

Share this comment

Link to comment
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.

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!