Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / DBC - Extremely Annoying Array Problem!

Author
Message
UFO
19
Years of Service
User Offline
Joined: 11th Oct 2005
Location:
Posted: 4th Feb 2006 20:53
GRRR....

Ok, I am making a horizontal shooter, but there are some array problems that don't make any sense.




Ok, the things that are related to the problem are marked with <<<<<<s. The problem is is that almost everywhere PlayerBullet(I,3) is located, it says array is accessed out of bounds. I know I don't want you to have to go through all of it, so here are the things that might need looking at:

*The Dim section at the top.
*The functions: Move_Player_Bullets, PShoot, and Player_Shoot.

Please help . It would be GREATLY appreciated.


Hippopotomonstrosesquippedaliophobia-Fear of long words

Attachments

Login to view attachments
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 4th Feb 2006 23:35
I don't get an array problem. I do however get an "object doesn't exist" error because you need to add 499 to "I" in "zrotate object I,PlayerBullet(I,3)" (the Move_Player_Bullets function).


UFO
19
Years of Service
User Offline
Joined: 11th Oct 2005
Location:
Posted: 5th Feb 2006 03:49
Thanks for spotting that error It still has that array problem though.
I still don't understand why it has that problem on my computer, but not on yours...


Hippopotomonstrosesquippedaliophobia-Fear of long words
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 5th Feb 2006 05:09
Sorry... I ran that in Pro and not Classic. It works fine in Pro but apparently Classic doesn't like: "Dim PlayerBullet(MPB(0),4)". If you just change it to "Dim PlayerBullet(49,4)" it'll work.


hexGEAR
22
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Naytonia
Posted: 5th Feb 2006 05:13
Not sure myself but try changing all those arrays like Dim MPB(0) into Dim MPB(1) or just use normal variables since your only storing single values.

UFO
19
Years of Service
User Offline
Joined: 11th Oct 2005
Location:
Posted: 5th Feb 2006 22:08
YES!!!! Thanks alot, Grog Grueslayer!!!!!
You were right.

hexGEAR - Thanks for the suggestion, but arrays with (0) (Used for global variables) work fine. Thanks though

THANKS FOR THE HELP


Hippopotomonstrosesquippedaliophobia-Fear of long words
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 6th Feb 2006 02:36
Np.


Login to post a reply

Server time is: 2025-05-23 11:00:55
Your offset time is: 2025-05-23 11:00:55