Made progress bar work

This commit is contained in:
theskywinds 2025-05-18 16:16:02 +02:00
parent 230242aad2
commit 879a4279a5
7 changed files with 9 additions and 40 deletions

View File

@ -17,7 +17,7 @@ animations = [{
[sub_resource type="CircleShape2D" id="CircleShape2D_lmbvg"] [sub_resource type="CircleShape2D" id="CircleShape2D_lmbvg"]
radius = 17.0 radius = 17.0
[node name="Area2D" type="Area2D"] [node name="crystal" type="Area2D"]
collision_layer = 0 collision_layer = 0
script = ExtResource("1_ttvq1") script = ExtResource("1_ttvq1")

View File

@ -27,10 +27,10 @@ position = Vector2(498, 169)
[node name="Node2D" type="Node2D" parent="."] [node name="Node2D" type="Node2D" parent="."]
position = Vector2(304, 494) position = Vector2(304, 494)
[node name="Area2D2" parent="Node2D" instance=ExtResource("3_56573")] [node name="crystal" parent="Node2D" instance=ExtResource("3_56573")]
[node name="Area2D" parent="Node2D" instance=ExtResource("3_56573")] [node name="crystal2" parent="Node2D" instance=ExtResource("3_56573")]
position = Vector2(87, -71) position = Vector2(87, -71)
[node name="collectableCrystal" parent="Node2D" instance=ExtResource("3_56573")] [node name="crystal3" parent="Node2D" instance=ExtResource("3_56573")]
position = Vector2(97, -254) position = Vector2(97, -254)

View File

@ -1,18 +0,0 @@
[gd_scene load_steps=2 format=3 uid="uid://cnvs3iophpe3n"]
[ext_resource type="Script" uid="uid://biv656fho5bpy" path="res://player/smallPlayer/progress_bar.gd" id="1_qy0dt"]
[node name="Control" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="ProgressBar" type="ProgressBar" parent="CanvasLayer"]
offset_right = 367.0
offset_bottom = 27.0
script = ExtResource("1_qy0dt")

View File

@ -10,7 +10,7 @@
[ext_resource type="Texture2D" uid="uid://jfhpkm78lqyx" path="res://player/smallPlayer/playerSprites/playerSprite_0007.png" id="8_op7ga"] [ext_resource type="Texture2D" uid="uid://jfhpkm78lqyx" path="res://player/smallPlayer/playerSprites/playerSprite_0007.png" id="8_op7ga"]
[ext_resource type="Texture2D" uid="uid://jssqmb4832pr" path="res://player/smallPlayer/playerSprites/playerSprite_0008.png" id="9_q13i1"] [ext_resource type="Texture2D" uid="uid://jssqmb4832pr" path="res://player/smallPlayer/playerSprites/playerSprite_0008.png" id="9_q13i1"]
[ext_resource type="Texture2D" uid="uid://dxeg6715vly1v" path="res://player/smallPlayer/playerSprites/playerSprite_0009.png" id="10_pylmc"] [ext_resource type="Texture2D" uid="uid://dxeg6715vly1v" path="res://player/smallPlayer/playerSprites/playerSprite_0009.png" id="10_pylmc"]
[ext_resource type="PackedScene" uid="uid://cnvs3iophpe3n" path="res://player/smallPlayer/Score bar.tscn" id="11_nvl01"] [ext_resource type="PackedScene" uid="uid://cnvs3iophpe3n" path="res://player/smallPlayer/menus/Score bar.tscn" id="11_nvl01"]
[ext_resource type="Texture2D" uid="uid://b8eut6fnru722" path="res://player/smallPlayer/playerSprites/playerSprite_0010.png" id="11_pbfsw"] [ext_resource type="Texture2D" uid="uid://b8eut6fnru722" path="res://player/smallPlayer/playerSprites/playerSprite_0010.png" id="11_pbfsw"]
[sub_resource type="SpriteFrames" id="SpriteFrames_onrkg"] [sub_resource type="SpriteFrames" id="SpriteFrames_onrkg"]
@ -54,7 +54,7 @@ animations = [{
[sub_resource type="RectangleShape2D" id="RectangleShape2D_i3pqv"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_i3pqv"]
size = Vector2(22, 22) size = Vector2(22, 22)
[node name="CharacterBody2D" type="CharacterBody2D"] [node name="player" type="CharacterBody2D"]
collision_mask = 2 collision_mask = 2
script = ExtResource("1_ivps1") script = ExtResource("1_ivps1")

View File

@ -1,16 +1,10 @@
extends CharacterBody2D extends CharacterBody2D
const SPEED = 3.0 const SPEED = 3.0
func _ready() -> void: var Progress
await get_tree().process_frame
var crystals = get_tree().get_nodes_in_group("crystals")
print("Got " + str(crystals.size()) + " crystals")
for crystal in crystals:
print("Connecting crystal: " + crystal.name)
crystal.connect("crystal_picked_up", Callable(self, "collect"))
func collect():
print("something")
func _physics_process(delta: float) -> void: func _physics_process(delta: float) -> void:
# Get the input direction and handle the movement/deceleration. # Get the input direction and handle the movement/deceleration.

View File

@ -1,6 +0,0 @@
extends ProgressBar
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.

View File

@ -1 +0,0 @@
uid://biv656fho5bpy