Yes, that is fine because of the built-in garbage collector. It'll make sure that everything is destroyed properly even in the scenario you describe.

Kind regards,

Philip Bennefall
----- Original Message ----- From: "john" <jpcarnemo...@comcast.net>
To: <phi...@blastbay.com>; "Gamers Discussion list" <gamers@audyssey.org>
Sent: Friday, August 23, 2013 11:18 PM
Subject: Re: [Audyssey] looking for some programming help


I'm wondering if it's safe to remove an object from an array, if
the command to do so comes from within the object itself. I.e:
if(health<=0)//if this ship dies
{
ships.remove_at(number);//remove the correct ship from the array
}
----- Original Message -----
From: Philip Bennefall <phi...@blastbay.com
To: Gamers Discussion list <gamers@audyssey.org
Date sent: Fri, 23 Aug 2013 23:13:13 +0200
Subject: Re: [Audyssey] looking for some programming help

I am not quite sure what you mean by destruction method. If you
mean the
destructor, that will actually be called automatically once the
object goes
out of scope or is destroyed after a call to remove_at,
remove_last, or
resize for that matter if resize is given an argument lower than
the current
number of elements in the array. So you never need to worry about
explicitly
calling object destructors.

Kind regards,

Philip Bennefall
----- Original Message -----
From: "john" <jpcarnemo...@comcast.net
To: <phi...@blastbay.com>; "Gamers Discussion list"
<gamers@audyssey.org
Sent: Friday, August 23, 2013 11:09 PM
Subject: Re: [Audyssey] looking for some programming help


Is it alright for the object being destroyed to call the
destruction method?

----- Original Message -----
From: Philip Bennefall <phi...@blastbay.com
To: Gamers Discussion list <gamers@audyssey.org
Date sent: Fri, 23 Aug 2013 22:33:57 +0200
Subject: Re: [Audyssey] looking for some programming help

Then I recommend looking at the methods that I mentioned in the
array class.
They can remove an item either from the end of the array in the
case of
remove_last, or from any arbitrary position in the case of
remove_at.

Kind regards,

Philip Bennefall
----- Original Message -----
From: "john" <jpcarnemo...@comcast.net
To: <phi...@blastbay.com>; "Gamers Discussion list"
<gamers@audyssey.org
Sent: Friday, August 23, 2013 10:32 PM
Subject: Re: [Audyssey] looking for some programming help


I'm using bgt.

----- Original Message -----
From: Philip Bennefall <phi...@blastbay.com
To: Gamers Discussion list <gamers@audyssey.org
Date sent: Fri, 23 Aug 2013 22:26:14 +0200
Subject: Re: [Audyssey] looking for some programming help

What language are you using? If it is BGT, the array class has
methods such
as remove_last, remove_at etc which will do what you want. Other
programming
languages have equivalent containers, such as C++ vector or list.

Kind regards,

Philip Bennefall
----- Original Message -----
From: "john" <jpcarnemo...@comcast.net
To: "Gamers Discussion list" <gamers@audyssey.org
Sent: Friday, August 23, 2013 10:22 PM
Subject: Re: [Audyssey] looking for some programming help


Basically, I've written a class ship, and declared an array of
them; one for friendly and one for enemy. I'd like to know how I
can make the ship disappear when it's destroyed.

----- Original Message -----
From: Cara Quinn <caraqu...@caraquinn.com
To: Gamers Discussion list <gamers@audyssey.org
Date sent: Fri, 23 Aug 2013 13:15:17 -0700
Subject: Re: [Audyssey] looking for some programming help

Hi John,

How are you adding your entities into the game? Do that in
reverse. :)

I'm actually not trying to be snarky here, :) I just can't give
you a better answer until I know both the language you're using
and your method for creating your entities in the first place.
Know what I mean?

If you can send along a bit more detail I can give you a better
answer. Essentially though, you want to nullify your entities.
-Return everything about them to the state they were in before
you created them. Depending on your language, this may be
deleting them, setting them to nil, reseting variables about
them. etc. Also, if you want to keep them around for reference
but not have them actually in the game, you can do that too.

