# How do I distort a sprite at different angles?

0 favourites
• 9 posts
From the Asset Store
Adjusting the game screen for different resolutions (Letterbox scale)
• see .c3p

I have a sprite of a circle and another sprite showing part of that circle being lit up. When its a perfect circle I can rotate the light and it looks good.

However, I want to distort the circle to encompass different sized boxes but I can't distort it at different angles. perhaps this isn't even possible?

thanks!

#### Tagged:

• hi, link doesn't work, needs permission, u need to change the link settings for sharing view anyone with link...

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• GeorgeZaharia I updated the link..

• same problem, as before, try get shareable link and set permission, anyone with link can view.

Edited: works now!

• Hey, sorry mate, i tried looking at the cap file, i realized i know how to do cos rotation and stuff... but then what you are saying is perspective distortion, and that has stuff to do with qarp and lerp.

i know rexrainbow or r0j0 had some formula for a dynamic trajectory that would do a bend like you need...

if it helps here is the dynamic trajectory formula

Repeat 10 times

—- create dot at lerp(A.x, B.x, (loopindex+1)/11), qarp(A.y, (A.y+B.y)/2-abs(A.x-B.x)/4, B.y, (loopindex+1)/11)

this works for 2 points A and B and it creates a dynamic trajectory... but im not sure how to use it for size distortion in your case... im not really good at stereoscopic projections, or fake 3d ... im actually curious about this result myself il keep playing with it... but is angle based calculus and trigonometry.

• GeorgeZaharia well it seems like all I need to do is to rotate the image (not the sprite) to the correct angle, then I can size it from there. But I'm not sure how to do that. Probably that Paster plugin does it maybe?

• jobel yes the paster plugin might help better, but not sure if is available in C3? if it is i think the tutorials for skew will help.

sorry again, il try play around with it maybe i find some solution.

anyway, if you somehow don't need all angles i just fixed 4 angles (0,90,270,180)

but any other angle requires as i said 3d type of calculus and trigonometry. Even with paster that calculation for skew i think is still going to be needed.

here is my 4 angle solution distort_sprite-Elipse

Edited: modified the trajectory formula a bit, for me the loopindex thing doesn't work on C3, so i found a replacement for it...

modified trajectory formula.

create dot at qarp(a.x,(a.x+b.x)/2,b.x,(loopindex+1)/11), qarp(A.y, (A.y+B.y)/2-abs(A.x-B.x)/4, B.y, (loopindex+1)/11)

• thanks GeorgeZaharia that might do the trick actually..

but like you said, I would also be interested in knowing how to do any angle. R0J0hound if you are interested in taking a look? thanks!

• 9 posts