Slick Forums

Discuss the Slick 2D Library
It is currently Fri Feb 28, 2020 3:45 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Deleting entity.
PostPosted: Sun Feb 10, 2013 10:08 pm 
Offline

Joined: Tue Sep 18, 2012 5:57 pm
Posts: 4
Hi. I have a problem, when a certain event occurs, i have an entity deleted from the world. The problem is, that using e.deleteFromWorld() or world.deleteEntity(e) the entity is still being processed by my systems. What am I doing wrong?


Top
 Profile  
 
 Post subject: Re: Deleting entity.
PostPosted: Mon Feb 11, 2013 1:56 am 
Offline
Game Developer
User avatar

Joined: Tue Nov 21, 2006 4:46 am
Posts: 620
Location: Iceland
Deleting an entity only adds it to a list of entities that should be deleted at the end of the current game loop iteration.

So if you have 4 systems running in order 1, 2, 3 and 4, deleting entity in system 2 will still make the entity valid for systems 3 and 4.

For most games this is enough, but it is true, in some cases you don't want to process deleted entities.


Top
 Profile  
 
 Post subject: Re: Deleting entity.
PostPosted: Tue Feb 12, 2013 11:50 am 
Offline

Joined: Tue Sep 18, 2012 5:57 pm
Posts: 4
I actually thought of that, so I made the system independent from the world.process, and call it at the end of my render loop (on libgdx), but the problem persist. Does artemis behave as if the end of the game loop is the last processed system on the world.process?


Top
 Profile  
 
 Post subject: Re: Deleting entity.
PostPosted: Tue Feb 12, 2013 8:46 pm 
Offline
Game Developer
User avatar

Joined: Tue Nov 21, 2006 4:46 am
Posts: 620
Location: Iceland
Artemis "takes care of business" at beginning of each game loop, before systems process.

You can check if the entity is "active" to see if it's been deleted.


Top
 Profile  
 
 Post subject: Re: Deleting entity.
PostPosted: Wed Feb 13, 2013 12:12 pm 
Offline

Joined: Tue Sep 18, 2012 5:57 pm
Posts: 4
Thank you. That solved my problem.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group