第一次提交作业
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
extends Area2D
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
# Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
@export var value: int = 1 # 这枚金币值多少分
|
||||
|
||||
func _ready():
|
||||
body_entered.connect(_on_body_entered)
|
||||
|
||||
func _on_body_entered(body: Node2D) -> void:
|
||||
if body.has_method("add_coin"): # 确认是主角
|
||||
body.add_coin(value)
|
||||
queue_free()
|
||||
@@ -0,0 +1 @@
|
||||
uid://dg06y7uamg1c2
|
||||
@@ -0,0 +1,19 @@
|
||||
[gd_scene format=3 uid="uid://cnqt0sdrsanc0"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dg06y7uamg1c2" path="res://scenes/prefabs/collectibles/coin_gold_round.gd" id="1_1q6pd"]
|
||||
[ext_resource type="Texture2D" uid="uid://cb8de6nm1sbvw" path="res://assets/game/collectibles/coin_gold_round.png" id="1_texture"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="Shape_coin"]
|
||||
radius = 5.0
|
||||
|
||||
[node name="CoinGoldRound" type="Area2D" unique_id=23388588 groups=["collectible"]]
|
||||
collision_layer = 15
|
||||
collision_mask = 2
|
||||
script = ExtResource("1_1q6pd")
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="." unique_id=222829881]
|
||||
texture_filter = 1
|
||||
texture = ExtResource("1_texture")
|
||||
|
||||
[node name="PickupArea" type="CollisionShape2D" parent="." unique_id=185188105]
|
||||
shape = SubResource("Shape_coin")
|
||||
@@ -0,0 +1,18 @@
|
||||
[gd_scene load_steps=3 format=3]
|
||||
|
||||
[ext_resource type="Texture2D" path="res://assets/game/collectibles/coin_gold_thin.png" id="1_texture"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="Shape_coin"]
|
||||
size = Vector2(7, 13)
|
||||
|
||||
[node name="CoinGoldThin" type="Area2D" groups=["collectible"]]
|
||||
collision_layer = 16
|
||||
collision_mask = 2
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
texture_filter = 1
|
||||
texture = ExtResource("1_texture")
|
||||
|
||||
[node name="PickupArea" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("Shape_coin")
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
[gd_scene load_steps=3 format=3]
|
||||
|
||||
[ext_resource type="Texture2D" path="res://assets/game/collectibles/gem_blue.png" id="1_texture"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="Shape_gem"]
|
||||
radius = 6.0
|
||||
|
||||
[node name="GemBlue" type="Area2D" groups=["collectible"]]
|
||||
collision_layer = 16
|
||||
collision_mask = 2
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
texture_filter = 1
|
||||
texture = ExtResource("1_texture")
|
||||
|
||||
[node name="PickupArea" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("Shape_gem")
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
[gd_scene load_steps=5 format=3]
|
||||
|
||||
[ext_resource type="Texture2D" path="res://assets/game/vegetation/tree_canopy_left.png" id="1_left"]
|
||||
[ext_resource type="Texture2D" path="res://assets/game/vegetation/tree_canopy_middle.png" id="2_middle"]
|
||||
[ext_resource type="Texture2D" path="res://assets/game/vegetation/tree_canopy_right.png" id="3_right"]
|
||||
[ext_resource type="Texture2D" path="res://assets/game/vegetation/tree_trunk.png" id="4_trunk"]
|
||||
|
||||
[node name="TreeSmall" type="Node2D"]
|
||||
|
||||
[node name="CanopyLeft" type="Sprite2D" parent="."]
|
||||
texture_filter = 1
|
||||
position = Vector2(-18, -18)
|
||||
texture = ExtResource("1_left")
|
||||
|
||||
[node name="CanopyMiddle" type="Sprite2D" parent="."]
|
||||
texture_filter = 1
|
||||
position = Vector2(0, -18)
|
||||
texture = ExtResource("2_middle")
|
||||
|
||||
[node name="CanopyRight" type="Sprite2D" parent="."]
|
||||
texture_filter = 1
|
||||
position = Vector2(18, -18)
|
||||
texture = ExtResource("3_right")
|
||||
|
||||
[node name="Trunk" type="Sprite2D" parent="."]
|
||||
texture_filter = 1
|
||||
texture = ExtResource("4_trunk")
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
extends Area2D
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass
|
||||
func _on_body_entered(body: Node2D) -> void:
|
||||
if body.is_in_group("hazard"):
|
||||
if body.has_method("take_damage"):
|
||||
body.take_damage()
|
||||
# Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
@@ -0,0 +1 @@
|
||||
uid://3ugbvq1iadqi
|
||||
@@ -0,0 +1,19 @@
|
||||
[gd_scene load_steps=3 format=3]
|
||||
|
||||
[ext_resource type="Texture2D" path="res://assets/game/obstacles/spikes_double.png" id="1_texture"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="Shape_spikes"]
|
||||
size = Vector2(14, 6)
|
||||
|
||||
[node name="SpikesDouble" type="Area2D" groups=["hazard"]]
|
||||
collision_layer = 4
|
||||
collision_mask = 2
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
texture_filter = 1
|
||||
texture = ExtResource("1_texture")
|
||||
|
||||
[node name="DetectionArea" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0, 4)
|
||||
shape = SubResource("Shape_spikes")
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
[gd_scene load_steps=3 format=3]
|
||||
|
||||
[ext_resource type="Texture2D" path="res://assets/game/interactables/spring_red.png" id="1_texture"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="Shape_spring"]
|
||||
size = Vector2(14, 8)
|
||||
|
||||
[node name="SpringRed" type="Area2D" groups=["spring"]]
|
||||
collision_layer = 8
|
||||
collision_mask = 2
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
texture_filter = 1
|
||||
texture = ExtResource("1_texture")
|
||||
|
||||
[node name="ActivationArea" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0, 3)
|
||||
shape = SubResource("Shape_spring")
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
[gd_scene load_steps=2 format=3]
|
||||
|
||||
[ext_resource type="Texture2D" path="res://assets/game/signs/direction_sign_left.png" id="1_texture"]
|
||||
|
||||
[node name="DirectionSignLeft" type="Node2D"]
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
texture_filter = 1
|
||||
texture = ExtResource("1_texture")
|
||||
@@ -0,0 +1,10 @@
|
||||
[gd_scene load_steps=2 format=3]
|
||||
|
||||
[ext_resource type="Texture2D" path="res://assets/game/signs/direction_sign_right.png" id="1_texture"]
|
||||
|
||||
[node name="DirectionSignRight" type="Node2D"]
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
texture_filter = 1
|
||||
texture = ExtResource("1_texture")
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
[gd_scene load_steps=3 format=3]
|
||||
|
||||
[ext_resource type="Texture2D" path="res://assets/game/structures/crate.png" id="1_texture"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="Shape_crate"]
|
||||
size = Vector2(18, 18)
|
||||
|
||||
[node name="Crate" type="StaticBody2D"]
|
||||
collision_layer = 1
|
||||
collision_mask = 0
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
texture_filter = 1
|
||||
texture = ExtResource("1_texture")
|
||||
|
||||
[node name="Collision" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("Shape_crate")
|
||||
|
||||
Reference in New Issue
Block a user