Texts and coin counter
This commit is contained in:
@ -1,11 +1,13 @@
|
||||
[gd_scene load_steps=13 format=4 uid="uid://ddx678te8glnm"]
|
||||
[gd_scene load_steps=15 format=4 uid="uid://ddx678te8glnm"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cxdkngh6fo5p7" path="res://scenes/player.tscn" id="1_866nb"]
|
||||
[ext_resource type="Script" path="res://scripts/game_manager.gd" id="1_clwrx"]
|
||||
[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"]
|
||||
[ext_resource type="PackedScene" uid="uid://cxkr1ot3mkts1" path="res://scenes/killzone.tscn" id="5_sa1lr"]
|
||||
[ext_resource type="PackedScene" uid="uid://btfpng5d31b83" path="res://scenes/slime.tscn" id="6_solsf"]
|
||||
[ext_resource type="FontFile" uid="uid://fw4vwtwjmcu" path="res://assets/fonts/PixelOperator8.ttf" id="7_jqhk7"]
|
||||
|
||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_gsgsl"]
|
||||
texture = ExtResource("2_xrfdw")
|
||||
@ -216,6 +218,22 @@ distance = 11.0
|
||||
|
||||
[node name="Game" type="Node2D"]
|
||||
|
||||
[node name="GameManager" type="Node" parent="."]
|
||||
unique_name_in_owner = true
|
||||
script = ExtResource("1_clwrx")
|
||||
|
||||
[node name="Label" type="Label" parent="GameManager"]
|
||||
offset_left = 1453.0
|
||||
offset_top = -65.0
|
||||
offset_right = 1512.0
|
||||
offset_bottom = -54.0
|
||||
scale = Vector2(1, 1.12)
|
||||
theme_override_fonts/font = ExtResource("7_jqhk7")
|
||||
theme_override_font_sizes/font_size = 8
|
||||
text = "Coins: "
|
||||
vertical_alignment = 3
|
||||
autowrap_mode = 2
|
||||
|
||||
[node name="AnimatableBody2D" parent="." instance=ExtResource("3_3twsu")]
|
||||
position = Vector2(-12, -59)
|
||||
|
||||
@ -279,14 +297,43 @@ position = Vector2(-40, 8)
|
||||
[node name="Coin7" parent="Coins" instance=ExtResource("4_ydnys")]
|
||||
position = Vector2(524, 66)
|
||||
|
||||
[node name="Coin8" parent="Coins" instance=ExtResource("4_ydnys")]
|
||||
position = Vector2(744, 41)
|
||||
|
||||
[node name="Coin9" parent="Coins" instance=ExtResource("4_ydnys")]
|
||||
position = Vector2(1424, -61)
|
||||
|
||||
[node name="Coin10" parent="Coins" instance=ExtResource("4_ydnys")]
|
||||
position = Vector2(1288, -24)
|
||||
|
||||
[node name="slime" parent="." instance=ExtResource("6_solsf")]
|
||||
position = Vector2(556, 68)
|
||||
|
||||
[node name="labels" type="Node" parent="."]
|
||||
|
||||
[node name="Label" type="Label" parent="labels"]
|
||||
offset_left = -182.0
|
||||
offset_top = -65.0
|
||||
offset_right = -33.0
|
||||
offset_bottom = -24.0
|
||||
scale = Vector2(1, 1.12)
|
||||
theme_override_fonts/font = ExtResource("7_jqhk7")
|
||||
theme_override_font_sizes/font_size = 8
|
||||
text = "To jump press \"space\", \"w\" or \"upp arrow\" whatewer you feel like!"
|
||||
vertical_alignment = 3
|
||||
autowrap_mode = 2
|
||||
|
||||
[node name="Label2" type="Label" parent="labels"]
|
||||
offset_left = 508.0
|
||||
offset_top = -98.0
|
||||
offset_right = 655.0
|
||||
offset_bottom = -76.0
|
||||
scale = Vector2(1, 1.12)
|
||||
theme_override_fonts/font = ExtResource("7_jqhk7")
|
||||
theme_override_font_sizes/font_size = 8
|
||||
text = "Just jump already!
|
||||
"
|
||||
|
||||
[node name="Label3" type="Label" parent="labels"]
|
||||
offset_left = 1384.0
|
||||
offset_top = -155.0
|
||||
offset_right = 1531.0
|
||||
offset_bottom = -133.0
|
||||
scale = Vector2(1, 1.12)
|
||||
theme_override_fonts/font = ExtResource("7_jqhk7")
|
||||
theme_override_font_sizes/font_size = 8
|
||||
text = "Made with <3 by Kilokem"
|
||||
|
@ -1,7 +1,8 @@
|
||||
extends Area2D
|
||||
|
||||
@onready var game_manager: Node = %GameManager
|
||||
|
||||
|
||||
func _on_body_entered(body: Node2D) -> void:
|
||||
print("+1 coin!!")
|
||||
game_manager.add_point()
|
||||
queue_free()
|
||||
|
19
scripts/game_manager.gd
Normal file
19
scripts/game_manager.gd
Normal file
@ -0,0 +1,19 @@
|
||||
extends Node
|
||||
|
||||
var score = 0
|
||||
|
||||
@onready var label: Label = $Label
|
||||
|
||||
|
||||
func add_point():
|
||||
score += 1
|
||||
label.text = "Coins: " + str(score)
|
||||
|
||||
# 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
|
Reference in New Issue
Block a user