Hi guys,
Please help me out here.
I am tracking spawned players x position thru Runtime. Everything works perfectly. Players jump on certain x positions.
But when I want to remove the touched object like this:
if event.phase = “began” then
display.remove(self)
self=nil
table.remove(group, self)
I get an error pointing at line where I track the objects position: “unable to compare number with nil”.
I tried to put in Runtime:
a) for a = group.numChildren,1 -1 do
– self[a] track position
b) for a = 1, group.numChildren, -1 do
– self[a] track position
c) for a = group.numChildren,1 do
– self[a] track position
d) for a = 1, group.numChildren do
– self[a] track position
I have two questions:
- How to remove spawned object that is position tracked in Runtime?
- What is the difference in above a, and c, between “-1” and no “-1” at the end?
P.S. I can change alpha to 0 on touch, but cant remove touched object from memory.
Many thanks!
Ivan

