Signal stuff
This commit is contained in:
parent
7d8c34401c
commit
27b1146ef5
|
@ -8,7 +8,7 @@ atlas = ExtResource("1_6r1ml")
|
|||
region = Rect2(16.535, 15.865, 15.895, 17.055)
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_55vvm"]
|
||||
radius = 18.0
|
||||
radius = 31.0
|
||||
|
||||
[node name="Node2D" type="Node2D"]
|
||||
script = ExtResource("1_55vvm")
|
||||
|
|
18
Score bar.tscn
Normal file
18
Score bar.tscn
Normal file
|
@ -0,0 +1,18 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://cnvs3iophpe3n"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://biv656fho5bpy" path="res://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")
|
|
@ -1,8 +1,12 @@
|
|||
extends Area2D
|
||||
|
||||
signal Pickup
|
||||
|
||||
func _ready():
|
||||
print("ready")
|
||||
|
||||
func _on_body_entered(body: Node2D) -> void:
|
||||
emit_signal("Pickup")
|
||||
self.queue_free()
|
||||
print("meow")
|
||||
|
||||
|
|
15
player.tscn
15
player.tscn
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=14 format=3 uid="uid://c1xy5bf2p6vmh"]
|
||||
[gd_scene load_steps=15 format=3 uid="uid://c1xy5bf2p6vmh"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://dimdd34ldpix5" path="res://playerSprites/playerSprite_0001.png" id="2_nvl01"]
|
||||
[ext_resource type="Texture2D" uid="uid://cmga6fl4uer1m" path="res://playerSprites/playerSprite_0002.png" id="3_ivps1"]
|
||||
|
@ -9,15 +9,20 @@
|
|||
[ext_resource type="Texture2D" uid="uid://jfhpkm78lqyx" path="res://playerSprites/playerSprite_0007.png" id="8_op7ga"]
|
||||
[ext_resource type="Texture2D" uid="uid://jssqmb4832pr" path="res://playerSprites/playerSprite_0008.png" id="9_q13i1"]
|
||||
[ext_resource type="Texture2D" uid="uid://dxeg6715vly1v" path="res://playerSprites/playerSprite_0009.png" id="10_pylmc"]
|
||||
[ext_resource type="PackedScene" uid="uid://cnvs3iophpe3n" path="res://Score bar.tscn" id="11_nvl01"]
|
||||
[ext_resource type="Texture2D" uid="uid://b8eut6fnru722" path="res://playerSprites/playerSprite_0010.png" id="11_pbfsw"]
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_4flbx"]
|
||||
resource_name = "movementScript"
|
||||
script/source = "extends CharacterBody2D
|
||||
|
||||
|
||||
const SPEED = 3.0
|
||||
func _ready() -> void:
|
||||
var collectable = get_tree().get_root().find_node(\"collectableCrystal\")
|
||||
collectable.connect(\"pickup\",self,\"collect\")
|
||||
|
||||
func collect():
|
||||
print(\"something\")
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
# Get the input direction and handle the movement/deceleration.
|
||||
|
@ -82,3 +87,9 @@ shape = SubResource("RectangleShape2D_i3pqv")
|
|||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
position_smoothing_enabled = true
|
||||
position_smoothing_speed = 10.0
|
||||
|
||||
[node name="Control" parent="." instance=ExtResource("11_nvl01")]
|
||||
offset_left = -263.0
|
||||
offset_top = -164.0
|
||||
offset_right = -263.0
|
||||
offset_bottom = -164.0
|
||||
|
|
6
progress_bar.gd
Normal file
6
progress_bar.gd
Normal file
|
@ -0,0 +1,6 @@
|
|||
extends ProgressBar
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
1
progress_bar.gd.uid
Normal file
1
progress_bar.gd.uid
Normal file
|
@ -0,0 +1 @@
|
|||
uid://biv656fho5bpy
|
|
@ -18,11 +18,11 @@ tile_map_data = PackedByteArray("AAAIAAkAAQAJABEAAAAJAAkAAQAJABEAAAAKAAkAAQAJABE
|
|||
tile_set = ExtResource("1_a7uaa")
|
||||
collision_enabled = false
|
||||
|
||||
[node name="CharacterBody2D" parent="." instance=ExtResource("2_lsvd3")]
|
||||
[node name="player" parent="." instance=ExtResource("2_lsvd3")]
|
||||
position = Vector2(373, 125)
|
||||
|
||||
[node name="Area2D" parent="." instance=ExtResource("3_x45i2")]
|
||||
[node name="collectableCrystal" parent="." instance=ExtResource("3_x45i2")]
|
||||
position = Vector2(401, 240)
|
||||
|
||||
[node name="Node2D" parent="." instance=ExtResource("4_0dbve")]
|
||||
[node name="rock" parent="." instance=ExtResource("4_0dbve")]
|
||||
position = Vector2(498, 169)
|
||||
|
|
Loading…
Reference in New Issue
Block a user