diff --git a/art/coin.png b/art/coin.png new file mode 100644 index 0000000..7241dc1 Binary files /dev/null and b/art/coin.png differ diff --git a/art/coin.png.import b/art/coin.png.import new file mode 100644 index 0000000..d58e8e3 --- /dev/null +++ b/art/coin.png.import @@ -0,0 +1,43 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dftfxivu3peog" +path="res://.godot/imported/coin.png-7a22d78603b91b8bca023a7cd8e523dd.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://art/coin.png" +dest_files=["res://.godot/imported/coin.png-7a22d78603b91b8bca023a7cd8e523dd.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/high_quality_mode=0 +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +mipmaps/preserve_alpha_test_coverage=false +mipmaps/alpha_test_threshold=0.5 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/coin.gd b/coin.gd new file mode 100644 index 0000000..6841e94 --- /dev/null +++ b/coin.gd @@ -0,0 +1,15 @@ +extends Node2D + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta: float) -> void: + pass + +func on_contact(body: Node2D) -> void: + print(body) + %Player2D.coins += 1 + queue_free() diff --git a/coin.gd.uid b/coin.gd.uid new file mode 100644 index 0000000..cf20527 --- /dev/null +++ b/coin.gd.uid @@ -0,0 +1 @@ +uid://cvboxlqkhn1ef diff --git a/coin.tscn b/coin.tscn new file mode 100644 index 0000000..2ef59a6 --- /dev/null +++ b/coin.tscn @@ -0,0 +1,21 @@ +[gd_scene format=3 uid="uid://kstmxoa4dx55"] + +[ext_resource type="Script" uid="uid://cvboxlqkhn1ef" path="res://coin.gd" id="1_0t63x"] +[ext_resource type="Texture2D" uid="uid://dftfxivu3peog" path="res://art/coin.png" id="1_d5gmh"] + +[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_6qpsl"] +radius = 7.0 +height = 20.0 + +[node name="Coin" type="Node2D" unique_id=1739014101] +script = ExtResource("1_0t63x") + +[node name="Sprite2D" type="Sprite2D" parent="." unique_id=813041394] +texture = ExtResource("1_d5gmh") + +[node name="Area2D" type="Area2D" parent="." unique_id=170499029] + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D" unique_id=1865546056] +shape = SubResource("CapsuleShape2D_6qpsl") + +[connection signal="body_entered" from="Area2D" to="." method="on_contact"] diff --git a/coin_label.gd b/coin_label.gd new file mode 100644 index 0000000..ebd1cc3 --- /dev/null +++ b/coin_label.gd @@ -0,0 +1,9 @@ +extends RichTextLabel + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + pass # Replace with function body. + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta: float) -> void: + text = "COINS: " + str(%Player2D.coins) diff --git a/coin_label.gd.uid b/coin_label.gd.uid new file mode 100644 index 0000000..21b1226 --- /dev/null +++ b/coin_label.gd.uid @@ -0,0 +1 @@ +uid://dtomgfu8ib50f diff --git a/player_2d.gd b/player_2d.gd index 43cd226..7dc48f3 100644 --- a/player_2d.gd +++ b/player_2d.gd @@ -10,6 +10,7 @@ var fall_timer = 0.0 var teleport_cooldown = 0 var jumps = 0 var death_threshold = 1000 +var coins = 0 func _ready() -> void: pass @@ -50,7 +51,7 @@ func _process(delta: float) -> void: else: velocity.x = move_toward(velocity.x, 0, SPEED) - print("PLAYER X POSITION: " + str(position.y)) + #print("PLAYER X POSITION: " + str(position.y)) if position.y >= death_threshold: print("SLASH KILL") get_tree().reload_current_scene() diff --git a/world.tscn b/world.tscn index 1e67e6e..a1092a1 100644 --- a/world.tscn +++ b/world.tscn @@ -5,9 +5,11 @@ [ext_resource type="PackedScene" uid="uid://ckqable762x8v" path="res://block.tscn" id="2_036b0"] [ext_resource type="Script" uid="uid://bds4m5we8nwe3" path="res://fps_label.gd" id="2_dwbse"] [ext_resource type="PackedScene" uid="uid://dx4pfup3sbk0f" path="res://long_block.tscn" id="3_dwbse"] +[ext_resource type="Script" uid="uid://dtomgfu8ib50f" path="res://coin_label.gd" id="3_wse8f"] [ext_resource type="PackedScene" uid="uid://byh115n12sgvt" path="res://teleporter.tscn" id="4_gbfbk"] [ext_resource type="PackedScene" uid="uid://bos6oh7nwyeca" path="res://vertical_long_block.tscn" id="4_pkg7o"] [ext_resource type="PackedScene" uid="uid://biot4cuwgohvo" path="res://longer_block.tscn" id="6_dwbse"] +[ext_resource type="PackedScene" uid="uid://kstmxoa4dx55" path="res://coin.tscn" id="8_ioo17"] [node name="World" type="Node2D" unique_id=1327991900] process_mode = 3 @@ -37,6 +39,18 @@ bbcode_enabled = true text = "FPS:" script = ExtResource("2_dwbse") +[node name="RichTextLabel3" type="RichTextLabel" parent="CanvasLayer" unique_id=1876455502] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_top = 45.0 +offset_bottom = 45.0 +grow_horizontal = 2 +grow_vertical = 2 +bbcode_enabled = true +text = "COINS:" +script = ExtResource("3_wse8f") + [node name="Player2D" parent="." unique_id=889851478 instance=ExtResource("1_aqk2v")] unique_name_in_owner = true position = Vector2(55, 59) @@ -68,6 +82,8 @@ position = Vector2(166, 200) [node name="VerticalLongBlock" parent="Tutorial" unique_id=925152188 instance=ExtResource("4_pkg7o")] position = Vector2(250, 141) +[node name="Coin" parent="Tutorial" unique_id=1739014101 instance=ExtResource("8_ioo17")] + [node name="ZoeLevel" type="Node2D" parent="." unique_id=980267417] visible = false