mirror of
https://github.com/HarmonyHoney/tiny_crate.git
synced 2026-01-23 02:34:53 +00:00
win percentage + box spawner explosion (:
This commit is contained in:
parent
0a7ac740b2
commit
8529b23a87
5 changed files with 212 additions and 66 deletions
|
|
@ -6,6 +6,7 @@ var is_done := false
|
|||
|
||||
onready var node_sprite : Sprite = $Sprite
|
||||
onready var node_audio : AudioStreamPlayer2D = $Audio
|
||||
onready var node_anim := $AnimationPlayer
|
||||
|
||||
export var color := "red"
|
||||
|
||||
|
|
@ -20,4 +21,7 @@ func release():
|
|||
var b = box.instance()
|
||||
b.position = position
|
||||
get_parent().add_child(b)
|
||||
node_anim.play("pop")
|
||||
node_audio.pitch_scale = rand_range(0.8, 1.2)
|
||||
node_audio.play()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,89 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://src/actor/BoxSpawner.gd" type="Script" id=1]
|
||||
[ext_resource path="res://media/image/crate.png" type="Texture" id=2]
|
||||
[ext_resource path="res://media/audio/sfx/hit0.wav" type="AudioStream" id=3]
|
||||
[ext_resource path="res://media/image/explode2.png" type="Texture" id=4]
|
||||
[ext_resource path="res://media/audio/sfx/portal2.wav" type="AudioStream" id=5]
|
||||
|
||||
[sub_resource type="Animation" id=1]
|
||||
resource_name = "pop"
|
||||
length = 0.5
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("Sprite2:region_rect")
|
||||
tracks/0/interp = 0
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 0.1, 0.2, 0.3, 0.4 ),
|
||||
"transitions": PoolRealArray( 1, 1, 1, 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Rect2( 0, 0, 16, 16 ), Rect2( 16, 0, 16, 16 ), Rect2( 32, 0, 16, 16 ), Rect2( 48, 0, 16, 16 ), Rect2( 64, 0, 16, 16 ) ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath("Sprite2:offset")
|
||||
tracks/1/interp = 0
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0, 0.1, 0.2, 0.3, 0.4 ),
|
||||
"transitions": PoolRealArray( 1, 1, 1, 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( 0, 0 ), Vector2( 0, 0 ), Vector2( 0, 0 ), Vector2( 0, 0 ), Vector2( 0, 0 ) ]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/path = NodePath("Sprite2:visible")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/keys = {
|
||||
"times": PoolRealArray( 0, 0.5 ),
|
||||
"transitions": PoolRealArray( 1, 1 ),
|
||||
"update": 1,
|
||||
"values": [ true, false ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=2]
|
||||
resource_name = "shrink"
|
||||
length = 0.1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("Sprite2:region_rect")
|
||||
tracks/0/interp = 0
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 0,
|
||||
"values": [ Rect2( 64, 0, 16, 16 ) ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath("Sprite2:offset")
|
||||
tracks/1/interp = 0
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( 0, 0 ) ]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/path = NodePath("Sprite2:visible")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [ true ]
|
||||
}
|
||||
|
||||
[node name="BoxSpawner" type="Node2D"]
|
||||
script = ExtResource( 1 )
|
||||
|
|
@ -14,6 +95,20 @@ hframes = 16
|
|||
vframes = 8
|
||||
frame = 15
|
||||
|
||||
[node name="Sprite2" type="Sprite" parent="."]
|
||||
position = Vector2( 4, 4 )
|
||||
z_index = 50
|
||||
z_as_relative = false
|
||||
texture = ExtResource( 4 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 64, 0, 16, 16 )
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
autoplay = "pop"
|
||||
anims/pop = SubResource( 1 )
|
||||
anims/shrink = SubResource( 2 )
|
||||
|
||||
[node name="Audio" type="AudioStreamPlayer2D" parent="."]
|
||||
stream = ExtResource( 3 )
|
||||
stream = ExtResource( 5 )
|
||||
attenuation = 0.0544094
|
||||
bus = "SFX"
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ var replay_map := ""
|
|||
var count_gems := 0
|
||||
var count_notes := 0
|
||||
var count_die := 0
|
||||
var count_percent := 0.0
|
||||
|
||||
var is_win := false
|
||||
var is_note := false
|
||||
|
|
@ -447,6 +448,10 @@ func count_score():
|
|||
if i.has("time"): count_gems += 1
|
||||
if i.has("note"): count_notes += 1
|
||||
if i.has("die"): count_die += i["die"]
|
||||
|
||||
var f = 36.0
|
||||
count_percent = ((count_gems * 0.5) / f) + ((count_notes * 0.5) / f)
|
||||
|
||||
|
||||
func sort_replays(a, b):
|
||||
if a["frames"] < b["frames"]:
|
||||
|
|
|
|||
162
src/map/win.tscn
162
src/map/win.tscn
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=28 format=2]
|
||||
[gd_scene load_steps=29 format=2]
|
||||
|
||||
[ext_resource path="res://src/stage/Stage.gd" type="Script" id=1]
|
||||
[ext_resource path="res://src/actor/Exit.tscn" type="PackedScene" id=2]
|
||||
|
|
@ -22,6 +22,7 @@
|
|||
[ext_resource path="res://media/font/m6x11.ttf" type="DynamicFontData" id=20]
|
||||
[ext_resource path="res://media/image/skull.png" type="Texture" id=21]
|
||||
[ext_resource path="res://src/actor/BoxSpawner.tscn" type="PackedScene" id=22]
|
||||
[ext_resource path="res://media/image/menu.png" type="Texture" id=23]
|
||||
|
||||
[sub_resource type="TileSet" id=1]
|
||||
0/name = "solid_bricks.png 0"
|
||||
|
|
@ -155,11 +156,6 @@
|
|||
2/shapes = [ ]
|
||||
2/z_index = 0
|
||||
|
||||
[sub_resource type="ShaderMaterial" id=7]
|
||||
shader = ExtResource( 17 )
|
||||
shader_param/line_color = Color( 0, 0, 0, 1 )
|
||||
shader_param/line_thickness = 1.0
|
||||
|
||||
[sub_resource type="DynamicFont" id=8]
|
||||
outline_size = 1
|
||||
outline_color = Color( 0, 0, 0, 1 )
|
||||
|
|
@ -167,6 +163,11 @@ extra_spacing_bottom = -3
|
|||
extra_spacing_char = 1
|
||||
font_data = ExtResource( 20 )
|
||||
|
||||
[sub_resource type="ShaderMaterial" id=7]
|
||||
shader = ExtResource( 17 )
|
||||
shader_param/line_color = Color( 0, 0, 0, 1 )
|
||||
shader_param/line_thickness = 1.0
|
||||
|
||||
[node name="Stage" type="Node2D"]
|
||||
script = ExtResource( 1 )
|
||||
palette = 0
|
||||
|
|
@ -212,69 +213,29 @@ rect_pivot_offset = Vector2( -185, -20 )
|
|||
script = ExtResource( 10 )
|
||||
|
||||
[node name="VBox" type="VBoxContainer" parent="Control"]
|
||||
margin_left = -56.0
|
||||
margin_top = -65.0
|
||||
margin_right = -16.0
|
||||
margin_bottom = -9.0
|
||||
margin_left = -62.0
|
||||
margin_top = -63.0
|
||||
margin_right = -22.0
|
||||
margin_bottom = -3.0
|
||||
script = ExtResource( 11 )
|
||||
|
||||
[node name="Gems" type="Control" parent="Control/VBox"]
|
||||
margin_right = 40.0
|
||||
margin_bottom = 16.0
|
||||
rect_min_size = Vector2( 0, 16 )
|
||||
|
||||
[node name="Control" type="Control" parent="Control/VBox/Gems"]
|
||||
margin_right = 16.0
|
||||
margin_bottom = 16.0
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="Control/VBox/Gems/Control"]
|
||||
modulate = Color( 1, 0.92549, 0.152941, 1 )
|
||||
material = SubResource( 7 )
|
||||
position = Vector2( 8, 8 )
|
||||
texture = ExtResource( 18 )
|
||||
|
||||
[node name="Label" type="Label" parent="Control/VBox/Gems"]
|
||||
margin_left = 17.0
|
||||
margin_top = 3.0
|
||||
margin_right = 78.0
|
||||
margin_bottom = 14.0
|
||||
custom_fonts/font = SubResource( 8 )
|
||||
text = "30/36"
|
||||
valign = 1
|
||||
|
||||
[node name="Notes" type="Control" parent="Control/VBox"]
|
||||
margin_top = 20.0
|
||||
margin_right = 40.0
|
||||
margin_bottom = 36.0
|
||||
rect_min_size = Vector2( 0, 16 )
|
||||
|
||||
[node name="Control" type="Control" parent="Control/VBox/Notes"]
|
||||
margin_top = -2.0
|
||||
margin_right = 16.0
|
||||
margin_bottom = 14.0
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="Control/VBox/Notes/Control"]
|
||||
material = SubResource( 7 )
|
||||
position = Vector2( 8, 8 )
|
||||
texture = ExtResource( 19 )
|
||||
|
||||
[node name="Label" type="Label" parent="Control/VBox/Notes"]
|
||||
margin_left = 17.0
|
||||
margin_right = 78.0
|
||||
[node name="Label" type="Label" parent="Control/VBox"]
|
||||
margin_right = 73.0
|
||||
margin_bottom = 11.0
|
||||
custom_fonts/font = SubResource( 8 )
|
||||
text = "13/36"
|
||||
text = "YOU WIN !!!"
|
||||
valign = 1
|
||||
|
||||
[node name="Die" type="Control" parent="Control/VBox"]
|
||||
margin_top = 40.0
|
||||
margin_right = 40.0
|
||||
margin_bottom = 56.0
|
||||
rect_min_size = Vector2( 0, 16 )
|
||||
margin_top = 15.0
|
||||
margin_right = 73.0
|
||||
margin_bottom = 27.0
|
||||
rect_min_size = Vector2( 0, 12 )
|
||||
|
||||
[node name="Control" type="Control" parent="Control/VBox/Die"]
|
||||
margin_left = -2.0
|
||||
margin_top = -2.0
|
||||
margin_right = 16.0
|
||||
margin_right = 14.0
|
||||
margin_bottom = 14.0
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="Control/VBox/Die/Control"]
|
||||
|
|
@ -283,11 +244,90 @@ position = Vector2( 8, 8 )
|
|||
texture = ExtResource( 21 )
|
||||
|
||||
[node name="Label" type="Label" parent="Control/VBox/Die"]
|
||||
margin_left = 17.0
|
||||
margin_right = 78.0
|
||||
margin_left = 15.0
|
||||
margin_right = 76.0
|
||||
margin_bottom = 11.0
|
||||
custom_fonts/font = SubResource( 8 )
|
||||
text = "592"
|
||||
valign = 1
|
||||
|
||||
[node name="Gems" type="Control" parent="Control/VBox"]
|
||||
margin_top = 31.0
|
||||
margin_right = 73.0
|
||||
margin_bottom = 43.0
|
||||
rect_min_size = Vector2( 0, 12 )
|
||||
|
||||
[node name="Control" type="Control" parent="Control/VBox/Gems"]
|
||||
margin_left = -2.0
|
||||
margin_top = -2.0
|
||||
margin_right = 14.0
|
||||
margin_bottom = 14.0
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="Control/VBox/Gems/Control"]
|
||||
modulate = Color( 1, 0.92549, 0.152941, 1 )
|
||||
material = SubResource( 7 )
|
||||
position = Vector2( 8, 8 )
|
||||
texture = ExtResource( 18 )
|
||||
|
||||
[node name="Label" type="Label" parent="Control/VBox/Gems"]
|
||||
margin_left = 15.0
|
||||
margin_right = 76.0
|
||||
margin_bottom = 11.0
|
||||
custom_fonts/font = SubResource( 8 )
|
||||
text = "30/36"
|
||||
valign = 1
|
||||
|
||||
[node name="Notes" type="Control" parent="Control/VBox"]
|
||||
margin_top = 47.0
|
||||
margin_right = 73.0
|
||||
margin_bottom = 59.0
|
||||
rect_min_size = Vector2( 0, 12 )
|
||||
|
||||
[node name="Control" type="Control" parent="Control/VBox/Notes"]
|
||||
margin_left = -2.0
|
||||
margin_top = -2.0
|
||||
margin_right = 14.0
|
||||
margin_bottom = 14.0
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="Control/VBox/Notes/Control"]
|
||||
material = SubResource( 7 )
|
||||
position = Vector2( 8, 8 )
|
||||
texture = ExtResource( 19 )
|
||||
|
||||
[node name="Label" type="Label" parent="Control/VBox/Notes"]
|
||||
margin_left = 15.0
|
||||
margin_right = 76.0
|
||||
margin_bottom = 11.0
|
||||
custom_fonts/font = SubResource( 8 )
|
||||
text = "13/36"
|
||||
valign = 1
|
||||
|
||||
[node name="Total" type="Control" parent="Control/VBox"]
|
||||
margin_top = 63.0
|
||||
margin_right = 73.0
|
||||
margin_bottom = 75.0
|
||||
rect_min_size = Vector2( 0, 12 )
|
||||
|
||||
[node name="Control" type="Control" parent="Control/VBox/Total"]
|
||||
margin_left = -2.0
|
||||
margin_top = -2.0
|
||||
margin_right = 14.0
|
||||
margin_bottom = 14.0
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="Control/VBox/Total/Control"]
|
||||
material = SubResource( 7 )
|
||||
position = Vector2( 8, 8 )
|
||||
texture = ExtResource( 23 )
|
||||
hframes = 4
|
||||
vframes = 4
|
||||
frame = 2
|
||||
|
||||
[node name="Label" type="Label" parent="Control/VBox/Total"]
|
||||
margin_left = 15.0
|
||||
margin_right = 76.0
|
||||
margin_bottom = 11.0
|
||||
custom_fonts/font = SubResource( 8 )
|
||||
text = "97.02%"
|
||||
valign = 1
|
||||
|
||||
[editable path="GameCamera"]
|
||||
|
|
|
|||
|
|
@ -3,8 +3,10 @@ extends CanvasItem
|
|||
onready var gem_label := $VBox/Gems/Label
|
||||
onready var note_label := $VBox/Notes/Label
|
||||
onready var die_label := $VBox/Die/Label
|
||||
onready var total_label := $VBox/Total/Label
|
||||
|
||||
func _ready():
|
||||
gem_label.text = str(Shared.count_gems) + " / 36"
|
||||
note_label.text = str(Shared.count_notes) + " / 36"
|
||||
total_label.text = str(Shared.count_percent * 100.0).pad_decimals(2) + "%"
|
||||
gem_label.text = str(Shared.count_gems)# + " / 36"
|
||||
note_label.text = str(Shared.count_notes)# + " / 36"
|
||||
die_label.text = str(Shared.count_die)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue