seppsepp Posted January 7, 2016 Share Posted January 7, 2016 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 More sharing options...
drhayes Posted January 7, 2016 Share Posted January 7, 2016 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 More sharing options...
seppsepp Posted January 8, 2016 Author Share Posted January 8, 2016 Something like that maybe: https://software.intel.com/en-us/html5/hub/blogs/state-of-nearest-neighbor-interpolation-in-canvas/ Link to comment Share on other sites More sharing options...
chg Posted January 8, 2016 Share Posted January 8, 2016 I also don't think Phaser has support for thisNow 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 More sharing options...
Recommended Posts