Thanks a lot! Know i feel stupid, because I didn’t thought about it.
Is there a way to use it in collision? I have global postCollision listener and in proper function i am checking what objects collided. After checking that event.object2 is my car, i need to check if event.object1 is one of the floors. To do so I’ve added user property “type” with value “floor” for every floor i have.
print(event.object1.name)
return
Update_start_stop_2
Same as f.name, made like you said, so i am sure that this is collision with that floor. Sadly, there is again error:
attempt to index field ‘property’ (a nil value)
after using
print(event.object1.property['type'])
even while
print(f.property['type'])
returns exactly what i want, so i am sure i made user properties right. Also, i am sure that my postCollision function is correct, because
myLevel:removeLayerObject("ToDestroy",event.object1.name)
works just great.