第一次提交作业
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")
|
||||
|
||||
Reference in New Issue
Block a user