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 (AndrewAMD, alibaba), 1,184 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
create one struct child of ENTITY #156168
09/21/07 20:52
09/21/07 20:52
Joined: Aug 2006
Posts: 78
A
amadeu Offline OP
Junior Member
amadeu  Offline OP
Junior Member
A

Joined: Aug 2006
Posts: 78
Hallo

I would like to create one struct child of ENTITY because I want to create more parameters in the ENTITY.
I tryed create this struct but did nor work:
typedef struct OBJECTS {
var number;
char *node;
struct ENTITY* parent;
} OBJECTS;

Some body could help me?

Re: create one struct child of ENTITY [Re: amadeu] #156169
09/21/07 22:04
09/21/07 22:04
Joined: Jan 2006
Posts: 1,829
Neustadt, Germany
T
TWO Offline

Serious User
TWO  Offline

Serious User
T

Joined: Jan 2006
Posts: 1,829
Neustadt, Germany
typedef struct
{
var number;
char *node;
ENTITY* parent;
} OBJECTS;

Re: create one struct child of ENTITY [Re: TWO] #156170
09/22/07 08:17
09/22/07 08:17
Joined: Aug 2006
Posts: 78
A
amadeu Offline OP
Junior Member
amadeu  Offline OP
Junior Member
A

Joined: Aug 2006
Posts: 78
hi

I created this struct but the follow code did not work becouse my Struct did not inherit from ENTITY: I would like tho create one struct with more parameters from Entity struct.
typedef struct
{
var number;
char *node;
ENTITY* parent;
} OBJECTS;

OBJECTS* av1;
void main()
{
video_mode = 7;
video_screen = 2;
level_load("VAH.wmb");
wait(2);
av1 = ent_create("av2all.mdl", vector(-175,101,0), NULL);
av1.number = 1;
av1.pan = 180; /// donīt work /////
}

the error said " pan is not a member from OBJECTS"

What is wrong in my code?

Re: create one struct child of ENTITY [Re: amadeu] #156171
09/22/07 08:42
09/22/07 08:42
Joined: Jan 2006
Posts: 1,829
Neustadt, Germany
T
TWO Offline

Serious User
TWO  Offline

Serious User
T

Joined: Jan 2006
Posts: 1,829
Neustadt, Germany
There's no native inherition in Lite-C, you have to use sth like this:

Code:

typedef struct
{
var number;
char *node;
ENTITY* parent;
} OBJECTS;

OBJECTS* av1;
void main()
{
video_mode = 7;
video_screen = 2;
level_load("VAH.wmb");

wait(2);

av1 = new(OBJECTS); // Reserve memory for the struct

av1.parent = ent_create("av2all.mdl", vector(-175,101,0), NULL);
av1.number = 1;
av1.parent.pan = 180;
}



Re: create one struct child of ENTITY [Re: TWO] #156172
09/22/07 08:53
09/22/07 08:53
Joined: Aug 2006
Posts: 78
A
amadeu Offline OP
Junior Member
amadeu  Offline OP
Junior Member
A

Joined: Aug 2006
Posts: 78
Hi

There is one problem:

av1 = new(OBJECTS); // Reserve memory for the struct

The "new" function did not work.

How is the code for "new" function?

Re: create one struct child of ENTITY [Re: amadeu] #156173
09/22/07 08:57
09/22/07 08:57
Joined: Jan 2006
Posts: 1,829
Neustadt, Germany
T
TWO Offline

Serious User
TWO  Offline

Serious User
T

Joined: Jan 2006
Posts: 1,829
Neustadt, Germany

Re: create one struct child of ENTITY [Re: TWO] #156174
09/22/07 09:11
09/22/07 09:11
Joined: Aug 2006
Posts: 78
A
amadeu Offline OP
Junior Member
amadeu  Offline OP
Junior Member
A

Joined: Aug 2006
Posts: 78
Ok

thx,

It works.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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