If you'd like to send more detail, then please do. :)

Have a great day!

Smiles,

Cara :)
---
View my Online Portfolio at:

http://www.onemodelplace.com/CaraQuinn

Follow me on Twitter!

https://twitter.com/ModelCara

On Aug 23, 2013, at 12:33 PM, john <jpcarnemo...@comcast.net
wrote:

Hi all,
I've finally gotten the general infrastructure of a game
started, but I've run into an issue with my enemy class. Namely,
once the enemy is defeated, I have no idea how to remove it from
the game. Could anybody give me some examples of how you handle
removing ememies and items from play?

Thanks,
John.

---
Gamers mailing list __ Gamers@audyssey.org
If you want to leave the list, send E-mail to
gamers-unsubscr...@audyssey.org.
You can make changes or update your subscription via the web, at
http://audyssey.org/mailman/listinfo/gamers_audyssey.org.
All messages are archived and can be searched and read at
http://www.mail-archive.com/gamers@audyssey.org.
If you have any questions or concerns regarding the management of
the list,
please send E-mail to gamers-ow...@audyssey.org.


---
Gamers mailing list __ Gamers@audyssey.org
If you want to leave the list, send E-mail to
gamers-unsubscr...@audyssey.org.
You can make changes or update your subscription via the web, at
http://audyssey.org/mailman/listinfo/gamers_audyssey.org.
All messages are archived and can be searched and read at
http://www.mail-archive.com/gamers@audyssey.org.
If you have any questions or concerns regarding the management of
the list,
please send E-mail to gamers-ow...@audyssey.org.

---
Gamers mailing list __ Gamers@audyssey.org
If you want to leave the list, send E-mail to
gamers-unsubscr...@audyssey.org.
You can make changes or update your subscription via the web, at
http://audyssey.org/mailman/listinfo/gamers_audyssey.org.
All messages are archived and can be searched and read at
http://www.mail-archive.com/gamers@audyssey.org.
If you have any questions or concerns regarding the management of
the list,
please send E-mail to gamers-ow...@audyssey.org.


---
Gamers mailing list __ Gamers@audyssey.org
If you want to leave the list, send E-mail to
gamers-unsubscr...@audyssey.org.
You can make changes or update your subscription via the web, at
http://audyssey.org/mailman/listinfo/gamers_audyssey.org.
All messages are archived and can be searched and read at
http://www.mail-archive.com/gamers@audyssey.org.
If you have any questions or concerns regarding the management of
the list,
please send E-mail to gamers-ow...@audyssey.org.


---
Gamers mailing list __ Gamers@audyssey.org
If you want to leave the list, send E-mail to
gamers-unsubscr...@audyssey.org.
You can make changes or update your subscription via the web, at
http://audyssey.org/mailman/listinfo/gamers_audyssey.org.
All messages are archived and can be searched and read at
http://www.mail-archive.com/gamers@audyssey.org.
If you have any questions or concerns regarding the management of
the list,
please send E-mail to gamers-ow...@audyssey.org.


---
Gamers mailing list __ Gamers@audyssey.org
If you want to leave the list, send E-mail to
gamers-unsubscr...@audyssey.org.
You can make changes or update your subscription via the web, at
http://audyssey.org/mailman/listinfo/gamers_audyssey.org.
All messages are archived and can be searched and read at
http://www.mail-archive.com/gamers@audyssey.org.
If you have any questions or concerns regarding the management of
the list,
please send E-mail to gamers-ow...@audyssey.org.


---
Gamers mailing list __ Gamers@audyssey.org
If you want to leave the list, send E-mail to gamers-unsubscr...@audyssey.org.
You can make changes or update your subscription via the web, at
http://audyssey.org/mailman/listinfo/gamers_audyssey.org.
All messages are archived and can be searched and read at
http://www.mail-archive.com/gamers@audyssey.org.
If you have any questions or concerns regarding the management of the list,
please send E-mail to gamers-ow...@audyssey.org.

Reply via email to