Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (alibaba, vicknick), 1,492 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How to get objects' coordinates? #133308
06/02/07 14:09
06/02/07 14:09
Joined: May 2007
Posts: 16
At the Gates of Midian
Illegitima Offline OP
Newbie
Illegitima  Offline OP
Newbie

Joined: May 2007
Posts: 16
At the Gates of Midian
Hello,
Guys, I have a whole room in MDL. I need to know the coordinates of all objects inside it, so I can separate them, put their coordinates in an XML file and then make the whole level creation much easier and dynamic. Can you please tell me how to get an object's coordinates in MED? I searched the help, and although this looks easy, I couldn't find how to do it.
Thank you in advance!

Re: How to get objects' coordinates? [Re: Illegitima] #133309
06/02/07 16:21
06/02/07 16:21
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
First, you need the pointer to the entity. For this, we'll say the pointer is "you".

Then, it's as simple as:
you.x - you.y - you.z
or
you.pan - you.tilt - you.roll

Here's an example for saving to a file

Code:

string xmlFile = "whatever.XML";
var xmlHandle;

Function saveObject(fHandle, ent)
{
file_var_write(fHandle, ent.x);
file_var_write(fHandle, ent.y);
file_var_write(fHandle, ent.z);
file_var_write(fHandle, ent.pan);
file_var_write(fHandle, ent.tilt);
file_var_write(fHandle, ent.roll);
}

Function saveEntities()
{
xmlHandle = file_open_write(xmlFile);
//
var i = 0;
you = ent_next(i);
while(you)
{
saveObject(you)
you = ent_next(you);
}
//
file_close(xmlHandle);
}



Call saveEntities() to save all of the entities in your level to a file. It won't save them with the XML format, so the extension on your filename doesn't really matter...

good luck, hope I helped...


xXxGuitar511
- Programmer

Moderated by  HeelX, rvL_eXile 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1