Quantcast
Channel: 2D Latest Topics
Viewing all articles
Browse latest Browse all 623

How to use collision in phaser

$
0
0

I've been trying to get my collision to work in phaser, I created my map in tiled so as far as i know i'm you use something like this

"map.setCollisionBetween(264, 265, true, 'foreground');"

I got the coordinates by calculating the id's from the tiles from the png file that i used in tiled. It creates the collision but not where i want it. 

I will insert the png file i used. 

so the tiled id goes like from the top left and right being 264 and 265. The bottom left and right is 297 and  298 image.png.c6169d23cd64557af28c489b032f6945.png

the collision is working like this:

image.png.d42b45ceee8ccd817aa29e70161dcf28.png

 

My script looks like this: 

image.png.6fb6909ebea789a4888c4af1ee8ae852.png

 

Any ideas why this is happening or how i can fix it? 

Thanks 

mario game v2.png

image.png


Viewing all articles
Browse latest Browse all 623

Trending Articles