Hello this is my first Post and i hope you understand my Problem because my English is not the best
but let me try.
I want to detect when my player collid with an object.
i found this
http://www.giderosmobile.com/forum/discussion/121/simple-collision-detectionbut i wannt to detect if my player collid with an object of class x so not with a specific object but with every object of a Class ? How can i do this ?
Comments
objectsFromClass={}
and then inside Class:init()
add the line
table.insert(objectsFromClass,self)
also don't forget to have a destroy function for the class (called when an object is removed) where you remove self from this table.
this way you will have a table objectsFromClass of all objects of class Class. And then you can always sweep this table and check collision to the objects in it one by one (either box2d, or checking x-y position or using hittestpoint) - maybe for box2d you don't need to do that manually, i never used it, so i don't know.
Fragmenter - animated loop machine and IKONOMIKON - the memory game