added coins

This commit is contained in:
Jonas Braus
2024-07-28 21:20:05 +02:00
parent d13361cdb1
commit 5299f67b81
9 changed files with 239 additions and 3 deletions
Binary file not shown.
+33
View File
@@ -0,0 +1,33 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://cpwx7datjer6s"
path="res://.godot/imported/PixelOperator8.ttf-6337ad86a5c68e2e8555711ed51a4e69.fontdata"
[deps]
source_file="res://assets/PixelOperator8.ttf"
dest_files=["res://.godot/imported/PixelOperator8.ttf-6337ad86a5c68e2e8555711ed51a4e69.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=1
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

+34
View File
@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://d0xxlo60h1d7i"
path="res://.godot/imported/coinlabel.png-e55d5b49fbec1b6a412bf180fbef9ee7.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/coinlabel.png"
dest_files=["res://.godot/imported/coinlabel.png-e55d5b49fbec1b6a412bf180fbef9ee7.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
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
+59
View File
@@ -0,0 +1,59 @@
[gd_scene load_steps=9 format=3 uid="uid://nm5keea43u56"]
[ext_resource type="Texture2D" uid="uid://dth47lmb44qk8" path="res://assets/items.png" id="1_lffao"]
[ext_resource type="Script" path="res://scripts/coin.gd" id="1_qn7es"]
[sub_resource type="AtlasTexture" id="AtlasTexture_7xy4l"]
atlas = ExtResource("1_lffao")
region = Rect2(124, 94, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_d5dm6"]
atlas = ExtResource("1_lffao")
region = Rect2(154, 94, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_y8lq8"]
atlas = ExtResource("1_lffao")
region = Rect2(184, 94, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_8a022"]
atlas = ExtResource("1_lffao")
region = Rect2(214, 94, 16, 16)
[sub_resource type="SpriteFrames" id="SpriteFrames_4nuhx"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_7xy4l")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_d5dm6")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_y8lq8")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_8a022")
}],
"loop": true,
"name": &"idle",
"speed": 5.0
}]
[sub_resource type="CircleShape2D" id="CircleShape2D_vpcnk"]
radius = 7.0
[node name="Coin" type="Area2D"]
collision_mask = 2
script = ExtResource("1_qn7es")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
position = Vector2(8, -8)
sprite_frames = SubResource("SpriteFrames_4nuhx")
animation = &"idle"
autoplay = "idle"
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(8, -8)
shape = SubResource("CircleShape2D_vpcnk")
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
+69 -1
View File
@@ -1,10 +1,11 @@
[gd_scene load_steps=8 format=3 uid="uid://dv50be68omp73"]
[gd_scene load_steps=9 format=3 uid="uid://dv50be68omp73"]
[ext_resource type="Texture2D" uid="uid://chrld8oybp4me" path="res://assets/bg-1-1.png" id="1_rxc3r"]
[ext_resource type="PackedScene" uid="uid://dk1aby88pygtr" path="res://scenes/player.tscn" id="2_ru48y"]
[ext_resource type="PackedScene" uid="uid://d25ukpt8ot8xv" path="res://scenes/itemblock.tscn" id="3_fmbwm"]
[ext_resource type="PackedScene" uid="uid://b6piduuvusiix" path="res://scenes/destroyblock.tscn" id="4_4f23w"]
[ext_resource type="PackedScene" uid="uid://be832pldgbeyk" path="res://scenes/pipe.tscn" id="5_31d8i"]
[ext_resource type="PackedScene" uid="uid://nm5keea43u56" path="res://scenes/coin.tscn" id="6_evydd"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_sdqov"]
texture = ExtResource("1_rxc3r")
@@ -3047,6 +3048,7 @@ texture = ExtResource("1_rxc3r")
198:4/0 = 0
198:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
198:4/0/physics_layer_0/angular_velocity = 0.0
198:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-1, -8, 1.375, -8, 1.125, 8, -1, 8)
199:4/0 = 0
199:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
199:4/0/physics_layer_0/angular_velocity = 0.0
@@ -3680,6 +3682,7 @@ texture = ExtResource("1_rxc3r")
198:5/0 = 0
198:5/0/physics_layer_0/linear_velocity = Vector2(0, 0)
198:5/0/physics_layer_0/angular_velocity = 0.0
198:5/0/physics_layer_0/polygon_0/points = PackedVector2Array(-1, -8, 1.375, -8, 1.125, 8, -1, 8)
199:5/0 = 0
199:5/0/physics_layer_0/linear_velocity = Vector2(0, 0)
199:5/0/physics_layer_0/angular_velocity = 0.0
@@ -4313,6 +4316,7 @@ texture = ExtResource("1_rxc3r")
198:6/0 = 0
198:6/0/physics_layer_0/linear_velocity = Vector2(0, 0)
198:6/0/physics_layer_0/angular_velocity = 0.0
198:6/0/physics_layer_0/polygon_0/points = PackedVector2Array(-1, -8, 1.375, -8, 1.125, 8, -1, 8)
199:6/0 = 0
199:6/0/physics_layer_0/linear_velocity = Vector2(0, 0)
199:6/0/physics_layer_0/angular_velocity = 0.0
@@ -4946,6 +4950,7 @@ texture = ExtResource("1_rxc3r")
198:7/0 = 0
198:7/0/physics_layer_0/linear_velocity = Vector2(0, 0)
198:7/0/physics_layer_0/angular_velocity = 0.0
198:7/0/physics_layer_0/polygon_0/points = PackedVector2Array(-1, -8, 1.375, -8, 1.125, 8, -1, 8)
199:7/0 = 0
199:7/0/physics_layer_0/linear_velocity = Vector2(0, 0)
199:7/0/physics_layer_0/angular_velocity = 0.0
@@ -5579,6 +5584,7 @@ texture = ExtResource("1_rxc3r")
198:8/0 = 0
198:8/0/physics_layer_0/linear_velocity = Vector2(0, 0)
198:8/0/physics_layer_0/angular_velocity = 0.0
198:8/0/physics_layer_0/polygon_0/points = PackedVector2Array(-1, -8, 1.375, -8, 1.125, 8, -1, 8)
199:8/0 = 0
199:8/0/physics_layer_0/linear_velocity = Vector2(0, 0)
199:8/0/physics_layer_0/angular_velocity = 0.0
@@ -6218,6 +6224,7 @@ texture = ExtResource("1_rxc3r")
198:9/0 = 0
198:9/0/physics_layer_0/linear_velocity = Vector2(0, 0)
198:9/0/physics_layer_0/angular_velocity = 0.0
198:9/0/physics_layer_0/polygon_0/points = PackedVector2Array(-1, -8, 1.375, -8, 1.125, 8, -1, 8)
199:9/0 = 0
199:9/0/physics_layer_0/linear_velocity = Vector2(0, 0)
199:9/0/physics_layer_0/angular_velocity = 0.0
@@ -6846,6 +6853,7 @@ texture = ExtResource("1_rxc3r")
198:10/0 = 0
198:10/0/physics_layer_0/linear_velocity = Vector2(0, 0)
198:10/0/physics_layer_0/angular_velocity = 0.0
198:10/0/physics_layer_0/polygon_0/points = PackedVector2Array(-1, -8, 1.375, -8, 1.125, 8, -1, 8)
199:10/0 = 0
199:10/0/physics_layer_0/linear_velocity = Vector2(0, 0)
199:10/0/physics_layer_0/angular_velocity = 0.0
@@ -7458,6 +7466,7 @@ texture = ExtResource("1_rxc3r")
198:11/0 = 0
198:11/0/physics_layer_0/linear_velocity = Vector2(0, 0)
198:11/0/physics_layer_0/angular_velocity = 0.0
198:11/0/physics_layer_0/polygon_0/points = PackedVector2Array(-1, -8, 1.375, -8, 1.125, 8, -1, 8)
199:11/0 = 0
199:11/0/physics_layer_0/linear_velocity = Vector2(0, 0)
199:11/0/physics_layer_0/angular_velocity = 0.0
@@ -19193,3 +19202,62 @@ target = Vector2(800, 224)
position = Vector2(816, 240)
rotation = -1.5708
target = Vector2(2592, -48)
[node name="coins" type="Node" parent="."]
[node name="Coin" parent="coins" instance=ExtResource("6_evydd")]
position = Vector2(672, 192)
[node name="Coin2" parent="coins" instance=ExtResource("6_evydd")]
position = Vector2(688, 192)
[node name="Coin3" parent="coins" instance=ExtResource("6_evydd")]
position = Vector2(704, 192)
[node name="Coin4" parent="coins" instance=ExtResource("6_evydd")]
position = Vector2(720, 192)
[node name="Coin5" parent="coins" instance=ExtResource("6_evydd")]
position = Vector2(736, 192)
[node name="Coin6" parent="coins" instance=ExtResource("6_evydd")]
position = Vector2(752, 192)
[node name="Coin7" parent="coins" instance=ExtResource("6_evydd")]
position = Vector2(768, 192)
[node name="Coin8" parent="coins" instance=ExtResource("6_evydd")]
position = Vector2(672, 160)
[node name="Coin9" parent="coins" instance=ExtResource("6_evydd")]
position = Vector2(688, 160)
[node name="Coin10" parent="coins" instance=ExtResource("6_evydd")]
position = Vector2(704, 160)
[node name="Coin11" parent="coins" instance=ExtResource("6_evydd")]
position = Vector2(720, 160)
[node name="Coin12" parent="coins" instance=ExtResource("6_evydd")]
position = Vector2(736, 160)
[node name="Coin13" parent="coins" instance=ExtResource("6_evydd")]
position = Vector2(752, 160)
[node name="Coin14" parent="coins" instance=ExtResource("6_evydd")]
position = Vector2(768, 160)
[node name="Coin15" parent="coins" instance=ExtResource("6_evydd")]
position = Vector2(688, 128)
[node name="Coin16" parent="coins" instance=ExtResource("6_evydd")]
position = Vector2(704, 128)
[node name="Coin17" parent="coins" instance=ExtResource("6_evydd")]
position = Vector2(720, 128)
[node name="Coin18" parent="coins" instance=ExtResource("6_evydd")]
position = Vector2(736, 128)
[node name="Coin19" parent="coins" instance=ExtResource("6_evydd")]
position = Vector2(752, 128)
+34 -1
View File
@@ -1,7 +1,9 @@
[gd_scene load_steps=13 format=3 uid="uid://dk1aby88pygtr"]
[gd_scene load_steps=15 format=3 uid="uid://dk1aby88pygtr"]
[ext_resource type="Script" path="res://scripts/player.gd" id="1_lm7ix"]
[ext_resource type="Texture2D" uid="uid://dhw3lpuskbvku" path="res://assets/mario-luigi-4.png" id="1_w3chr"]
[ext_resource type="FontFile" uid="uid://cpwx7datjer6s" path="res://assets/PixelOperator8.ttf" id="3_mkgvb"]
[ext_resource type="Texture2D" uid="uid://d0xxlo60h1d7i" path="res://assets/coinlabel.png" id="4_o0q77"]
[sub_resource type="AtlasTexture" id="AtlasTexture_l22ll"]
atlas = ExtResource("1_w3chr")
@@ -137,6 +139,37 @@ one_shot = true
[node name="pipe_timer_half" type="Timer" parent="."]
one_shot = true
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="Control" type="Control" parent="CanvasLayer"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="CoinAmt" type="Label" parent="CanvasLayer/Control"]
layout_mode = 1
offset_left = 136.0
offset_top = 56.0
offset_right = 241.0
offset_bottom = 104.0
theme_override_colors/font_color = Color(1, 0.627451, 0.266667, 1)
theme_override_fonts/font = ExtResource("3_mkgvb")
theme_override_font_sizes/font_size = 40
text = "0
"
vertical_alignment = 1
[node name="CoinLabel" type="TextureRect" parent="CanvasLayer/Control"]
layout_mode = 0
offset_left = 80.0
offset_top = 56.0
offset_right = 120.0
offset_bottom = 96.0
texture = ExtResource("4_o0q77")
[connection signal="area_entered" from="pipedetector_ground" to="." method="_on_pipedetector_area_entered"]
[connection signal="area_exited" from="pipedetector_ground" to="." method="_on_pipedetector_area_exited"]
[connection signal="area_entered" from="pipedetector_right" to="." method="_on_pipedetector_right_area_entered"]
+5
View File
@@ -0,0 +1,5 @@
extends Area2D
func _on_body_entered(body):
body.increase_coins()
queue_free()
+5 -1
View File
@@ -4,6 +4,7 @@ extends CharacterBody2D
@onready var color_rect = $Camera2D/ColorRect
@onready var pipe_timer = $pipe_timer
@onready var pipe_timer_half = $pipe_timer_half
@onready var coin_amt = $CanvasLayer/Control/CoinAmt
const SPEED = 130.0
@@ -14,7 +15,7 @@ var left_pipe = false
var pipe = null
var pipe_target = null
var coins = 0
# Get the gravity from the project settings to be synced with RigidBody nodes.
var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
var on_pause = false
@@ -75,6 +76,9 @@ func _physics_process(delta):
move_and_slide()
func increase_coins():
coins += 1
coin_amt.text = str(coins)
func _on_pipedetector_area_entered(area):
on_pipe = true