From e82438139f2b1193276979594a7a1b068604cdb1 Mon Sep 17 00:00:00 2001 From: Exobyt Date: Tue, 10 Sep 2024 21:30:47 +0200 Subject: [PATCH] Second Prototype; Added Player Animations --- Assets/Player/Player.ase | Bin 1790 -> 8260 bytes Assets/Player/Player.png | Bin 455 -> 1523 bytes scenes/GLOBAL.gd | 12 +- .../game/collectionArea/collectionArea.tscn | 14 ++ scenes/game/collectionArea/collection_area.gd | 10 + scenes/game/entities/player/player.gd | 62 ++++-- scenes/game/entities/player/player.tres | 207 ++++++++++++++---- scenes/game/entities/player/player.tscn | 64 +++++- scenes/game/mainGame/main_game.gd | 7 +- scenes/game/mainGame/main_game.tscn | 15 +- scenes/game/objects/Vase/vase.tscn | 2 + scenes/game/objects/object.gd | 11 +- translations/translations.csv | 1 + 13 files changed, 332 insertions(+), 73 deletions(-) create mode 100644 scenes/game/collectionArea/collectionArea.tscn create mode 100644 scenes/game/collectionArea/collection_area.gd diff --git a/Assets/Player/Player.ase b/Assets/Player/Player.ase index a48bb2d1c6c7d454c60d9c309ac8ad9e15f1f587..79093a322aaa4a1c9252fe3738d49a16b5405fe7 100644 GIT binary patch literal 8260 zcmeHM3s6&68b0BM1mqC}-Ch*JrADwUumRK>MF^k>C99dV0;MwMC1^y^09~Q(N(l0> zI>yIHkZi%Kv@vu?*zT;d-42jcp<1=OVOMvZX(_=j)O8DOI;ddwzX3^tI+ci>*&Qy! zH+OFCz5oAz=bZ1H`<+z;LSLSqgM8qRKoo>fI0+NS!ilrzb7H~}x;N-C5p@{C_!AGK zvL*+$AoL=!7;yEXSil@k6yU-16@Xvt3<12+kOO!}e;n}s&{DwKK0cuAV>aN+N4Eo} zZTSVDAdLkW9m@fXk1qsd3(ElC*xmyusj~oX{LBP+>7OHj7B~>9`{0j&<-e%}+#-_! zzMd`sd^2$$U{iE7;EfCk;NRbB1w2^u3gEtcGI~x9nVUwV0qmGPn>_dS1{ArwTZ*Al zD#<@tI+O_YL2*zSlm#_GK~N2p0(C$UPywV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U9u@fYX6f)v+ikng9F^B@&30p9!%m-kjrUXd<2 zd~fBB=Q58QRa}R`HZ0kC@7=pxhi8L(=}YV~F&&ut)2+thz@mkCFL-cP{H@F=+Hb3n zE_iy7JuYcA$nAUb+q&($U;h1c16R9O;uufm(_~g;W%qdOAJ11gWtZAdTa}$t UozaG!OYZO1L4LQYu2|##0nDEWuK)l5 diff --git a/Assets/Player/Player.png b/Assets/Player/Player.png index 8cc63152a817b340b9dbd34b68b849d571b87046..94257844e95296d042f708e8a129002d14c4d3c8 100644 GIT binary patch literal 1523 zcmaJ>eKeB`7=NekVoUmDK5j~ys}EB-`ONBGVtx3?w5!;Zx%Xf~5>stgN{2=XNzwGd z4q9TwLNB3ZyVA`^Nj5B$acAUXAMf6~PUqZn|GLjP&vSmydH(qQ&hL57lkVr^Wr#9E z0RUh~@b)+Y0Ep{4yiy;jt4>L_#Q^ZbGlIuHVp8GM?W!nq!rGT$=7W=69jN#`*Hm;! ziS-K1A=bfE7;SEDqP09yhFThb$`Nf#EU8xw31i1X6$KvHvDbrv<+PR?uBMl6ZJq2l z&lKM&3aYdoceC8)-7tGD=D8zpSJ;VW(f@{wA(Oti=vSFHS6eniZY2NNnLgd2dDS%C z;r0y^suw)PaO*tYV6cS2>)E8-=h(cxxiDpm@){Z)c3GnkS)M$mc?3y*Cr@0_*4kfi zRCqp$g3I!|awXWb1vw-cg@)S{L_?>z=&LIG^iCVe-X5O<m;Bav%t*i$<<_EAUt2sx0!>Ei(l^qbnM83rzP(}b z9i0Rd876S~`jN$fG0xw7TJe!;q(w}*&)b<%qR{%XCcfGX5oSM1T^Nmf-g~sG(H{AZnHluw_{(QEf<%%o{XeMpn-#}gloM{;RLu!(ruUE^> zWz7w%KD-jO@00T;2HO&KlXAqkE&3a`zI*jvR#7@>{6_jE88JJXq#L`qq5c z9AQ{~5^{MjUiT46%soDz;|iP>&tb6rw7qs+>t#mW4(-K*$jI9BGYCg?EGjh5fVkNR z5Tqi`zOaY4vH8=_Xv!cpdpFY!GZe^8V~d+wOIEh{U{F1gz;%IB-=g*%*nx?&;Azwh z{I8i-`!WrCnHjLVe%nMhXOpy|+Ea;Qy+OhHU&VHE}x|(;iEG6?R%@aUWg~ zpyjJ1;n3Szk=g<$OFYdm1~4+_?NTRaJo+f2ni0uzV{&qsM+a_Mhxxg+yZ5!^%<_gz zyE~k+`VIUxGe5|~Y?ga5V$_-$daRk?77`x?^F~GqevHK7gqNi{U3?&R%I>m$*0Lon zRi1PwBQadhgn)6KZHJ-z-*@V$#Fc}cYR;)46_Wa4Z#b))!ffS9@Y&|?Bfx9Yl+dU>Ai7L#(N(32&v2~XDvJu^oIT)r!dvT_ zKMqEVk0y>f_s@fL+KJ7k1FE=2ZfQG=UMya6;5a2kse9%C!PCd% J@z0?b{{gz$HN5}; literal 455 zcmeAS@N?(olHy`uVBq!ia0vp^3P8MogAGXLp32i%uH66tgmlUviH?iEt@@eiF|3#UX{7| z?H3-L{;21h!tMfwYU8h_{R;=0Myg)56(>3?Ykc>Arcdbt5J|+F`)ehGp<+K zn^o`KJ0SBZtaMM8iYM}3zWv!$@a}w&*BKZt?6v>E Xa3*=_{eXB0MUa4}tDnm{r-UW|4{ovr diff --git a/scenes/GLOBAL.gd b/scenes/GLOBAL.gd index fd43086..753111e 100644 --- a/scenes/GLOBAL.gd +++ b/scenes/GLOBAL.gd @@ -1,4 +1,14 @@ extends Node +enum GAMETIME { + MIN = 240, + MAX = 360 +} + +var money = 0 + func resetValues(): - pass + money = 0 + +func addMoney(n): + money += n diff --git a/scenes/game/collectionArea/collectionArea.tscn b/scenes/game/collectionArea/collectionArea.tscn new file mode 100644 index 0000000..f709d6b --- /dev/null +++ b/scenes/game/collectionArea/collectionArea.tscn @@ -0,0 +1,14 @@ +[gd_scene load_steps=3 format=3 uid="uid://sgnp11xty7i1"] + +[ext_resource type="Script" path="res://scenes/game/collectionArea/collection_area.gd" id="1_c4amf"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_1qvdj"] +size = Vector2(96, 96) + +[node name="CollectionArea" type="Area2D"] +collision_layer = 8 +collision_mask = 4 +script = ExtResource("1_c4amf") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource("RectangleShape2D_1qvdj") diff --git a/scenes/game/collectionArea/collection_area.gd b/scenes/game/collectionArea/collection_area.gd new file mode 100644 index 0000000..097b60c --- /dev/null +++ b/scenes/game/collectionArea/collection_area.gd @@ -0,0 +1,10 @@ +extends Area2D + +func _physics_process(delta: float) -> void: + cashInObject() + +func cashInObject(): + for i in get_overlapping_areas(): + if not i.isCarryied(): + G.addMoney(i.getValue()) + i.queue_free() diff --git a/scenes/game/entities/player/player.gd b/scenes/game/entities/player/player.gd index e1f293e..db2c2fd 100644 --- a/scenes/game/entities/player/player.gd +++ b/scenes/game/entities/player/player.gd @@ -7,6 +7,11 @@ extends "res://scenes/game/entities/entity.gd" @onready var pickupArea = $PickupArea +@onready var healthBar = $Camera2D/CanvasLayer/Control/VBoxContainer/HealthBar +@onready var rollCooldownBar = $Camera2D/CanvasLayer/Control/VBoxContainer/RollCooldownBar +@onready var moneyValueLabel = $Camera2D/CanvasLayer/Control/HBoxContainer/MoneyValue + + var rollSpeed = maxSpeed * 5 const rollCooldown = 5.0 @@ -22,7 +27,17 @@ var object = null var lastDirection : Vector2 var lastdirectionVector : Vector2 +func _ready(): + rollCooldownBar.min_value = 0 + rollCooldownBar.max_value = rollCooldown + healthBar.min_value = 0 + healthBar.max_value = health + + func _physics_process(delta: float) -> void: + rollCooldownBar.value = rollCooldownTimer.time_left + healthBar.value = health + moneyValueLabel.text = str(G.money) var direction : Vector2 = Input.get_vector("MOVE_LEFT", "MOVE_RIGHT", "MOVE_UP", "MOVE_DOWN").normalized() #var direction : Vector2 = Vector2( @@ -39,8 +54,9 @@ func _physics_process(delta: float) -> void: if Input.is_action_just_pressed("INTERACT"): match carrying: false: - if pickupArea.get_overlapping_areas() != []: - pickup(pickupArea.get_overlapping_areas()[0]) + + + pickup(getNearestObject(pickupArea.get_overlapping_areas())) true: dropObject() #pickupArea.get_overlapping_areas()[0].pickup(self) @@ -74,33 +90,40 @@ func roll(): func setAnimation(): if not rolling: if Input.is_action_pressed("MOVE_LEFT") and not Input.is_action_pressed("MOVE_RIGHT") and animatedSprite.animation != "LEFT": - animatedSprite.play("LEFT") + animatedSprite.play("SIDE") + animatedSprite.flip_h = true elif Input.is_action_pressed("MOVE_RIGHT") and not Input.is_action_pressed("MOVE_LEFT") and animatedSprite.animation != "RIGHT": - animatedSprite.play("RIGHT") - elif Input.is_action_pressed("MOVE_UP") and animatedSprite.animation != "UP" and not Input.is_action_pressed("MOVE_LEFT") and not Input.is_action_pressed("MOVE_RIGHT"): + animatedSprite.play("SIDE") + animatedSprite.flip_h = false + elif Input.is_action_pressed("MOVE_UP") and not Input.is_action_pressed("MOVE_DOWN") and animatedSprite.animation != "UP" and not Input.is_action_pressed("MOVE_LEFT") and not Input.is_action_pressed("MOVE_RIGHT"): animatedSprite.play("UP") - elif Input.is_action_pressed("MOVE_DOWN") and animatedSprite.animation != "DOWN" and not Input.is_action_pressed("MOVE_LEFT") and not Input.is_action_pressed("MOVE_RIGHT"): + elif Input.is_action_pressed("MOVE_DOWN") and not Input.is_action_pressed("MOVE_UP") and animatedSprite.animation != "DOWN" and not Input.is_action_pressed("MOVE_LEFT") and not Input.is_action_pressed("MOVE_RIGHT"): animatedSprite.play("DOWN") - elif not (Input.is_action_pressed("MOVE_UP") or Input.is_action_pressed("MOVE_RIGHT") or Input.is_action_pressed("MOVE_DOWN") or Input.is_action_pressed("MOVE_LEFT")): + elif not animatedSprite.animation == "Ball" and not (Input.is_action_pressed("MOVE_UP") or Input.is_action_pressed("MOVE_RIGHT") or Input.is_action_pressed("MOVE_DOWN") or Input.is_action_pressed("MOVE_LEFT")): animatedSprite.play("IDLE") - + animatedSprite.flip_h = false + elif animatedSprite.animation != "Ball": + animatedSprite.play("Ball") func _on_roll_timeout() -> void: + animatedSprite.play_backwards("Ball") resetSpeed() invincible = false rolling = false rollCooldownTimer.start(rollCooldown) + func _on_roll_cooldown_timer_timeout() -> void: canRoll = true func pickup(newObject): - if newObject.player == null and not rolling: - carrying = true - object = newObject - speed -= object.getWeight() - object.pickup(self) + if newObject != null: + if newObject.player == null and not rolling: + carrying = true + object = newObject + speed -= object.getWeight() + object.pickup(self) func dropObject(): if carrying: @@ -108,3 +131,16 @@ func dropObject(): object.drop() object = null resetSpeed() + +func getNearestObject(list): + var nearestObject = null + var shortestDistance = 0 + if list != []: + for i in list: + if nearestObject == null: + shortestDistance = global_position.distance_to(i.global_position) + nearestObject = i + elif shortestDistance > global_position.distance_to(i.global_position): + shortestDistance = global_position.distance_to(i.global_position) + nearestObject = i + return nearestObject diff --git a/scenes/game/entities/player/player.tres b/scenes/game/entities/player/player.tres index ea24f78..5b849f9 100644 --- a/scenes/game/entities/player/player.tres +++ b/scenes/game/entities/player/player.tres @@ -1,101 +1,220 @@ -[gd_resource type="SpriteFrames" load_steps=12 format=3 uid="uid://dv18sf3aj0n1h"] +[gd_resource type="SpriteFrames" load_steps=29 format=3 uid="uid://dv18sf3aj0n1h"] [ext_resource type="Texture2D" uid="uid://b2xbgtcyxvi73" path="res://Assets/Player/Player.png" id="1_21ptg"] -[sub_resource type="AtlasTexture" id="AtlasTexture_m3bgq"] +[sub_resource type="AtlasTexture" id="AtlasTexture_y1avd"] atlas = ExtResource("1_21ptg") -region = Rect2(0, 64, 16, 32) +region = Rect2(320, 0, 16, 16) -[sub_resource type="AtlasTexture" id="AtlasTexture_6rhbk"] +[sub_resource type="AtlasTexture" id="AtlasTexture_0vp22"] atlas = ExtResource("1_21ptg") -region = Rect2(16, 64, 16, 32) +region = Rect2(336, 0, 16, 16) -[sub_resource type="AtlasTexture" id="AtlasTexture_51ijx"] +[sub_resource type="AtlasTexture" id="AtlasTexture_k732d"] atlas = ExtResource("1_21ptg") -region = Rect2(0, 0, 16, 32) +region = Rect2(352, 0, 16, 16) -[sub_resource type="AtlasTexture" id="AtlasTexture_ydp1x"] +[sub_resource type="AtlasTexture" id="AtlasTexture_66jg3"] atlas = ExtResource("1_21ptg") -region = Rect2(16, 0, 16, 32) +region = Rect2(368, 0, 16, 16) -[sub_resource type="AtlasTexture" id="AtlasTexture_l7ggo"] +[sub_resource type="AtlasTexture" id="AtlasTexture_tyq7v"] atlas = ExtResource("1_21ptg") -region = Rect2(0, 128, 16, 32) +region = Rect2(384, 0, 16, 16) -[sub_resource type="AtlasTexture" id="AtlasTexture_404j7"] +[sub_resource type="AtlasTexture" id="AtlasTexture_tv5ix"] atlas = ExtResource("1_21ptg") -region = Rect2(16, 128, 16, 32) +region = Rect2(256, 0, 16, 16) -[sub_resource type="AtlasTexture" id="AtlasTexture_csdks"] +[sub_resource type="AtlasTexture" id="AtlasTexture_6qsai"] atlas = ExtResource("1_21ptg") -region = Rect2(0, 96, 16, 32) +region = Rect2(272, 0, 16, 16) -[sub_resource type="AtlasTexture" id="AtlasTexture_yahsm"] +[sub_resource type="AtlasTexture" id="AtlasTexture_o7io3"] atlas = ExtResource("1_21ptg") -region = Rect2(16, 96, 16, 32) +region = Rect2(288, 0, 16, 16) -[sub_resource type="AtlasTexture" id="AtlasTexture_8pkt3"] +[sub_resource type="AtlasTexture" id="AtlasTexture_1y4qq"] atlas = ExtResource("1_21ptg") -region = Rect2(0, 32, 16, 32) +region = Rect2(304, 0, 16, 16) -[sub_resource type="AtlasTexture" id="AtlasTexture_rq2en"] +[sub_resource type="AtlasTexture" id="AtlasTexture_4kyvo"] atlas = ExtResource("1_21ptg") -region = Rect2(16, 32, 16, 32) +region = Rect2(0, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_3pdg8"] +atlas = ExtResource("1_21ptg") +region = Rect2(16, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_6oejk"] +atlas = ExtResource("1_21ptg") +region = Rect2(32, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_jcl2a"] +atlas = ExtResource("1_21ptg") +region = Rect2(48, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_f0bb7"] +atlas = ExtResource("1_21ptg") +region = Rect2(32, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_642vk"] +atlas = ExtResource("1_21ptg") +region = Rect2(16, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_mugnp"] +atlas = ExtResource("1_21ptg") +region = Rect2(0, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ptakl"] +atlas = ExtResource("1_21ptg") +region = Rect2(80, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_uxbgn"] +atlas = ExtResource("1_21ptg") +region = Rect2(96, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_e214p"] +atlas = ExtResource("1_21ptg") +region = Rect2(112, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_brspq"] +atlas = ExtResource("1_21ptg") +region = Rect2(128, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_fd4ha"] +atlas = ExtResource("1_21ptg") +region = Rect2(144, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_m4hph"] +atlas = ExtResource("1_21ptg") +region = Rect2(160, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_3gt14"] +atlas = ExtResource("1_21ptg") +region = Rect2(176, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_acjdb"] +atlas = ExtResource("1_21ptg") +region = Rect2(192, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ewdt3"] +atlas = ExtResource("1_21ptg") +region = Rect2(208, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_rlv0r"] +atlas = ExtResource("1_21ptg") +region = Rect2(224, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ij60e"] +atlas = ExtResource("1_21ptg") +region = Rect2(240, 0, 16, 16) [resource] animations = [{ "frames": [{ "duration": 1.0, -"texture": SubResource("AtlasTexture_m3bgq") +"texture": SubResource("AtlasTexture_y1avd") }, { "duration": 1.0, -"texture": SubResource("AtlasTexture_6rhbk") +"texture": SubResource("AtlasTexture_0vp22") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_k732d") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_66jg3") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_tyq7v") +}], +"loop": false, +"name": &"Ball", +"speed": 15.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_tv5ix") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_6qsai") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_o7io3") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_1y4qq") }], "loop": true, "name": &"DOWN", -"speed": 5.0 +"speed": 10.0 }, { "frames": [{ -"duration": 1.0, -"texture": SubResource("AtlasTexture_51ijx") +"duration": 20.0, +"texture": SubResource("AtlasTexture_4kyvo") }, { "duration": 1.0, -"texture": SubResource("AtlasTexture_ydp1x") +"texture": SubResource("AtlasTexture_3pdg8") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_6oejk") +}, { +"duration": 3.0, +"texture": SubResource("AtlasTexture_jcl2a") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_f0bb7") +}, { +"duration": 10.0, +"texture": SubResource("AtlasTexture_642vk") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_mugnp") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ptakl") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_uxbgn") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_e214p") }], "loop": true, "name": &"IDLE", -"speed": 5.0 +"speed": 10.0 }, { "frames": [{ "duration": 1.0, -"texture": SubResource("AtlasTexture_l7ggo") +"texture": SubResource("AtlasTexture_brspq") }, { "duration": 1.0, -"texture": SubResource("AtlasTexture_404j7") +"texture": SubResource("AtlasTexture_fd4ha") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_m4hph") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_3gt14") }], "loop": true, -"name": &"LEFT", -"speed": 5.0 +"name": &"SIDE", +"speed": 10.0 }, { "frames": [{ "duration": 1.0, -"texture": SubResource("AtlasTexture_csdks") +"texture": SubResource("AtlasTexture_acjdb") }, { "duration": 1.0, -"texture": SubResource("AtlasTexture_yahsm") -}], -"loop": true, -"name": &"RIGHT", -"speed": 5.0 -}, { -"frames": [{ -"duration": 1.0, -"texture": SubResource("AtlasTexture_8pkt3") +"texture": SubResource("AtlasTexture_ewdt3") }, { "duration": 1.0, -"texture": SubResource("AtlasTexture_rq2en") +"texture": SubResource("AtlasTexture_rlv0r") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ij60e") }], "loop": true, "name": &"UP", -"speed": 5.0 +"speed": 10.0 }] diff --git a/scenes/game/entities/player/player.tscn b/scenes/game/entities/player/player.tscn index a668db1..63b7733 100644 --- a/scenes/game/entities/player/player.tscn +++ b/scenes/game/entities/player/player.tscn @@ -4,23 +4,27 @@ [ext_resource type="Script" path="res://scenes/game/entities/player/player.gd" id="2_s0pfn"] [ext_resource type="SpriteFrames" uid="uid://dv18sf3aj0n1h" path="res://scenes/game/entities/player/player.tres" id="3_mlsai"] -[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_upmug"] -radius = 8.0 +[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_ihc0q"] +radius = 4.0 height = 16.0 [sub_resource type="CircleShape2D" id="CircleShape2D_8u3aq"] -radius = 8.0 +radius = 8.94427 [node name="Player" groups=["Player"] instance=ExtResource("1_kmfws")] script = ExtResource("2_s0pfn") [node name="CollisionShape2D" parent="." index="0"] position = Vector2(0, 8) -shape = SubResource("CapsuleShape2D_upmug") +rotation = 1.57079 +shape = SubResource("CapsuleShape2D_ihc0q") [node name="AnimatedSprite2D" parent="." index="1"] +visibility_layer = 4 +scale = Vector2(1.5, 1.5) sprite_frames = ExtResource("3_mlsai") -animation = &"DOWN" +animation = &"IDLE" +frame_progress = 0.904526 metadata/_aseprite_wizard_config_ = { "layer": "", "o_ex_p": "", @@ -36,10 +40,56 @@ metadata/_aseprite_wizard_interface_config_ = { } [node name="Camera2D" type="Camera2D" parent="." index="2"] -zoom = Vector2(3, 3) +zoom = Vector2(4, 4) limit_smoothed = true position_smoothing_enabled = true +[node name="CanvasLayer" type="CanvasLayer" parent="Camera2D" index="0"] + +[node name="Control" type="Control" parent="Camera2D/CanvasLayer" index="0"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="HBoxContainer" type="HBoxContainer" parent="Camera2D/CanvasLayer/Control" index="0"] +layout_mode = 0 +offset_right = 40.0 +offset_bottom = 40.0 + +[node name="MoneyLabel" type="Label" parent="Camera2D/CanvasLayer/Control/HBoxContainer" index="0"] +layout_mode = 2 +text = "MONEY" + +[node name="MoneyValue" type="Label" parent="Camera2D/CanvasLayer/Control/HBoxContainer" index="1"] +layout_mode = 2 + +[node name="VBoxContainer" type="VBoxContainer" parent="Camera2D/CanvasLayer/Control" index="1"] +layout_mode = 1 +anchors_preset = 2 +anchor_top = 1.0 +anchor_bottom = 1.0 +offset_left = 16.0 +offset_top = -63.9999 +offset_right = 312.0 +offset_bottom = -29.0 +grow_vertical = 0 +scale = Vector2(1.5, 1.5) +size_flags_horizontal = 3 +alignment = 1 + +[node name="RollCooldownBar" type="ProgressBar" parent="Camera2D/CanvasLayer/Control/VBoxContainer" index="0"] +layout_mode = 2 +show_percentage = false + +[node name="HealthBar" type="ProgressBar" parent="Camera2D/CanvasLayer/Control/VBoxContainer" index="1"] +layout_mode = 2 +rounded = true + [node name="RollTimer" type="Timer" parent="." index="3"] one_shot = true @@ -47,11 +97,11 @@ one_shot = true one_shot = true [node name="PickupArea" type="Area2D" parent="." index="5" groups=["Player"]] -position = Vector2(0, 8) collision_layer = 8 collision_mask = 4 [node name="CollisionShape2D" type="CollisionShape2D" parent="PickupArea" index="0"] +position = Vector2(0, 4) shape = SubResource("CircleShape2D_8u3aq") [connection signal="timeout" from="RollTimer" to="." method="_on_roll_timeout"] diff --git a/scenes/game/mainGame/main_game.gd b/scenes/game/mainGame/main_game.gd index 88e0050..85d23b9 100644 --- a/scenes/game/mainGame/main_game.gd +++ b/scenes/game/mainGame/main_game.gd @@ -1,10 +1,15 @@ extends Node2D +@onready var stormTimer = $StormTimer # Called when the node enters the scene tree for the first time. func _ready() -> void: - pass # Replace with function body. + stormTimer.start(randi_range(G.GAMETIME.MIN, G.GAMETIME.MAX)) # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: pass + + +func _on_storm_timer_timeout() -> void: + print("Storm") diff --git a/scenes/game/mainGame/main_game.tscn b/scenes/game/mainGame/main_game.tscn index 6f7fe20..1322611 100644 --- a/scenes/game/mainGame/main_game.tscn +++ b/scenes/game/mainGame/main_game.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=5 format=3 uid="uid://dgxw2n4ei2ahe"] +[gd_scene load_steps=6 format=3 uid="uid://dgxw2n4ei2ahe"] [ext_resource type="Script" path="res://scenes/game/mainGame/main_game.gd" id="1_napbe"] [ext_resource type="PackedScene" uid="uid://0duodsosmfpq" path="res://scenes/game/entities/player/player.tscn" id="3_sjgkj"] [ext_resource type="PackedScene" uid="uid://br7eqr6jomsg4" path="res://scenes/game/map/map.tscn" id="3_vpriv"] [ext_resource type="PackedScene" uid="uid://41ksceqosqq2" path="res://scenes/game/objects/Vase/vase.tscn" id="4_mot7l"] +[ext_resource type="PackedScene" uid="uid://sgnp11xty7i1" path="res://scenes/game/collectionArea/collectionArea.tscn" id="5_8c8da"] [node name="mainGame" type="Node2D"] script = ExtResource("1_napbe") @@ -18,4 +19,14 @@ y_sort_enabled = false [node name="Vase" parent="." instance=ExtResource("4_mot7l")] position = Vector2(32, 24) -value = 985 + +[node name="Vase2" parent="." instance=ExtResource("4_mot7l")] +position = Vector2(-8, 24) + +[node name="StormTimer" type="Timer" parent="."] +one_shot = true + +[node name="CollectionArea" parent="." instance=ExtResource("5_8c8da")] +position = Vector2(-272, -16) + +[connection signal="timeout" from="StormTimer" to="." method="_on_storm_timer_timeout"] diff --git a/scenes/game/objects/Vase/vase.tscn b/scenes/game/objects/Vase/vase.tscn index 1be6100..71caae2 100644 --- a/scenes/game/objects/Vase/vase.tscn +++ b/scenes/game/objects/Vase/vase.tscn @@ -6,6 +6,8 @@ radius = 12.0 [node name="Vase" instance=ExtResource("1_fkdlr")] +light_mask = 8 +visibility_layer = 8 y_sort_enabled = true [node name="CollisionShape2D" parent="." index="0"] diff --git a/scenes/game/objects/object.gd b/scenes/game/objects/object.gd index fdb897c..7c094e4 100644 --- a/scenes/game/objects/object.gd +++ b/scenes/game/objects/object.gd @@ -8,11 +8,6 @@ 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) @@ -28,3 +23,9 @@ func drop(): func getWeight(): return weight + +func getValue(): + return value + +func isCarryied(): + return player != null diff --git a/translations/translations.csv b/translations/translations.csv index e40bb0e..7d31990 100644 --- a/translations/translations.csv +++ b/translations/translations.csv @@ -1,2 +1,3 @@ keys,de,en START_GAME,Spielen,Play +MONEY,Geld,Money