Jump to content

How to use collision in phaser


Sean95
 Share

Recommended Posts

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...