mirror of
https://github.com/Steffo99/looping-for-loops.git
synced 2024-11-22 16:14:22 +00:00
12 lines
334 B
GDScript
12 lines
334 B
GDScript
extends StaticBody2D
|
|
class_name ConveyorBelt
|
|
|
|
|
|
# Speed (and direction) of the conveyor belt
|
|
export(float) var conveyor_speed = 0
|
|
|
|
|
|
func get_conveyor_speed(other_pos: Vector2):
|
|
var relative_position = other_pos - position
|
|
var speed_sign = sign(relative_position.dot(Vector2.UP.rotated(rotation)))
|
|
return speed_sign * conveyor_speed
|