Jump to content

Custom (pixel) movement size


seppsepp
 Share

Recommended Posts

Hi @all,

 

is it possible to tell Phaser what the size of a pixel is? Lets assume it's a retro styled game, sprites are made of pixels that are actually 4x4 pixels in size. Now when moving them around via Physics Arcade e.g. they will be moved pixel by pixel (1x1) and (of course) not by 4x4 pixels. Is there a nice way to change this behaviour?

 

Thanks a lot in advance for your help

 

Sebastian

Link to comment
Share on other sites

You mean, like, the "real" dimensions of your sprite is 64x64... but that's because every "pixel" in your sprite is really 4x4 so, logically, it's only 16x16... and you want Phaser to reflect that?

 

That's a really interesting idea! I don't think there's a way to do that in Phaser, though. I hope someone can correct me.

 

A game I'm working on now is 320x240 and I let it scale WAY up with few problems. Would that work?

Link to comment
Share on other sites

I also don't think Phaser has support for this

Now when moving them around via Physics Arcade e.g. they will be moved pixel by pixel (1x1) and (of course) not by 4x4 pixels.

My understanding is that the Phaser physics engines don't necessarily do any pixel snapping, and that the rounding if enabled is done in the updateTransform() functions.

From what I've seen only rounding to nearest integer is supported.

Is changing the functions an option? Maybe you could round to power of two coords (eg. 2, 4 or 8 pixels but not 3, 5, etc) using a bitmask?

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