Hello;
Does anyone have a function that takes mesh coord (a,b) and stretches it to layout coord x,y. The function will probably have to consider the size and location of the sprite getting stretched etc.
thanks for your time
yours
winkr7
Develop games in your browser. Powerful, performant & highly capable.
With absolute mode you can do this to distort to an xy position.
(x-self.x)/self.width
(y-self.y)/self.height
Thanks ROJOhound. Does this assume the sprite is at angle=0?
Yea, It assumes the sprite angle is 0. If it's not zero we'd need to unrotate the xy first but that may be more trouble than it's worth.
Thankyou ROJOhound.
Testing more you'll need to add 0.5 if the origin is centered:
(x-self.x)/self.width+0.5
(y-self.y)/self.height+0.5
If the origin is top left it would be 0,0
Also here's an example if you want to work with rotation: dropbox.com/s/qpriwtyej3ngylb/layoutXYtoDistort.c3p