Files
godot-demo-projects/2d/pong/logic/ball.gd
Aaron Franke 006309bd6f Many tweaks thanks to IAmActuallyCthulhu
Also change apostrophes to double quotes and update C# projects
2020-06-28 13:19:13 -04:00

19 lines
319 B
GDScript

extends Area2D
const DEFAULT_SPEED = 100
var direction = Vector2.LEFT
onready var _initial_pos = position
onready var _speed = DEFAULT_SPEED
func _process(delta):
_speed += delta * 2
position += _speed * delta * direction
func reset():
direction = Vector2.LEFT
position = _initial_pos
_speed = DEFAULT_SPEED