Search found 85 matches
- Mon Mar 12, 2012 8:39 pm
- Forum: Programming Discussion
- Topic: Beginner C++ helppp
- Replies: 11
- Views: 2294
Re: Beginner C++ helppp
When using any control statement in c++ (if, else, while etc.) never put a semicolon (;) after the statement. The control statement affects only what comes directly after it. If you want to affect more then 1 line, you need to put the code in a code block ({..}). if (randomNumberGuess > randomGenera...
- Tue Jan 10, 2012 11:41 am
- Forum: Game Development
- Topic: AABB Collision Detection And Response [TUTORIAL]
- Replies: 11
- Views: 5315
Re: AABB Collision Detection And Response [TUTORIAL]
I have a question.. I'm currently working on a tile based side-scroller.. The collision detection I'm using now is terrible, I just move the player/mob/item 1 pixel for each frame, and check for collision with solids in their area. If a collision is detected, I simply move them 1 pixel back... I've ...
- Tue Jan 10, 2012 10:55 am
- Forum: Game Development
- Topic: AABB Collision Detection And Response [TUTORIAL]
- Replies: 11
- Views: 5315
Re: AABB Collision Detection And Response [TUTORIAL]
Let me make this easy for you. Assuming the position (x,y) is the center of the object, you want to check if the distance between the centers is less than the sum of the half-widths for both the x and y axis. int deltax = abs(b->x - a->x); int deltay = abs(b->y - a->y); if(deltax < (a->w / 2 + b->w...
- Tue Jan 10, 2012 8:37 am
- Forum: Game Development
- Topic: AABB Collision Detection And Response [TUTORIAL]
- Replies: 11
- Views: 5315
Re: AABB Collision Detection And Response [TUTORIAL]
Wait, I still didn't get it, what about this condition? :
- Tue Jan 10, 2012 8:23 am
- Forum: Game Development
- Topic: AABB Collision Detection And Response [TUTORIAL]
- Replies: 11
- Views: 5315
Re: AABB Collision Detection And Response [TUTORIAL]
Thanks for the tutorial, its been very helpful! I have a question though.. When you showed the simple way to find collision: bool Eternal::IsCollision(Rectangle *a, Rectangle *b) { if ( a->x + b->w > b->x && a->x - b->w < b->x && a->y + b->h > b->y && a->y - b->h < b->y ) { ...
- Tue Jan 10, 2012 5:31 am
- Forum: Game Development
- Topic: AABB Collision Detection And Response [TUTORIAL]
- Replies: 11
- Views: 5315
Re: AABB Collision Detection And Response [TUTORIAL]
Thanks for the tutorial, its been very helpful! I have a question though.. When you showed the simple way to find collision: bool Eternal::IsCollision(Rectangle *a, Rectangle *b) { if ( a->x + b->w > b->x && a->x - b->w < b->x && a->y + b->h > b->y && a->y - b->h < b->y ) { r...
- Thu Jan 05, 2012 7:31 am
- Forum: Programming Discussion
- Topic: base class undefined error. Please help!
- Replies: 14
- Views: 2440
Re: base class undefined error. Please help!
Holy shit! Debugging must be a nightmare!
- Wed Jan 04, 2012 3:18 pm
- Forum: Programming Discussion
- Topic: base class undefined error. Please help!
- Replies: 14
- Views: 2440
Re: base class undefined error. Please help!
Well, so far my projects have been quite small, so I didn't know build times were an issue, lol.
- Wed Jan 04, 2012 2:56 pm
- Forum: Programming Discussion
- Topic: base class undefined error. Please help!
- Replies: 14
- Views: 2440
Re: base class undefined error. Please help!
How about making two global header files: one that contains forward declaration for all classes, and one that contains the header files for all classes. Then you could simply include the first header in every header file, and the second header in every cpp file. Is it a waste to declare all classes ...
- Wed Jan 04, 2012 2:38 pm
- Forum: Programming Discussion
- Topic: base class undefined error. Please help!
- Replies: 14
- Views: 2440
Re: base class undefined error. Please help!
lol, I'm such an idiot.. I don't know why, but I always had this idea stuck to my head, that every cpp file should include only its own header, and any additional headers it needs should be included only in the header.. Never realized how stupid it is that every definition of a class needs to carry ...
- Wed Jan 04, 2012 1:14 pm
- Forum: Programming Discussion
- Topic: base class undefined error. Please help!
- Replies: 14
- Views: 2440
Re: base class undefined error. Please help!
Wow, I didn't know it was possible... How can a specific cpp file know what function/data a certain class holds without having the declaration of the class? And also, won't the #define LEVEL_H prevent the the include cycling? I'v tried doing what you've said, and it gave me an error for every line i...
- Wed Jan 04, 2012 10:39 am
- Forum: Programming Discussion
- Topic: base class undefined error. Please help!
- Replies: 14
- Views: 2440
base class undefined error. Please help!
Hi everyone! I'm working on my own little platformer type game (using c++ and sdl). Currently, the engine i'v made can load a level from a file, and you can go around the level , there is collision detection, and a simple camera system, so all i need to add now are mobs, items, and a score system. I...
- Wed Sep 08, 2010 8:43 am
- Forum: Game Development
- Topic: What now?
- Replies: 3
- Views: 983
Re: What now?
Thanks, i'll try those
- Wed Sep 08, 2010 8:06 am
- Forum: Game Development
- Topic: What now?
- Replies: 3
- Views: 983
What now?
Hi everybody. I'v been learning c++ and sdl. So, now i know c++ (more or less...), i know classes pointers functions etc. I also know sdl - surfaces, event handling etc. What now? I still don't really know how to create a simple 2d game. I only know how to draw things on the screen, and i need to im...
- Wed Jun 09, 2010 6:13 am
- Forum: Programming Discussion
- Topic: question how to proceed
- Replies: 2
- Views: 461
Re: question how to proceed
While you're still learning, it probably doesn't matter that much. The more you practise, and the more you come to terms with design and OOP, the better you will get at this. Whenever I want to know the proper way of doing something, I usually look around the web or at other peoples' source and see...