Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | MerrMite |
Using Tween.is_active() == false in the _physics_process function returns false twice before the tween can be started again
example code which shows i increasing by 2 every time 1 tween movement is made
`extends KinematicBody2D
export(float) var move_speed = .2
var initial_position = Vector2()
var input_direction = Vector2()
var TILE_SIZE = 16
var i = 0
func _ready():
initial_position = position
input_direction = Vector2(0,1)
func _physics_process(delta):
if $Tween.is_active() == false:
print(i)
i = i +1
move()
func move():
$Tween.interpolate_property(
self, “position”,
position, initial_position + (input_direction * TILE_SIZE), move_speed,
Tween.TRANS_LINEAR
)
initial_position = position
$Tween.start()`