0 votes

I want a simple effect for my 2D game, where the character lands in something sticky, and the jump height is drastically reduced.

All I want is to take the following sprite;
sticky
and fix the bottom 2 vertexes to the ground, and the top 2 vertexes to the bottom of the player sprite. So that as they jump, the image stretches to follow them, appearing to pull them back down due to their reduced jump height.

How can I control the vertexes of a sprite in this way? BTW I'm still using Godot 2.1.

in Engine by (21 points)

1 Answer

0 votes
Best answer

Sprites are just an easy-to-use textured rectangle, so there is no function to skew it freely, except maybe using shaders.

If you want to do this, I would suggest using a custom-drawn polygon, by creating a Node2D, overriding the _draw() method and using draw_primitive(). This lets you define exactly where each vertex will be, as well as texture coordinates and colors.

You could also use the Polygon2D node.

by (27,896 points)
selected by

Thank you, I will look into those options :)

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.