Creating ENTITIES ?

Posted By: dracula

Creating ENTITIES ? - 01/31/09 18:38

In the manual it talks of 3 methods, ENTITY* which looks like a structure definition, code using ent_create() which is the one I have used and loading via WED.

Can you please explain when I would use ENTITY* rather than ent_create()

The manual misses this obvious question frown

Thanks
Posted By: Xarthor

Re: Creating ENTITIES ? - 01/31/09 18:40

You use ENTITY* to create a pointer for an entity which can be used then in code to identify it.
Example:
Code:
ENTITY* myPlayerEnt;
...
myPlayerEnt = ent_create(...);


You can also create screen entities using the ENTITY* statement. This is what is described in the manual.
Posted By: dracula

Re: Creating ENTITIES ? - 01/31/09 18:55

ENTITY* shotgun_onscreen =
{
type = "shotgun.mdl";
layer = 2; // display above view entities with layer 1
flags = VISIBLE;
flags2 = VISIBLE; // visible on screen from the start client_id = camera; // same camera parameters as the default view
x = 100; // place 100 quants ahead of the view
y = -50; // 50 to the right
z = 0; //

as opposed to

ent_create( ....);

What's the difference ?

drac.
Posted By: Kaizen_31

Re: Creating ENTITIES ? - 01/31/09 18:57

use ENTITY* for some pointers when you create a pointer like when you creating a panel

example
ENTITY* sky =
{
......
}

but when you use ent_create(x,y,vector,action);
thats the time when you place the character that you made
hmm..

hope that helps you..

Kaizen_31
Posted By: Xarthor

Re: Creating ENTITIES ? - 01/31/09 18:57

As I said:
ent_create creates a WORLD-ENTITY (in world space)

the example you posted defines an SCREEN-ENTITY which lives on coordinates relative to the camera's position.
Posted By: dracula

Re: Creating ENTITIES ? - 01/31/09 19:02

Thank you so much, sometimes I can be quite stupid. It is now clear to me.

The manual is very good but unlike C++, we only have one source of official information and if you don't understand it you are lost sometimes

Thanks

drac.
© 2023 lite-C Forums