mirror of
https://github.com/kodzukye/scrap-signal.git
synced 2026-04-27 04:17:35 +00:00
14 lines
310 B
GDScript
14 lines
310 B
GDScript
class_name PushableBox
|
|
extends CharacterBody2D
|
|
|
|
func _ready() -> void:
|
|
add_to_group("pushable")
|
|
|
|
func try_push(direction: Vector2, tile_size: float) -> bool:
|
|
var motion := direction * tile_size
|
|
var collision := move_and_collide(motion)
|
|
if collision:
|
|
move_and_collide(-motion)
|
|
return false
|
|
return true
|