123456789101112131415161718 |
- extends KinematicBody2D
- var motion = Vector2()
- var speed = 400
- var attackrange = 80
- func _physics_process(delta):
-
- move_and_slide(motion * speed)
- $hitbox.position = motion * attackrange
- $Icon.rotation = atan2(motion.y,motion.x)
- func _input(event):
- if event is InputEventScreenDrag or event is InputEventScreenTouch and event.is_pressed():
- # print(event.position)
- motion = (event.position - get_global_transform_with_canvas().origin).normalized()
- else:
- motion *= .8
|