How do I warp dynamically a sprite ?

  • Hi folks,

    I'm working on a game in which the player have to perform actions with a hand on a character's face.

    Now, I want the player to be able to grab some of the character's face assets and deform them like in Super Mario 64 :

    One of the things I've looked for was to warp sprites like you do in Photoshop.

    But I haven't found anything that fits me so far.

    Question 1 : How do I proceed to recreate this effect ?

    Also, since I couldn't make this work, I've tried to adjust width and height of the sprite dynamically after I've clicked on it.

    This time, the problem is that width and height are scaled from the sprite's origin point.

    If the origin point is on the left, I can scale it to the right.

    If the origin point is on the right, I can scale it to the left.

    If the origin point is on the middle, I can scale to both sides in the same time.

    BUT, I can't adjust the side on each side separately with one sprite only.

    Question 2 : How do I proceed to scale a sprite on each sides separately ?

    Thanks a lot ! Sorry for my bad English

  • Hi, i know i t's been a long time, but have you found a plug in or a solution to this? i also need to warp a sprite in the exact way you described. thanks!

  • Distorting sprites like that isn’t really possible with vanilla construct.

    One possible way could be a shader. There are many effects that people have made to distort an image. Most are pretty specific and they don’t really fit the requirement to be able to distort an image arbitrarily.

    Another idea would be to do it like texturing is done in a 3D modeling program. You’d set the position and uv coordinants of of vertecies. But again you can’t do that in vanilla construct.

    There are two plugins that can be used to do it though, with varying ease.

    The first is Paster. It has a draw quad action that can do the distortion. For curved you’d do lots of smaller quads.

    Another plugin is “custom draw.” Very similar but is simpler in a way. It’s topic has a few distortion examples.

    A third way is with some custom webgl in JavaScript to draw the distorted mesh.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for your reply, i've been trying to install the plugin Paster on C3 but i get this error message.

    "failed to install the addon. check the browser console for details"

    any idea of what it may be? i'm new at this.

  • Sorry, I haven’t a clue. The plugins I mentioned were c2 only, although I think blackhornet ported paster to c3 somewhere.

    I thought you were asking about in c2.

  • Sorry, I haven’t a clue. The plugins I mentioned were c2 only, although I think blackhornet ported paster to c3 somewhere.

    I thought you were asking about in c2.

    _____________________________________________-

    Ok, thanks again for replying!

Jump to:
Active Users
There are 2 visitors browsing this topic (0 users and 2 guests)