Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
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
2 registered members (AndrewAMD, 1 invisible), 631 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
lorikob361, LucasJoshua, Baklazhan, Hanky27, firatv
19054 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Array funtions in lite-C #337914
08/14/10 12:58
08/14/10 12:58
Joined: Jul 2010
Posts: 127
Germany, Herford
Ditje Offline OP
Member
Ditje  Offline OP
Member

Joined: Jul 2010
Posts: 127
Germany, Herford
In my game, I want to know how much enemies exist at different times. Of course, I can use a counter var and check this. But I have an array of enemies => enemy[80]. So I would like to check my enemies like this:

if(array_length(enemy) == 20) DO SOMETHING
if(array_length(enemy) == 0) DO ANYTHING

This would only work if

ent_remove(enemy[15]);

will delete enemy[15], too.

Gets enemy[15] deleted or is it still extisting with value NULL?

I haven`t found anything about array functions in the manual. Are there none?

Ditje

Re: Array funtions in lite-C [Re: Ditje] #337915
08/14/10 13:01
08/14/10 13:01
Joined: May 2007
Posts: 2,043
Germany
Lukas Offline

Programmer
Lukas  Offline

Programmer

Joined: May 2007
Posts: 2,043
Germany
No, you'd have to set enemy[15] to NULL manually.

But I think using an array is not a good idea for that purpose anyway. Better use a linked list.

Re: Array funtions in lite-C [Re: Lukas] #337916
08/14/10 13:04
08/14/10 13:04
Joined: Aug 2000
Posts: 1,140
Baunatal, Germany
Tobias Offline

Moderator
Tobias  Offline

Moderator

Joined: Aug 2000
Posts: 1,140
Baunatal, Germany
For a counter of enemies, set one of the entity skills to a unique enemy value, and then use an ent_next loop to count all entities that have that skill set. This is much easier done than complicated array handling.

Re: Array funtions in lite-C [Re: Tobias] #337918
08/14/10 13:23
08/14/10 13:23
Joined: Jul 2010
Posts: 127
Germany, Herford
Ditje Offline OP
Member
Ditje  Offline OP
Member

Joined: Jul 2010
Posts: 127
Germany, Herford
Since I often work with databases, I`m really firmed with array and I like them. But no problem - I will take another way to rome laugh

Thx

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