add theme, player simple attack

This commit is contained in:
2025-01-05 00:25:50 +01:00
parent f537722849
commit 5b558f9c3b
10 changed files with 1662 additions and 12 deletions

40
objects/brick.tscn Normal file
View File

@@ -0,0 +1,40 @@
[gd_scene load_steps=5 format=3 uid="uid://bymro4t7angv5"]
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_1c3jb"]
[ext_resource type="Script" path="res://scripts/components/bullet.gd" id="2_i6t5k"]
[ext_resource type="Script" path="res://scripts/components/damage.gd" id="3_8xipx"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ar0xf"]
size = Vector2(16, 10)
[node name="Brick" type="Area2D"]
collision_layer = 16
collision_mask = 11
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_ar0xf")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1_1c3jb")
hframes = 12
vframes = 12
frame = 80
[node name="BulletComponent" type="Node" parent="." node_paths=PackedStringArray("root", "area2d", "visibility_notifier", "timer")]
script = ExtResource("2_i6t5k")
root = NodePath("..")
speed = 120.0
area2d = NodePath("..")
visibility_notifier = NodePath("../VisibleOnScreenNotifier2D")
life_time = 2.0
timer = NodePath("../Timer")
[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="."]
position = Vector2(0, 2.38419e-07)
scale = Vector2(0.8, 0.5)
[node name="Timer" type="Timer" parent="."]
[node name="DamageComponent" type="Node" parent="." node_paths=PackedStringArray("area2d")]
script = ExtResource("3_8xipx")
area2d = NodePath("..")

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=11 format=3 uid="uid://bqi5s710xb1ju"]
[gd_scene load_steps=13 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"]
@@ -9,6 +9,8 @@
[ext_resource type="Script" path="res://scripts/components/health.gd" id="7_tqjk8"]
[ext_resource type="Script" path="res://scripts/components/player_death.gd" id="8_1v23d"]
[ext_resource type="Script" path="res://scripts/components/knockback.gd" id="9_rjyu4"]
[ext_resource type="Script" path="res://scripts/components/brick_throw.gd" id="10_u0v3b"]
[ext_resource type="PackedScene" uid="uid://bymro4t7angv5" path="res://objects/brick.tscn" id="11_qutq2"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_hdsg1"]
size = Vector2(16, 31)
@@ -62,5 +64,14 @@ script = ExtResource("9_rjyu4")
character_body = NodePath("..")
knockback_force = 1500.0
[node name="BrickThrowComponent" type="Node" parent="." node_paths=PackedStringArray("player_controller", "timer")]
script = ExtResource("10_u0v3b")
brick_scene = ExtResource("11_qutq2")
fire_rate = 0.3
player_controller = NodePath("..")
timer = NodePath("../ThrowTimer")
[node name="ThrowTimer" type="Timer" parent="."]
[connection signal="on_death" from="HealthComponent" to="PlayerDeathComponent" method="_on_health_component_on_death"]
[connection signal="on_health_change" from="HealthComponent" to="KnockbackComponent" method="_on_health_component_on_health_change"]

View File

@@ -9,7 +9,7 @@ radius = 4.0
[node name="Bullet" type="Area2D"]
collision_layer = 8
collision_mask = 5
collision_mask = 21
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_txsw8")

View File

@@ -10,7 +10,7 @@ radius = 9.0
[node name="Coin" type="Area2D"]
collision_layer = 2
collision_mask = 4
collision_mask = 20
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_3ask2")

View File

@@ -13,7 +13,7 @@ size = Vector2(18, 27)
size = Vector2(18, 27)
[node name="Enemy" type="CharacterBody2D"]
collision_layer = 0
collision_layer = 8
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, 0.5)
@@ -45,7 +45,7 @@ root = NodePath("..")
[node name="Hitbox" type="Area2D" parent="."]
collision_layer = 8
collision_mask = 4
collision_mask = 20
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
position = Vector2(0, 0.5)