cykod / Quintus

HTML5 Game Engine
http://html5quintus.com
GNU General Public License v2.0
1.41k stars 401 forks source link

Add the possibility to scale sprites on X and Y #45

Closed muoji closed 10 years ago

muoji commented 11 years ago

Currently it is only possible to scale a sprite globally, but looking at the code shows it is easy to add an option to have different values for the scale on X and Y.

A basic way of implementing this would be to replace the line 363 of quintus_sprites.js by:

if(p.scale) { this.matrix.scale(p.scale.x || p.scale || 1, p.scale.y || p.scale || 1);
mpkorstanje commented 10 years ago

That will break tweening animations that use scale.

It'd be better to add a scaleX, scaleY properties, and a setter scale(x,y) that scales both identically or independelty.

If p.scale is defined, we have to fall back to that to avoid breaking every bodies code.

mpkorstanje commented 10 years ago

Had a look at the code. Not a trivial amount of work if we want to keep things backwards compatible.

I reckon it is better to bit the bullet now.

ghost commented 10 years ago

@muoji if you want this change to be applied, make a pull request with all necesary changes as @mpkorstanje said. Don't forget to add some test runs to prove your enhancement. Thanks.