fork download
  1. extends Sprite
  2.  
  3. var vec = Vector2(0,0)
  4.  
  5. func _process(delta):
  6. #x位置が10を超えたら反転
  7. if vec.x < 10 and vec.x > -10:
  8. vec.x -= 1
  9. else:
  10. vec.x += 1
  11.  
  12.  
  13. self.translate(vec)
  14. print(vec.x)
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty