Jump to content

Can i set a collision area in a sprite? [Phaser]


AramCP
 Share

Recommended Posts

Hi guys i just wanted to know if i can set something like a collision area in a sprite. I need to do that because i have a player sprite, who colides with trees and other stuff, i'll post images to make it more simple to understand.

Okay this is my game: http://prntscr.com/dasmyg

The player is suposed to collide with the tree's log, but when i come near to the tree, the collision is more like that: http://prntscr.com/dasns6

Thats because my sprite is 16x32, well he is only 19 pixels height, the rest its transparent, but its still there so its detected like a collision.

Maybe you will say me i have to resize the sprite to be only 19 pixels height, but then it will look like this: http://prntscr.com/dasp2e

And i want him to look like this: http://prntscr.com/daspb5

I want him to touch the tree with his head. So, is there a way to do that? 

 

PD: I edited the last photo to make the overlay

 

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...