|
@@ -1,6 +1,7 @@
|
|
|
class_name Ball
|
|
class_name Ball
|
|
|
extends CharacterBody2D
|
|
extends CharacterBody2D
|
|
|
-## A ball that bounces off everything and speeds up slightly on each bounce.
|
|
|
|
|
|
|
+## A ball that bounces off everything, speeds up slightly on each bounce and falls under
|
|
|
|
|
+## light gravity.
|
|
|
|
|
|
|
|
## Emitted for every contact, so the game can react to what the ball touched.
|
|
## Emitted for every contact, so the game can react to what the ball touched.
|
|
|
signal hit(ball: Ball, other: Node)
|
|
signal hit(ball: Ball, other: Node)
|
|
@@ -18,6 +19,7 @@ func throw() -> void:
|
|
|
|
|
|
|
|
|
|
|
|
|
func _physics_process(delta: float) -> void:
|
|
func _physics_process(delta: float) -> void:
|
|
|
|
|
+ velocity.y += Params.BALL_GRAVITY * delta
|
|
|
var motion := velocity * delta
|
|
var motion := velocity * delta
|
|
|
for i in 4:
|
|
for i in 4:
|
|
|
var collision := move_and_collide(motion)
|
|
var collision := move_and_collide(motion)
|