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.

Newcomers DBPro Corner / Arrays -- Having trouble implementing them into my game maker - Please Help

Author
Message
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 1st May 2005 05:38
I've been working on a game maker for quite some time now and I've been experimenting with ways of creating exe's from the main exe. I had one way but it got screwed...so I am using arrays now. Here's how I would *like* the array part to work...
1. User creates their map bu drag-and-dropping their desired boxes.
2. When the user is happy with their map and feels like testing it, they press the "test" button and their game is opened.
3. If the user wants to just go into their program files and click on their game exe without opening the game maker, they can do so.

Array part

4. An array is created with the x coordinates of every object the user has added to the map, and another array is created with the z coordinates of every object the user has added to the map. The y coordinates dont matter at the moment.

5. Then, a savefile is created, and the arrays are saved to it. Then another save file is created and the user's position and other variables are saved to that one. I cant use the same savefile because arrays need to be saved into .arr and variables need to go into .dat...I think.

6. If the user clicks the exe from their program files, the program checks if the savefiles exist. If they do, it loads them and positions everything accordingly, if not it just loads up the game maker..

The only part of all of that that I cant get working is the array part, the objects keep getting located at 0,0,0.

Heres the saving code with the arrays:

And the loading code with the arrays:


The part that isnt working is the sections seperated from the...other sections. The sections with the `` around them.
You can ignore all the other code not in the `` area, it works fine. I just need to know why it isn't finding the values in the arrays and doing...what I tell it to. Sorry if the code is really messy I've been adding/removing lots of things to try and get this to work so thats why its all jumbled up.

Thanks for any help in advance,
RUCCUS.

P.S The loading part is before the do/loop and the saving part is in the do/loop.

RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 1st May 2005 16:59
Here's the problem:

FOR i = 2 to OBJ# STEP 1
DIM OBJX(OBJ#)
OBJX(RAYNUM)=OBJECT POSITION X(i)
DIM OBJZ(OBJ#)
OBJZ(RAYNUM)=OBJECT POSITION Z(i)

Every time in that loop that Dim OBJX() or Dim OBJZ() is executed, the entire array (respectively) is deleted. Dim statements usually go at the very beginning of a code to both reserve the array memory and prevent this sort of problem.

"Droids don't rip your arms off when they lose." -H. Solo
REALITY II

Login to post a reply

Server time is: 2024-09-23 19:26:16
Your offset time is: 2024-09-23 19:26:16