Jump to content

Is it possible to prescale sprites in phaser?


Uhfgood
 Share

Recommended Posts

Use an object pool maybe?

Basically create all objects at runtime and then recycle them,

I wrote an generic object pooler that does exactly that.

I can send you the class if you are interested.

I dont think scaling has a huge impact on performance though.

Link to comment
Share on other sites

If you're worried about the disk space the game occupies, using the engine to scale the graphics won't help because the original assets will still be the big ones and they'll be there occupying space even if the game is not running. Why don't you scale them down when you export them from your graphics program to .png? Keep the editable version full size, but scale the graphics that go into the final game.

Link to comment
Share on other sites

I see...

There's Phaser.BitmapData that you can use to create the scaled textures. Phaser.BitmapData.copy() has a scaleY and scaleX argument and there is also Phaser.BitmapData.resize().

I've never used any of those but maybe that's what you're looking for.

Link to comment
Share on other sites

>But I want to scale them down once at the beginning so I'm not doing it in real-time.


>Is there a way to pre-scale sprites within phaser?


>What does an object pool have to do with pre-scaling your sprites?


 


in an object pool you can prescale the sprite and (re)use it in your game maybe? If an object is taken from the pool the sprite is already scaled, therefor you might call it pre scaled.


 


also as i already said, "I dont think scaling has a huge impact on performance though." so you might want to just load the bitmap and scale it to your needs in the sprite with sprite.scale.setTo(n,n).

Link to comment
Share on other sites

I think it's just what I want, now if I can only figure out how to use it :-)

 

thanks!

 

I see...

There's Phaser.BitmapData that you can use to create the scaled textures. Phaser.BitmapData.copy() has a scaleY and scaleX argument and there is also Phaser.BitmapData.resize().

I've never used any of those but maybe that's what you're looking for.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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