Added Objects
This commit is contained in:
parent
eb11047456
commit
78dcaac886
11 changed files with 148 additions and 35 deletions
15
scenes/game/objects/Vase/vase.tscn
Normal file
15
scenes/game/objects/Vase/vase.tscn
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://41ksceqosqq2"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dxpd1pq7v6ing" path="res://scenes/game/objects/object.tscn" id="1_fkdlr"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_pmiic"]
|
||||
radius = 12.0
|
||||
|
||||
[node name="Vase" instance=ExtResource("1_fkdlr")]
|
||||
y_sort_enabled = true
|
||||
|
||||
[node name="CollisionShape2D" parent="." index="0"]
|
||||
shape = SubResource("CircleShape2D_pmiic")
|
||||
|
||||
[node name="AnimatedSprite2D" parent="." index="1"]
|
||||
animation = &""
|
||||
30
scenes/game/objects/object.gd
Normal file
30
scenes/game/objects/object.gd
Normal 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
|
||||
12
scenes/game/objects/object.tscn
Normal file
12
scenes/game/objects/object.tscn
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://dxpd1pq7v6ing"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/game/objects/object.gd" id="1_3y27f"]
|
||||
|
||||
[node name="Object" type="Area2D" groups=["Object"]]
|
||||
collision_layer = 4
|
||||
collision_mask = 8
|
||||
script = ExtResource("1_3y27f")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
Loading…
Add table
Add a link
Reference in a new issue