Flash Games

 FAQ   Search   Members   Groups   Register  User Control Panel      Login 

Your time now:
Mon Nov 23, 2009 8:24 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 2 posts ]  Bookmark and Share
Author Message
 Post subject: Projectiles
PostPosted: Sun Aug 16, 2009 4:29 pm 
Offline
50+ Club
User avatar

Joined: Tue Mar 27, 2007 2:07 pm
Posts: 73
Location: St Helens, England
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[loop][0]
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 =/

_________________
Image


Top
 Profile  
 
 Post subject: Re: Projectiles
PostPosted: Mon Aug 17, 2009 6:22 pm 
Offline
50+ Club
User avatar

Joined: Tue Mar 27, 2007 2:07 pm
Posts: 73
Location: St Helens, England
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[50][50];

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[MAX_BULLETS];


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[smallLoop][0]
with : everyProjectile[smallLoop].onoff

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

_________________
Image


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group - Flash Games - TNX Invitation Code - TNX Review


Webmaster - Excruciating - Johnathan - Kotik - Ash - Tomi - rangana - Phate - dflynn - Medley