Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
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
4 registered members (degenerate_762, AbrahamR, AndrewAMD, ozgur), 667 guests, and 8 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
very basic question about ent_create and funcitons #336846
08/06/10 15:40
08/06/10 15:40
Joined: Jul 2010
Posts: 127
Germany, Herford
Ditje Offline OP
Member
Ditje  Offline OP
Member

Joined: Jul 2010
Posts: 127
Germany, Herford
I am rewriting some functions, to have a cleaner code and a faster game. I`ve got adviced, to preload my entities and instead of ent_remove, I should just hide the entities. Ok - enties got loaded and here are my first problems laugh

Code:
var epos[40][3];
var enemy[80];
...
	// Positionen Welle 3
	epos[16][0] = -165;   epos[16][1] = 800;  epos[16][2] = 270;
...
// Welle 3
	for(i=16; i<24; i++)
	{
		enemy[i] = ent_create("bee2.mdl", vector(epos[i][0], -epos[i][1], epos[i][2]), enemy_attack); 
	}
...



1.) I can`t call ENTITY like enemy[16].y=800; - error
2.) Instead of "enemy_attack" I want to create ENTITY without a function(NULL), because I don`t want the engine run through functions, if it`s not nessesary. But how can I point to my entities?

I need something with "me" laugh

THX

Ditje

Last edited by Ditje; 08/06/10 15:42.
Re: very basic question about ent_create and funcitons [Re: Ditje] #336848
08/06/10 16:00
08/06/10 16:00
Joined: Mar 2002
Posts: 1,774
Magdeburg
F
FlorianP Offline
Serious User
FlorianP  Offline
Serious User
F

Joined: Mar 2002
Posts: 1,774
Magdeburg
This would be the correct syntax.
Code:
ENTITY* enemy[80];



Anyway, not removing the entities is inadvisable in most cases.
Either they are just not visible or they can be removed. Just hiding them would be only in very special cases more efficent as its renders the Objectoriented-Programming model useless.

Use ent_preload() to store the models in memory. Any other approach would most likely cause more cpu-time and way more hustle.

Last edited by FlorianP; 08/06/10 16:02.

I <3 LINQ
Re: very basic question about ent_create and funcitons [Re: FlorianP] #336855
08/06/10 16:26
08/06/10 16:26
Joined: Jul 2010
Posts: 127
Germany, Herford
Ditje Offline OP
Member
Ditje  Offline OP
Member

Joined: Jul 2010
Posts: 127
Germany, Herford
Ah yes I forgot the ENITY*

Hmm and now I am not sure any more laugh There will be several different bonus stages later. If I hide them (behind the player) there will be about 200 unused entities. That`s why I don`t wanted to call them with a function.

I thought only the .mdl file gets loaded. That happens already in the startscreen.

Ditje


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