0 votes

Hi everyone,

I built a random rotation tween for a sprite:

extends Sprite

func _ready():
    var tween = Tween.new()

    rotation_degrees, rand_range (0, 180), 1.5,



This works, but the sprite only rotates clock-wise. I'd like it to randomly rotate clock-wise or counter-clock-wise. Could somehow a randomly chosen rand_range (0, -180) be added?

Godot version 3.3
in Engine by (492 points)

1 Answer

0 votes

Oh my, (-180, 180) does the trick. In my mind the 0 made sure that the sprite will be orientated correctly before the animation starts, but of course that hasn't anything to do with it. (Thanks for waking me up, FluffyRabbit on reddit!)

by (492 points)
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 Frequently asked questions and 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 [email protected] with your username.