Stand sprite on rock

Stand sprite on rock
0.0 0

#1

Hi everyone
I am new in cocos2d-x
I successfully created tmx and import it in my project also created layers
I created physics world and set gravity also apply on my sprite.
collision between two physics body simply done. But my problem is when I am going to detect collision between my sprite on which gravity applied it doesn’t detect tmx layer. means when my sprite free down towards earth if it detect any tmx layer support is should stopped and stand on it.
what should I do?
tmx
as above image my sprite should stand on rock but by the presence of gravity it is falling down how can I stand my sprite on rock?


#2

I don’t see the image - but if you’re using a tile map I don’t believe it supplies its own physics body - so you’d have to add physics body(s) to the tiles- which would be inefficient…

see https://stackoverflow.com/questions/35737098/how-to-create-a-physicsbody-for-each-tile-on-a-tilemap-cocos2d-x

for example