Pages: 1
Topic closed
Hi
Lets say I am making a space invaders type game called fruit invaders. I am being attacked by a banana, an orange, an apple, a cherry and a pear. How do I remove a particular item from the list of fruit? I can't easily use the
delete (1/last/all) of FRUIT
option because the fruit positions change as fruit are shot down at random.
There doesn't seem to be an easy way to delete, say, the banana given that I do not know its position in the list.
I basically want to
delete banana of Fruit
Any advice would be appreciated.
Offline
Put a lot of ifs for if ALL the fruit if in, then depending on which if it has reached put a delete all of fruit and add all the fruit it picked up as in in apart from bannana,
Sorry if this is complicated but i think it is the only way.
Offline
Thanks Clank23
I was thinking of doing something like that.
I found the following code on the forum.
hmnwilson wrote something like this
set [listchecker] to (1)
repeat until <(item (listchecker) of [FRUIT])) = [banana]>
change [listchecker] by (1)
[end of loop]
delete item (listchecker) of [FRUIT]
It uses a loop to determine which position the fruit is in then removes the object in that position. Just tried it and it works.
Offline
Topic closed
Pages: 1