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 / Saving multiple object positions...?

Author
Message
retardnewb17
12
Years of Service
User Offline
Joined: 6th Oct 2011
Location:
Posted: 21st Jul 2012 14:43
When im making a "save" to my game if there is like 100 objects, and I need to save all of their positions... Is there any better way to do it than this?

write float 1,Obj1positionX#
write float 1,Obj1positionY#
write float 1,Obj1positionZ#
write float 1,Obj2positionX#
write float 1,Obj2positionY#
write float 1,Obj2positionZ#
...
...All the way to object number 100.
Plz help me!
nonZero
12
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 22nd Jul 2012 00:10
Something along these lines:


In this example we used a two-dimensional array. It's a little like those rows and columns on an excel spreadsheet. So you have three columns; x, y, z. You have as many rows as you have number of objects. I could've nested another FOR-loop inside this one, but for three statements, it wasn't worth it.

Login to post a reply

Server time is: 2024-04-18 12:16:22
Your offset time is: 2024-04-18 12:16:22