mirror of
https://github.com/Steffo99/looping-for-loops.git
synced 2024-11-29 03:24:20 +00:00
13 lines
334 B
GDScript3
13 lines
334 B
GDScript3
|
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
|