add collecting coins

This commit is contained in:
2024-12-30 01:00:26 +01:00
parent b862fa8084
commit d96963b6ef
14 changed files with 184 additions and 3 deletions

View File

@@ -1,15 +1,18 @@
[gd_scene load_steps=7 format=3 uid="uid://bqi5s710xb1ju"]
[gd_scene load_steps=8 format=3 uid="uid://bqi5s710xb1ju"]
[ext_resource type="Script" path="res://scripts/player.gd" id="1_8j4h4"]
[ext_resource type="Texture2D" uid="uid://b7gp0gqvkv8j4" path="res://sprites/MrBrick_base.png" id="2_bc55y"]
[ext_resource type="Texture2D" uid="uid://jl1gwqchhpdc" path="res://sprites/left_eye.png" id="3_2srrh"]
[ext_resource type="Texture2D" uid="uid://iiawtnwmeny3" path="res://sprites/right_eye.png" id="4_ccn81"]
[ext_resource type="Script" path="res://scripts/components/flip_player.gd" id="5_geu10"]
[ext_resource type="Script" path="res://scripts/components/score.gd" id="6_fowa2"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_hdsg1"]
size = Vector2(16, 31)
[node name="Brick Player" type="CharacterBody2D"]
collision_layer = 4
collision_mask = 3
script = ExtResource("1_8j4h4")
[node name="Root" type="Node2D" parent="."]
@@ -38,3 +41,8 @@ eye_right = NodePath("../Root/Right Eye")
player_controller = NodePath("..")
[node name="CoyoteTimer" type="Timer" parent="."]
[node name="CanPickUpComponent" type="Node" parent="."]
[node name="ScoreComponent" type="Node" parent="."]
script = ExtResource("6_fowa2")

26
objects/coin.tscn Normal file
View File

@@ -0,0 +1,26 @@
[gd_scene load_steps=5 format=3 uid="uid://54w4wisfj8v8"]
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_epuj5"]
[ext_resource type="Script" path="res://scripts/components/collectable.gd" id="2_y0k47"]
[ext_resource type="Resource" uid="uid://bc0esas5r2uy8" path="res://resources/collectables/coin.tres" id="3_fm2fq"]
[sub_resource type="CircleShape2D" id="CircleShape2D_3ask2"]
radius = 9.0
[node name="Coin" type="Area2D"]
collision_layer = 2
collision_mask = 4
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_3ask2")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1_epuj5")
hframes = 12
vframes = 12
frame = 51
[node name="Collectable" type="Node" parent="." node_paths=PackedStringArray("area2d") groups=["coins"]]
script = ExtResource("2_y0k47")
area2d = NodePath("..")
collectable_data = ExtResource("3_fm2fq")

View File

@@ -0,0 +1,19 @@
[gd_scene load_steps=3 format=3 uid="uid://ct8fim6mduyl3"]
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_rka1x"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_l44jt"]
size = Vector2(16, 4)
[node name="Collapsing Bridge" type="StaticBody2D"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, -6)
shape = SubResource("RectangleShape2D_l44jt")
one_way_collision = true
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1_rka1x")
hframes = 12
vframes = 12
frame = 56

View File

@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://b4eifkc31jsun"]
[ext_resource type="Script" path="res://scripts/game_manager.gd" id="1_58t7u"]
[node name="Node" type="Node"]
script = ExtResource("1_58t7u")