JOIN DEVPPL

It looks like you are new here. If you want to get involved, click on Join below!



Projectiles


I

keyboard_arrow_up
0
keyboard_arrow_down


First Post Mark as Spam instinct46
Posts: 92 - Registered: 2007-03-27 08:07:09

I'm in the middle of creating projectiles in a few games, and as far I can tell it should be working but its not

I've created a two dimensional int array, with 5 colomns and 100rows more than enough for what I want.
col 1 = is it use or not
col 2 = x location
col 3 = y location
col 4 = x movement, this can be a minus or positive number
col 5 = y movement, same as above

Right when my player presses the space key, the program loop and checks array
and check for the first one which is equal to zero (not in use).

Once a projectile collides with something or goes of the screen I zero it attributes, to make it well not in use.

Yet for some reason after its fired to what I can only presume to be 100 due its max, it either doesn't work or sometimes works but sends the projectiles on a random reappearing act on the screen =/

I suppose what my question really is, am I using the two dimensional array for something it will never be able to handle?? and has anyone got any ideas on how to create an alternative table??

O just to note as well have created a two dimensional pointer array and that never worked either =/




I

keyboard_arrow_up
0
keyboard_arrow_down


Reply #1 Mark as Spam instinct46
Posts: 92 - Registered: 2007-03-27 08:07:09

I have worked my little problem above, and am just writing just post how I did it just encase anyone else gets a similar problem.

Instead of using a two dimensional array:

int myArray;

I created an array of a structure I built:

struct projectiles{
int onoff;
int x;
int y;
int xm
int ym;
int width;
int height;
} everyProjectile;

So them I could still use all my equations, I just had to replace all:
with smallLoop being a int I was using along side my for(loops)

replace: myArray
with : everyProjectile.onoff

I still have no idea why the 2Darray never worked but mneh






JOIN DEVPPL

It looks like you are new here. If you want to get involved, click on Join below!




MENU
Advertising