Added Objects

This commit is contained in:
Exobyt 2024-09-09 19:36:34 +02:00
parent eb11047456
commit 78dcaac886
11 changed files with 148 additions and 35 deletions

View file

@ -0,0 +1,30 @@
extends Area2D
@export_range(10,1000) var value = 10
@export_range(1,70) var weight = 1
const heavy = 50
var player = null
func _physics_process(delta: float) -> void:
#if player != null and weight >= heavy :
#global_position.y = move_toward(global_position.y, player.global_position.y, 5)
#global_position.x = move_toward(global_position.x, player.global_position.x, 5)
#if player != null and weight <= heavy :
if player != null:
global_position.y = move_toward(global_position.y, player.global_position.y, 3)
global_position.x = move_toward(global_position.x, player.global_position.x, 3)
func pickup(newPlayer):
z_index = 2
player = newPlayer
func drop():
global_position.y += 10
player = null
z_index = 0
func getWeight():
return weight