Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by Webravenz

Hi !

I needed to have the same entity in different scales in my game, so I've modify the animation.js and image.js to add a property scale to the AnimSheet object and render it correctly.

It would be nice to have this feature in future versions, to scale sheets or entities.

thanks for this awesome game engine ;)

1 decade ago by alexandre

Not 100% sure about this but, wouldn't that affect collision detection unless Entity .size and .offset properties were updated as well?

1 decade ago by Arantor

It certainly would affect collision detection and would also affect performance when redrawing it later on - negatively, especially on mobile.

1 decade ago by Webravenz

Yep for collision you must resize the entity ...

you're probably right for the performance, i use 3 different scale so that's not a big problem

but I think that it's very usefull

1 decade ago by Arantor

That's the thing, it's really not as useful as it sounds like it should be. Scaling up requires updating every aspect of how an entity works (we're not just talking animations), and the scaling performance on animations is a LOT slower.

There is a reason why Impact does the rescaling on images to the canvas' current scale when it loads them initially, and that's for performance later on, because the performance later on at draw-time is considerably impaired in most cases (depending on what you're doing, I've been experimenting with this, for a dynamically generated image but even that which is a simple linear 2x scale, it hurts to perform)

Depending on what you're doing, you could load 3 sets of images up front or dynamically rescale them (note, won't work on iOSImpact, so you'll have to load 3 images then), and just update the size and offsets as needed which would make everything else work reasonably sanely. But it's really something I wouldn't want to see in the core.
Page 1 of 1
« first « previous next › last »