Files
godot-demo-projects/2d/pong/ball.gd
2017-11-11 19:53:14 -08:00

17 lines
285 B
GDScript

extends Area2D
const BALL_SPEED = 100
var direction = Vector2(-1, 0)
var speed = BALL_SPEED
onready var initial_pos = self.position
func reset():
position = initial_pos
speed = BALL_SPEED
direction = Vector2(-1, 0)
func _process(delta):
position += direction * speed * delta