diff --git a/scenes/coin.tscn b/scenes/coin.tscn new file mode 100644 index 0000000..c182d41 --- /dev/null +++ b/scenes/coin.tscn @@ -0,0 +1,113 @@ +[gd_scene load_steps=17 format=3 uid="uid://dbjp33ljlh1vh"] + +[ext_resource type="Texture2D" uid="uid://db1subkmbj2d8" path="res://assets/sprites/coin.png" id="1_g13xr"] +[ext_resource type="Script" path="res://scripts/coin.gd" id="1_y3u7o"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_16edh"] +atlas = ExtResource("1_g13xr") +region = Rect2(0, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_f2i54"] +atlas = ExtResource("1_g13xr") +region = Rect2(16, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_bctmy"] +atlas = ExtResource("1_g13xr") +region = Rect2(32, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_yc10k"] +atlas = ExtResource("1_g13xr") +region = Rect2(48, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_xkn7t"] +atlas = ExtResource("1_g13xr") +region = Rect2(64, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_lv61b"] +atlas = ExtResource("1_g13xr") +region = Rect2(80, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_m74x8"] +atlas = ExtResource("1_g13xr") +region = Rect2(96, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_xab3w"] +atlas = ExtResource("1_g13xr") +region = Rect2(112, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_j6poa"] +atlas = ExtResource("1_g13xr") +region = Rect2(128, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_nps22"] +atlas = ExtResource("1_g13xr") +region = Rect2(144, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ov1jn"] +atlas = ExtResource("1_g13xr") +region = Rect2(160, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_fa2gn"] +atlas = ExtResource("1_g13xr") +region = Rect2(176, 0, 16, 16) + +[sub_resource type="SpriteFrames" id="SpriteFrames_gwbt3"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_16edh") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_f2i54") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_bctmy") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_yc10k") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_xkn7t") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_lv61b") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_m74x8") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_xab3w") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_j6poa") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_nps22") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ov1jn") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_fa2gn") +}], +"loop": true, +"name": &"default", +"speed": 10.0 +}] + +[sub_resource type="CircleShape2D" id="CircleShape2D_xb7vb"] +radius = 4.12311 + +[node name="Coin" type="Area2D"] +collision_mask = 2 +script = ExtResource("1_y3u7o") + +[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] +sprite_frames = SubResource("SpriteFrames_gwbt3") +autoplay = "default" +frame_progress = 0.569274 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource("CircleShape2D_xb7vb") + +[connection signal="body_entered" from="." to="." method="_on_body_entered"] diff --git a/scenes/game.tscn b/scenes/game.tscn index 972b5b8..34535c4 100644 --- a/scenes/game.tscn +++ b/scenes/game.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=9 format=4 uid="uid://ddx678te8glnm"] +[gd_scene load_steps=10 format=4 uid="uid://ddx678te8glnm"] [ext_resource type="PackedScene" uid="uid://cxdkngh6fo5p7" path="res://scenes/player.tscn" id="1_866nb"] [ext_resource type="Texture2D" uid="uid://dcqrtadm8khs6" path="res://assets/sprites/world_tileset.png" id="2_xrfdw"] [ext_resource type="PackedScene" uid="uid://c54bhvh3awmhl" path="res://scenes/platform.tscn" id="3_3twsu"] +[ext_resource type="PackedScene" uid="uid://dbjp33ljlh1vh" path="res://scenes/coin.tscn" id="4_ydnys"] [sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_gsgsl"] texture = ExtResource("2_xrfdw") @@ -239,3 +240,21 @@ libraries = { "": SubResource("AnimationLibrary_38isg") } autoplay = "move" + +[node name="Coin" parent="." instance=ExtResource("4_ydnys")] +position = Vector2(-259, -101) + +[node name="Coin2" parent="." instance=ExtResource("4_ydnys")] +position = Vector2(153, -73) + +[node name="Coin3" parent="." instance=ExtResource("4_ydnys")] +position = Vector2(168, 6) + +[node name="Coin4" parent="." instance=ExtResource("4_ydnys")] +position = Vector2(312, -8) + +[node name="Coin5" parent="." instance=ExtResource("4_ydnys")] +position = Vector2(344, -121) + +[node name="Coin6" parent="." instance=ExtResource("4_ydnys")] +position = Vector2(-40, 8) diff --git a/scenes/player.tscn b/scenes/player.tscn index 5e44c62..b1fc37c 100644 --- a/scenes/player.tscn +++ b/scenes/player.tscn @@ -43,6 +43,7 @@ animations = [{ radius = 5.0 [node name="Player" type="CharacterBody2D"] +collision_layer = 2 script = ExtResource("1_btp1f") [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] @@ -50,7 +51,7 @@ position = Vector2(0, -12) sprite_frames = SubResource("SpriteFrames_j6wpo") animation = &"idle" autoplay = "idle" -frame_progress = 0.161906 +frame_progress = 0.179935 [node name="CollisionShape2D" type="CollisionShape2D" parent="."] position = Vector2(0, -6) diff --git a/scripts/coin.gd b/scripts/coin.gd new file mode 100644 index 0000000..ec0f714 --- /dev/null +++ b/scripts/coin.gd @@ -0,0 +1,7 @@ +extends Area2D + + + +func _on_body_entered(body: Node2D) -> void: + print("+1 coin!!") + queue_free()