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
removing entities #353873
01/13/11 17:52
01/13/11 17:52
Joined: Nov 2009
Posts: 8
E
ery Offline OP
Newbie
ery  Offline OP
Newbie
E

Joined: Nov 2009
Posts: 8
I want to know how to remove already collected subjects from the level at its repeated visiting, not using game_save.
Tried to use level_mark()/level_free(), but they give me only errors.
Please add any code if you can.

Re: removing entities [Re: ery] #354009
01/14/11 18:30
01/14/11 18:30
Joined: Jan 2011
Posts: 120
United States
Logan Offline
Member
Logan  Offline
Member

Joined: Jan 2011
Posts: 120
United States
It's possible with a couple solutions. My first question is, how are these subjects being "collected"? You could keep an internal list of everything that has already been collected, and then upon loading the level, each entity checks if it is on that list, and if so, it removes itself.

Re: removing entities [Re: Logan] #354021
01/14/11 19:29
01/14/11 19:29
Joined: Nov 2009
Posts: 8
E
ery Offline OP
Newbie
ery  Offline OP
Newbie
E

Joined: Nov 2009
Posts: 8
You mean to use vars? It's not the way, because there are a lot of subjects of the same type (like lives) and it'll be very hard to have so many variables to put them into the list. I use event_impact and one action for them all.

Re: removing entities [Re: ery] #354037
01/14/11 21:35
01/14/11 21:35
Joined: Apr 2010
Posts: 172
W
wdlmaster Offline
Member
wdlmaster  Offline
Member
W

Joined: Apr 2010
Posts: 172
you just need one (1) array for every item type.
Code:
char coins[1000];
char lives[40];
char OtherCoolItemHere[7];
...


But every item must hold a unique identifier - use a skill for that. When an item is collected the first time, it simply sets the corresponding variable (in the array) to 1.
Code:
if (vec_dist(my.x,player.x) < 32) {coins[my.skill8] = 1;ent_remove (me);}


When the level is loaded, the item checks everytime, if the variable is 1 or 0.
Code:
void coin() {
   if coins[my.skill8] ent_remove (me);
   ...
   ... }


Again: You must make sure, that every item has a unique ID.

Re: removing entities [Re: wdlmaster] #354097
01/15/11 17:06
01/15/11 17:06
Joined: Nov 2009
Posts: 8
E
ery Offline OP
Newbie
ery  Offline OP
Newbie
E

Joined: Nov 2009
Posts: 8
Void gives me errors. Probably it's used in Lite-C, but I work in C-Script. Must I use only void()?

Re: removing entities [Re: ery] #354100
01/15/11 17:34
01/15/11 17:34
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
For C-Script, replace
void coin() {
with
function coin() {


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: removing entities [Re: Superku] #354103
01/15/11 18:31
01/15/11 18:31
Joined: Nov 2009
Posts: 8
E
ery Offline OP
Newbie
ery  Offline OP
Newbie
E

Joined: Nov 2009
Posts: 8
Thanks you, guys!!


Moderated by  HeelX, Spirit 

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