add coin and script
This commit is contained in:
112
scenes/coin.tscn
Normal file
112
scenes/coin.tscn
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
[gd_scene load_steps=17 format=3 uid="uid://dotk5aceo1m0k"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://dkgme2xunqgmi" path="res://scripts/coin.gd" id="1_i64fm"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://be3is0ecci8ro" path="res://assets/sprites/coin.png" id="1_rwqht"]
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_i64fm"]
|
||||||
|
atlas = ExtResource("1_rwqht")
|
||||||
|
region = Rect2(0, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_11l1o"]
|
||||||
|
atlas = ExtResource("1_rwqht")
|
||||||
|
region = Rect2(16, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_d14el"]
|
||||||
|
atlas = ExtResource("1_rwqht")
|
||||||
|
region = Rect2(32, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_1ikuy"]
|
||||||
|
atlas = ExtResource("1_rwqht")
|
||||||
|
region = Rect2(48, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_wnlwo"]
|
||||||
|
atlas = ExtResource("1_rwqht")
|
||||||
|
region = Rect2(64, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_jig8b"]
|
||||||
|
atlas = ExtResource("1_rwqht")
|
||||||
|
region = Rect2(80, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_xmuha"]
|
||||||
|
atlas = ExtResource("1_rwqht")
|
||||||
|
region = Rect2(96, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_kfxoj"]
|
||||||
|
atlas = ExtResource("1_rwqht")
|
||||||
|
region = Rect2(112, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_jsmju"]
|
||||||
|
atlas = ExtResource("1_rwqht")
|
||||||
|
region = Rect2(128, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_s0mny"]
|
||||||
|
atlas = ExtResource("1_rwqht")
|
||||||
|
region = Rect2(144, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_7cc30"]
|
||||||
|
atlas = ExtResource("1_rwqht")
|
||||||
|
region = Rect2(160, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_rojmm"]
|
||||||
|
atlas = ExtResource("1_rwqht")
|
||||||
|
region = Rect2(176, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="SpriteFrames" id="SpriteFrames_ls27i"]
|
||||||
|
animations = [{
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_i64fm")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_11l1o")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_d14el")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_1ikuy")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_wnlwo")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_jig8b")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_xmuha")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_kfxoj")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_jsmju")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_s0mny")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_7cc30")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_rojmm")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"default",
|
||||||
|
"speed": 10.0
|
||||||
|
}]
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_ssuvv"]
|
||||||
|
radius = 5.0
|
||||||
|
|
||||||
|
[node name="Coin" type="Area2D"]
|
||||||
|
collision_mask = 2
|
||||||
|
script = ExtResource("1_i64fm")
|
||||||
|
|
||||||
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||||
|
sprite_frames = SubResource("SpriteFrames_ls27i")
|
||||||
|
autoplay = "default"
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("CircleShape2D_ssuvv")
|
||||||
|
|
||||||
|
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
[gd_scene load_steps=9 format=3 uid="uid://cy3dg66pt8abt"]
|
[gd_scene load_steps=10 format=3 uid="uid://cy3dg66pt8abt"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://3wumh6kpw3ai" path="res://scenes/player.tscn" id="1_uwrxv"]
|
[ext_resource type="PackedScene" uid="uid://3wumh6kpw3ai" path="res://scenes/player.tscn" id="1_uwrxv"]
|
||||||
[ext_resource type="Texture2D" uid="uid://0syymy7ijylx" path="res://assets/sprites/world_tileset.png" id="1_yqjtg"]
|
[ext_resource type="Texture2D" uid="uid://0syymy7ijylx" path="res://assets/sprites/world_tileset.png" id="1_yqjtg"]
|
||||||
[ext_resource type="PackedScene" uid="uid://xacwq0rohthg" path="res://scenes/platform.tscn" id="3_lnu2h"]
|
[ext_resource type="PackedScene" uid="uid://xacwq0rohthg" path="res://scenes/platform.tscn" id="3_lnu2h"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dotk5aceo1m0k" path="res://scenes/coin.tscn" id="4_lbhrr"]
|
||||||
|
|
||||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_lnu2h"]
|
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_lnu2h"]
|
||||||
texture = ExtResource("1_yqjtg")
|
texture = ExtResource("1_yqjtg")
|
||||||
@@ -235,3 +236,15 @@ libraries = {
|
|||||||
&"": SubResource("AnimationLibrary_iywne")
|
&"": SubResource("AnimationLibrary_iywne")
|
||||||
}
|
}
|
||||||
autoplay = "move"
|
autoplay = "move"
|
||||||
|
|
||||||
|
[node name="Coin" parent="." instance=ExtResource("4_lbhrr")]
|
||||||
|
position = Vector2(233, 87)
|
||||||
|
|
||||||
|
[node name="Coin2" parent="." instance=ExtResource("4_lbhrr")]
|
||||||
|
position = Vector2(9, 88)
|
||||||
|
|
||||||
|
[node name="Coin3" parent="." instance=ExtResource("4_lbhrr")]
|
||||||
|
position = Vector2(520, 57)
|
||||||
|
|
||||||
|
[node name="Coin4" parent="." instance=ExtResource("4_lbhrr")]
|
||||||
|
position = Vector2(88, -23)
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ radius = 5.0
|
|||||||
|
|
||||||
[node name="Player" type="CharacterBody2D"]
|
[node name="Player" type="CharacterBody2D"]
|
||||||
z_index = 5
|
z_index = 5
|
||||||
|
collision_layer = 2
|
||||||
script = ExtResource("1_g2els")
|
script = ExtResource("1_g2els")
|
||||||
speed = 130.0
|
speed = 130.0
|
||||||
jump_velocity = -300.0
|
jump_velocity = -300.0
|
||||||
|
|||||||
6
scripts/coin.gd
Normal file
6
scripts/coin.gd
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
extends Area2D
|
||||||
|
|
||||||
|
|
||||||
|
func _on_body_entered(body: Node2D) -> void:
|
||||||
|
print("Plus 1 coin")
|
||||||
|
queue_free()
|
||||||
1
scripts/coin.gd.uid
Normal file
1
scripts/coin.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://dkgme2xunqgmi
|
||||||
Reference in New Issue
Block a user