Added bounce physics, collision layers, masks, and names, pins (and the extra bouncy GiantPin), walls, cup physics, a sample level, and a score system with an accompanying auto-updating GUI label.
24 lines
419 B
GDScript
24 lines
419 B
GDScript
extends RigidBody2D
|
|
|
|
var held = false
|
|
|
|
func _ready() -> void:
|
|
$AnimatedSprite.frame = randi() % $AnimatedSprite.frames.get_frame_count("default")
|
|
|
|
|
|
|
|
|
|
func _physics_process(delta):
|
|
$Shine.rotation_degrees = -rotation_degrees
|
|
if held:
|
|
global_transform.origin = get_global_mouse_position()
|
|
|
|
|
|
|
|
|
|
func drop(impulse=Vector2.ZERO):
|
|
if held:
|
|
mode = RigidBody2D.MODE_RIGID
|
|
apply_central_impulse(impulse)
|
|
held = false
|