Timeline for Crafty - How to get the id of the collision element?
Current License: CC BY-SA 3.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Sep 15, 2014 at 5:42 | vote | accept | user3398698 | ||
| Sep 12, 2014 at 8:23 | comment | added | Sanojian | Ahh, that is probably the cause of our confusion. Sorry I know nothing about that component. Please include important information like that in your question. | |
| Sep 11, 2014 at 20:44 | comment | added | user3398698 | Perhaps you need to know that I'm using the TiledMapBuilder.js component | |
| Sep 11, 2014 at 7:12 | comment | added | Sanojian | Firstly, don't use alert, use console.log(). Then you can see the object itself in your console. Second, "this" in this context is your player, or the entity you are using to test collision. Not the entity you collided with. Third, using your method you would want collidingMob.getId() to get the crafty id of the entity you collided with. | |
| Sep 11, 2014 at 5:48 | comment | added | user3398698 | So, if i use this method on "this" it's working: alert(this.getid()) | |
| Sep 10, 2014 at 21:25 | comment | added | user3398698 | Hm, if i call the "mobId" per alert, nothing useful is returned.. Its just [object Object] | |
| Sep 10, 2014 at 13:22 | history | answered | Sanojian | CC BY-SA 3.0 |