Aaron M
03-16-2008, 07:58 PM
I'm making a simple zombie killing game, and want to know how to make an object delete when you click on it. I tried having it set opacity to 0, but the zombie still reaches the camera and ends the game.
lanceA
03-16-2008, 08:52 PM
Are you familiar with placing objects in a List in Alice? Alice's List data structure has methods to remove item from beginning of list, remove item from position <index> of list and remove all items from list. (NOTE: Objects are not removed from the world, only from the List. However after you have removed them from the list you can then set their opacity to 0 to make it appear as though they have been removed from the list.)
If you have several zombies in your animation you can place them in a list data structure and then remove the objects when you need to.
Create your world with its zombies and then click on the world tile in the Object Tree pane. Select properties and then click on the create new variable button. In the create new variable dialog box, enter a name for the list of zombies, such as zombieList. Then select the type of items that will be stored in the list - in your case since we are talking about zombies, the type will be Object. Click on the area at the bottom of the dialog box labeled: make a List, then click on the new item button and add all of your zombie objects.
You will also need to create a when mouse clicked on event for your program.
If you are unfamiliar with how to do any of the above you may wish to download Dick Baldwin's free Alice tutorials. It's really not as hard to do what you want as it may sound!
Good luck,