Multidimensional

Posted by Firebird on Oct. 21, 2006, 1:50 a.m.

If you've been looking for me over the past few days: don't worry. I've been playing Deus Ex, and owning, mind you. I started a new game and soon I was up to the PRCS Wall Cloud level.

I've also been fooling around with C++, and making a platformer as a side-project. there's just one piece of code that seems right… but isn't. It's my collision-checking code, and it checks x values and y values against each other to see if there is a collision. Now, whenever I run the game, I always get the "COLLISION!" notice. It's definitely an error in the code, but where?

//Collision checking -
		  
if( ((circle_y+5) > platform_y1) && ((circle_y+5) < platform_y2) && ((circle_x+5) < platform_x2) && ((circle_x-5) > platform_x1) ) {
collision = TRUE;
//Checks if bottom of circle is in a collision with platform, and if the circle x is inside the platform x
}
if( ((circle_y-5) < platform_y2) && ((circle_y-5) > platform_y1) && ((circle_x+5) < platform_x2) && ((circle_x-5) > platform_x1) ) {
collision = TRUE;
//checks if top of circle is in a collision with platform, and if the circle x is inside the platform x
}
if(collision = TRUE) {
textprintf_ex(buffer, font, 100, 10, white, -1, "COLLISION!");
}
		  
//End collision checking

I'm also trying to add gravity and jumping, which shouldn't be too hard with a timer variable, or something, I suppose.

Oh yeah, and this game is being made just with primitives, which might remind you of a certain game. I didn't want to have any sprites, you see, because they're all external and they would make the game's size go up bigtime.

Oh, and, does anyone know how to make an array of bitmaps in Allegro?

Keep L337,

Firebird out!

[Multidimensional arrays filled with… string?]

Comments

melee-master 18 years, 1 month ago

Allegro eh?

You should try making a game without that. =D

Firebird 18 years, 1 month ago

I will then.

I'll make one in Irrlicht =P.

Or I'll just hack at the Allegro lib and see the workings.

It just so happens I hate the message handling… but I could get to like it. I wrote a win32 program once… although, it had no purpose.

Evilish 18 years, 1 month ago

use SDL.

or try programming for the GBA, sprites in that are so fun.

imported directly as .h files as constant arrays, they are in 8x8 blocks and for every two bytes there written in reverse.

funtacular

Evilish 18 years, 1 month ago

on a side note, during a small episode of me being convert-happy, I made AckAck work in both Flash and C++/SDL. Cept well, I deleted the sourcecode for both of them.

You'll never have them, mwahahahahahahahaha!.

And you could uh… use SDL for the graphics and GMphysics for the collisions…

Juju 18 years ago

I would be careful about using primitives, they can be kinda slow.