added saving

This commit is contained in:
pennyrigate 2023-01-03 20:52:30 -05:00
parent 1ca21d438f
commit 969364ebce
40 changed files with 625 additions and 88 deletions

View file

@ -1,3 +1,3 @@
source_md5="c8db8b1c88764e5a7f5a5a1f7fb47a41"
dest_md5="7620ce6045a282839caeaf946382dd77"
source_md5="fb67ed3d8705bb1b1df3f390f7c0a76e"
dest_md5="7b559cefb37e265b48ad90421f94dcb4"

View file

@ -0,0 +1,3 @@
source_md5="c8db8b1c88764e5a7f5a5a1f7fb47a41"
dest_md5="7620ce6045a282839caeaf946382dd77"

View file

@ -0,0 +1,3 @@
source_md5="5df0186c7efc418aab4bbbb4a607225e"
dest_md5="8a5ed461e0767c5bdc12db58e6743e05"

View file

@ -0,0 +1,3 @@
source_md5="5d11ec7621772ba701c050f01d67583a"
dest_md5="39fa25b6bddfa7660a03f438684583ae"

View file

@ -0,0 +1,3 @@
source_md5="34535b07495be808914a380f90fd87e7"
dest_md5="79a7df7ae2329a369be13218be8e7abb"

View file

@ -0,0 +1,3 @@
source_md5="fe2bd66edb79cdea2a04031a4d4e5da8"
dest_md5="77965935ebf840b8c8251b2ffa77cb23"

33
game.gd
View file

@ -34,8 +34,10 @@ onready var a_shoot = preload("res://audio/sounds/a_egg_shoot.ogg")
onready var a_die = preload("res://audio/sounds/a_hurt.ogg")
#Objects
onready var block_text = preload("res://objects/hud/blocktext.tscn")
#Respawn point
var respawn_point = Vector2(32,166)
var respawn_point = Vector2(32,166) #Respawn point
var current_level = 0 #Current level being played
var current_file = 1 #Current save file
var shards_collected = [false,false,false,false,false,false,false,false,false,false]
#Instances a node
func instance_node(node:PackedScene,x:float,y:float,parent):
@ -58,9 +60,36 @@ func get_map():
#Go to new map
func change_map(map):
shards_collected = [false,false,false,false,false,false,false,false,false,false]
get_map().queue_free()
instance_node(map,0,0,viewport)
#Clear data
func clear_collectibles():
Game.score = 0
Game.golds = 0
Game.stars = [false,false,false,false,false]
Game.shards = 0
Game.arrows = 0
Game.lives = 2
#Save
func save():
var save = ConfigFile.new()
save.set_value(str(current_level),"High Score",Game.score)
save.set_value(str(current_level),"Golds",Game.golds)
save.set_value(str(current_level),"Shard0",Game.shards_collected[0])
save.set_value(str(current_level),"Shard1",Game.shards_collected[1])
save.set_value(str(current_level),"Shard2",Game.shards_collected[2])
save.set_value(str(current_level),"Shard3",Game.shards_collected[3])
save.set_value(str(current_level),"Shard4",Game.shards_collected[4])
save.set_value(str(current_level),"Shard5",Game.shards_collected[5])
save.set_value(str(current_level),"Shard6",Game.shards_collected[6])
save.set_value(str(current_level),"Shard7",Game.shards_collected[7])
save.set_value(str(current_level),"Shard8",Game.shards_collected[8])
save.set_value(str(current_level),"Shard9",Game.shards_collected[9])
save.save(str("user://file") + str(current_file) + str(".pr"))
func _process(delta):
#CRT FILTER
if Input.is_action_just_pressed("crt"):

Binary file not shown.

Before

Width:  |  Height:  |  Size: 420 B

After

Width:  |  Height:  |  Size: 835 B

Before After
Before After

BIN
graphics/hud/hud_old.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 420 B

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/hud_old.png-375dbe46e18dedab40b4fcb3c0bcf043.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://graphics/hud/hud_old.png"
dest_files=[ "res://.import/hud_old.png-375dbe46e18dedab40b4fcb3c0bcf043.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 B

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/levelselect_arrow.png-6a165a1051a0c8d94781310f1fd64758.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://graphics/hud/levelselect_arrow.png"
dest_files=[ "res://.import/levelselect_arrow.png-6a165a1051a0c8d94781310f1fd64758.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/levelselect_border.png-11192234a11b3fa8b5fde8905419f955.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://graphics/hud/levelselect_border.png"
dest_files=[ "res://.import/levelselect_border.png-11192234a11b3fa8b5fde8905419f955.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/levelselect_nexlevel.png-7b5414d44097edee437881d0f20be3ce.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://graphics/hud/levelselect_nexlevel.png"
dest_files=[ "res://.import/levelselect_nexlevel.png-7b5414d44097edee437881d0f20be3ce.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

BIN
graphics/hud/stars_hud.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 B

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/stars_hud.png-8d3be9176bacfd7093743651807c1fb5.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://graphics/hud/stars_hud.png"
dest_files=[ "res://.import/stars_hud.png-8d3be9176bacfd7093743651807c1fb5.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

79
maps/level_select.gd Normal file
View file

@ -0,0 +1,79 @@
extends Node2D
##Onreadys
onready var levels = preload("res://maps/leveldata/levels.tres")
onready var title = $Title
onready var shard_title = $ShardTitle
onready var shard_arrow = $ShardArrow
onready var high_score = $HighScore
onready var golds = $Golds
onready var levelarrow_up = $LevelArrowUp
onready var levelarrow_down = $LevelArrowDown
#Shards
onready var shard0 = $ShardGraphics/Shard
onready var shard1 = $ShardGraphics/Shard2
onready var shard2 = $ShardGraphics/Shard3
onready var shard3 = $ShardGraphics/Shard4
onready var shard4 = $ShardGraphics/Shard5
onready var shard5 = $ShardGraphics/Shard6
onready var shard6 = $ShardGraphics/Shard7
onready var shard7 = $ShardGraphics/Shard8
onready var shard8 = $ShardGraphics/Shard9
onready var shard9 = $ShardGraphics/Shard10
##Runtime
var save = 0
var current_level = 0
var current_shard = 0
# Called when the node enters the scene tree for the first time.
func _ready():
pass
func _physics_process(delta):
if Input.is_action_just_pressed("ui_up"): change_current_level(-1)
if Input.is_action_just_pressed("ui_down"): change_current_level(1)
if Input.is_action_just_pressed("ui_left"): change_current_shard(-1)
if Input.is_action_just_pressed("ui_right"): change_current_shard(1)
#Draw level title
title.text = levels.level[current_level].level_title
#Draw Shard Title
shard_title.text = levels.level[current_level].shard_title[current_shard]
func change_current_shard(amount):
if current_shard + amount != -1 && current_shard + amount != 10: #Check if in range
current_shard += amount
shard_arrow.position.x += 15 * amount
func change_current_level(amount):
if current_level + amount != -1 && current_level + amount != levels.level.size(): #Check if in range
current_level += amount
#Show arrows or don't
if current_level == 0:
levelarrow_up.visible = false
levelarrow_down.visible = true
elif current_level == levels.level.size() - 1:
levelarrow_up.visible = true
levelarrow_down.visible = false
else:
levelarrow_down.visible = true
levelarrow_up.visible = true
#Return Shard select
current_shard = 0
shard_arrow.position.x = 61
#Load new data
var save = ConfigFile.new()
save.load(str("user://file") + str(Game.current_file) + str(".pr"))
#Draw score and golds
high_score.text = str("%06d" % save.get_value(str(current_level),"High Score",0))
golds.text = str("%02d" % save.get_value(str(current_level),"Golds",0))
#Draw shards collected
shard0.visible = save.get_value(str(current_level),"Shard0",false)
shard1.visible = save.get_value(str(current_level),"Shard1",false)
shard2.visible = save.get_value(str(current_level),"Shard2",false)
shard3.visible = save.get_value(str(current_level),"Shard3",false)
shard4.visible = save.get_value(str(current_level),"Shard4",false)
shard5.visible = save.get_value(str(current_level),"Shard5",false)
shard6.visible = save.get_value(str(current_level),"Shard6",false)
shard7.visible = save.get_value(str(current_level),"Shard7",false)
shard8.visible = save.get_value(str(current_level),"Shard8",false)
shard9.visible = save.get_value(str(current_level),"Shard9",false)

218
maps/level_select.tscn Normal file
View file

@ -0,0 +1,218 @@
[gd_scene load_steps=12 format=2]
[ext_resource path="res://scripts/theme.tres" type="Theme" id=1]
[ext_resource path="res://graphics/hud/levelselect_border.png" type="Texture" id=2]
[ext_resource path="res://scripts/1px_border.gdshader" type="Shader" id=3]
[ext_resource path="res://graphics/hud/levelselect_arrow.png" type="Texture" id=4]
[ext_resource path="res://objects/collectibles/gold.tscn" type="PackedScene" id=5]
[ext_resource path="res://graphics/hud/levelselect_nexlevel.png" type="Texture" id=6]
[ext_resource path="res://maps/level_select.gd" type="Script" id=7]
[ext_resource path="res://graphics/collectibles/shard.png" type="Texture" id=8]
[ext_resource path="res://objects/collectibles/shard.tscn" type="PackedScene" id=9]
[sub_resource type="TileSet" id=1]
0/name = "levelselect_border.png 0"
0/texture = ExtResource( 2 )
0/tex_offset = Vector2( 0, 0 )
0/modulate = Color( 1, 1, 1, 1 )
0/region = Rect2( 0, 0, 24, 8 )
0/tile_mode = 2
0/autotile/icon_coordinate = Vector2( 0, 0 )
0/autotile/tile_size = Vector2( 8, 8 )
0/autotile/spacing = 0
0/autotile/occluder_map = [ ]
0/autotile/navpoly_map = [ ]
0/autotile/priority_map = [ ]
0/autotile/z_index_map = [ ]
0/occluder_offset = Vector2( 0, 0 )
0/navigation_offset = Vector2( 0, 0 )
0/shape_offset = Vector2( 0, 0 )
0/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
0/shape_one_way = false
0/shape_one_way_margin = 0.0
0/shapes = [ ]
0/z_index = 0
[sub_resource type="ShaderMaterial" id=2]
shader = ExtResource( 3 )
shader_param/border_color = Color( 0, 0, 0, 1 )
shader_param/border_corners = false
[node name="LevelSelect" type="Node2D"]
script = ExtResource( 7 )
[node name="BackGround" type="ColorRect" parent="."]
margin_right = 256.0
margin_bottom = 192.0
color = Color( 0, 0, 0, 1 )
[node name="ColorRect2" type="ColorRect" parent="."]
margin_left = 43.0
margin_top = 48.0
margin_right = 213.0
margin_bottom = 144.0
color = Color( 0.239216, 0.239216, 0.443137, 1 )
[node name="Border" type="TileMap" parent="."]
tile_set = SubResource( 1 )
cell_size = Vector2( 8, 8 )
format = 1
tile_data = PoolIntArray( 327685, 0, 0, 327686, 536870912, 1, 327687, 0, 1, 327688, 0, 1, 327689, 0, 1, 327690, 0, 1, 327691, 0, 1, 327692, 0, 1, 327693, 0, 1, 327694, 0, 1, 327695, 0, 1, 327696, 0, 1, 327697, 0, 1, 327698, 0, 1, 327699, 0, 1, 327700, 0, 1, 327701, 0, 1, 327702, 0, 1, 327703, 0, 1, 327704, 0, 1, 327705, 0, 1, 327706, 536870912, 0, 393221, 1073741824, 2, 393242, 1610612736, 2, 458757, 1073741824, 2, 458778, 1610612736, 2, 524293, 1073741824, 2, 524314, 1610612736, 2, 589829, 1073741824, 2, 589850, 1610612736, 2, 655365, 1073741824, 2, 655386, 1610612736, 2, 720901, 1073741824, 2, 720922, 1610612736, 2, 786437, 1073741824, 2, 786458, 1610612736, 2, 851973, 1073741824, 2, 851994, 1610612736, 2, 917509, 1073741824, 2, 917530, 1610612736, 2, 983045, 1073741824, 2, 983066, 1610612736, 2, 1048581, 1073741824, 2, 1048602, 1610612736, 2, 1114117, 1073741824, 2, 1114138, 1610612736, 2, 1179653, 1073741824, 0, 1179654, 1073741824, 1, 1179655, 1610612736, 1, 1179656, 1610612736, 1, 1179657, 1610612736, 1, 1179658, 1610612736, 1, 1179659, 1610612736, 1, 1179660, 1610612736, 1, 1179661, 1610612736, 1, 1179662, 1610612736, 1, 1179663, 1610612736, 1, 1179664, 1610612736, 1, 1179665, 1610612736, 1, 1179666, 1610612736, 1, 1179667, 1610612736, 1, 1179668, 1610612736, 1, 1179669, 1610612736, 1, 1179670, 1610612736, 1, 1179671, 1610612736, 1, 1179672, 1610612736, 1, 1179673, 1073741824, 1, 1179674, 1610612736, 0 )
[node name="Title" type="Label" parent="."]
margin_left = 72.0
margin_top = 48.0
margin_right = 184.0
margin_bottom = 68.0
theme = ExtResource( 1 )
text = "test text"
align = 1
[node name="Golds" type="Label" parent="."]
margin_left = 120.0
margin_top = 88.0
margin_right = 136.0
margin_bottom = 108.0
theme = ExtResource( 1 )
text = "00"
align = 1
[node name="HighScoreText" type="Label" parent="."]
margin_left = 56.0
margin_top = 64.0
margin_right = 200.0
margin_bottom = 96.0
theme = ExtResource( 1 )
text = "High Score:"
align = 1
[node name="HighScore" type="Label" parent="."]
margin_left = 56.0
margin_top = 76.0
margin_right = 200.0
margin_bottom = 108.0
theme = ExtResource( 1 )
text = "000000"
align = 1
[node name="ShardTitle" type="Label" parent="."]
margin_left = 43.0
margin_top = 124.0
margin_right = 213.0
margin_bottom = 167.0
theme = ExtResource( 1 )
text = "Collect all coins
"
align = 1
[node name="ShardGraphics" type="Node2D" parent="."]
[node name="Shard11" type="Sprite" parent="ShardGraphics"]
modulate = Color( 0, 0, 0, 1 )
material = SubResource( 2 )
position = Vector2( 61, 118 )
texture = ExtResource( 8 )
[node name="Shard12" type="Sprite" parent="ShardGraphics"]
modulate = Color( 0, 0, 0, 1 )
material = SubResource( 2 )
position = Vector2( 76, 118 )
texture = ExtResource( 8 )
[node name="Shard13" type="Sprite" parent="ShardGraphics"]
modulate = Color( 0, 0, 0, 1 )
material = SubResource( 2 )
position = Vector2( 91, 118 )
texture = ExtResource( 8 )
[node name="Shard14" type="Sprite" parent="ShardGraphics"]
modulate = Color( 0, 0, 0, 1 )
material = SubResource( 2 )
position = Vector2( 106, 118 )
texture = ExtResource( 8 )
[node name="Shard15" type="Sprite" parent="ShardGraphics"]
modulate = Color( 0, 0, 0, 1 )
material = SubResource( 2 )
position = Vector2( 121, 118 )
texture = ExtResource( 8 )
[node name="Shard16" type="Sprite" parent="ShardGraphics"]
modulate = Color( 0, 0, 0, 1 )
material = SubResource( 2 )
position = Vector2( 136, 118 )
texture = ExtResource( 8 )
[node name="Shard17" type="Sprite" parent="ShardGraphics"]
modulate = Color( 0, 0, 0, 1 )
material = SubResource( 2 )
position = Vector2( 151, 118 )
texture = ExtResource( 8 )
[node name="Shard18" type="Sprite" parent="ShardGraphics"]
modulate = Color( 0, 0, 0, 1 )
material = SubResource( 2 )
position = Vector2( 166, 118 )
texture = ExtResource( 8 )
[node name="Shard19" type="Sprite" parent="ShardGraphics"]
modulate = Color( 0, 0, 0, 1 )
material = SubResource( 2 )
position = Vector2( 181, 118 )
texture = ExtResource( 8 )
[node name="Shard20" type="Sprite" parent="ShardGraphics"]
modulate = Color( 0, 0, 0, 1 )
material = SubResource( 2 )
position = Vector2( 196, 118 )
texture = ExtResource( 8 )
[node name="Shard" parent="ShardGraphics" instance=ExtResource( 9 )]
position = Vector2( 56, 115 )
[node name="Shard2" parent="ShardGraphics" instance=ExtResource( 9 )]
position = Vector2( 71, 115 )
[node name="Shard3" parent="ShardGraphics" instance=ExtResource( 9 )]
position = Vector2( 86, 115 )
[node name="Shard4" parent="ShardGraphics" instance=ExtResource( 9 )]
position = Vector2( 101, 115 )
[node name="Shard5" parent="ShardGraphics" instance=ExtResource( 9 )]
position = Vector2( 116, 115 )
[node name="Shard6" parent="ShardGraphics" instance=ExtResource( 9 )]
position = Vector2( 131, 115 )
[node name="Shard7" parent="ShardGraphics" instance=ExtResource( 9 )]
position = Vector2( 146, 115 )
[node name="Shard8" parent="ShardGraphics" instance=ExtResource( 9 )]
position = Vector2( 161, 115 )
[node name="Shard9" parent="ShardGraphics" instance=ExtResource( 9 )]
position = Vector2( 176, 115 )
[node name="Shard10" parent="ShardGraphics" instance=ExtResource( 9 )]
position = Vector2( 191, 115 )
[node name="Gold" parent="." instance=ExtResource( 5 )]
position = Vector2( 111, 91 )
[node name="ShardArrow" type="Sprite" parent="."]
position = Vector2( 61, 106 )
texture = ExtResource( 4 )
[node name="LevelArrowUp" type="Sprite" parent="."]
visible = false
position = Vector2( 128, 40 )
texture = ExtResource( 6 )
region_enabled = true
region_rect = Rect2( 0, 0, 8, 8 )
[node name="LevelArrowDown" type="Sprite" parent="."]
position = Vector2( 128, 152 )
texture = ExtResource( 6 )
region_enabled = true
region_rect = Rect2( 8, 0, 8, 8 )

View file

@ -0,0 +1,9 @@
[gd_resource type="Resource" load_steps=2 format=2]
[ext_resource path="res://maps/leveldata/level_info.gd" type="Script" id=1]
[resource]
script = ExtResource( 1 )
level_title = "Level 0"
shard_title = [ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j" ]
level_number = 0

View file

@ -0,0 +1,9 @@
[gd_resource type="Resource" load_steps=2 format=2]
[ext_resource path="res://maps/leveldata/level_info.gd" type="Script" id=1]
[resource]
script = ExtResource( 1 )
level_title = "Level 1"
shard_title = [ "Climb the big vine", "Next to the lone tree", "Slime's Treasure", "The snake pit", "5 Rainbow Stars", "All Shards + Beat 0:00", "Beat 000000 score", "Collect Everything", "Beat without dying", "No turning platforms" ]
level_number = 1

View file

@ -0,0 +1,5 @@
extends Resource
export var level_title = ""
export var shard_title = ["","","","","","","","","","",]
export var level_number = 0 #level number, used for saving not for level order

3
maps/leveldata/levels.gd Normal file
View file

@ -0,0 +1,3 @@
extends Resource
export var level = []

View file

@ -0,0 +1,9 @@
[gd_resource type="Resource" load_steps=4 format=2]
[ext_resource path="res://maps/leveldata/level1_info.tres" type="Resource" id=1]
[ext_resource path="res://maps/leveldata/levels.gd" type="Script" id=2]
[ext_resource path="res://maps/leveldata/level0_info.tres" type="Resource" id=3]
[resource]
script = ExtResource( 2 )
level = [ ExtResource( 3 ), ExtResource( 1 ) ]

View file

@ -2,3 +2,4 @@ extends Node2D
func _ready():
Game.play_sound(load("res://audio/music/rumble_loop.mp3"),Game.ac_music)
Game.current_level = 1

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,7 @@
extends Node2D
export var value = 1
export var number = 0 #Used for saving which specific shards collected
func _ready():
$AnimationPlayer.play("glow")
@ -11,4 +12,5 @@ func _on_Area2D_area_entered(area):
Game.play_sound(Game.a_shard,Game.ac_collectible)
Game.score += 500
Game.shards += value
Game.shards_collected[number] = true
queue_free()

View file

@ -30,5 +30,6 @@ func _on_Area2D_area_entered(area):
if Game.stars[0] && Game.stars[1] && Game.stars[2] && Game.stars[3] && Game.stars[4]:
Game.play_sound(Game.a_shard,Game.ac_collectible)
Game.shards += 1
Game.shards_collected[4] = true
Game.score += 500
queue_free()

View file

@ -16,4 +16,5 @@ func _physics_process(delta):
func _on_Area2D_area_entered(area):
if area.is_in_group("player"):
if Game.score > Game.high_score: Game.high_score = Game.score
Game.change_map(load("res://maps/demo_end.tscn"))
Game.save()
Game.change_map(load("res://maps/level_select.tscn"))

View file

@ -14,7 +14,7 @@ onready var high_counter = $HighCounter
func _physics_process(delta):
#Gold Counter
gold_counter.text = "%03d" % Game.golds
gold_counter.text = "%02d" % Game.golds
#Shard Counter
shard_counter.text = "%02d" % Game.shards
#Star Counter
@ -29,6 +29,6 @@ func _physics_process(delta):
arrow_counter.text = "%02d" % Game.arrows
##TOUCH UP LATER
#Lives counter
lives_counter.text = str("LIVES:") + str(Game.lives)
lives_counter.text = str(Game.lives)
#High counter
high_counter.text = str("HIGH:") + str("%06d" % Game.high_score)

View file

@ -1,35 +1,13 @@
[gd_scene load_steps=16 format=2]
[gd_scene load_steps=7 format=2]
[ext_resource path="res://scripts/recolor.tres" type="Shader" id=1]
[ext_resource path="res://graphics/collectibles/pal_star_yellow.png" type="Texture" id=2]
[ext_resource path="res://graphics/hud/stars_hud.png" type="Texture" id=1]
[ext_resource path="res://graphics/hud/hud.png" type="Texture" id=3]
[ext_resource path="res://graphics/collectibles/star.png" type="Texture" id=4]
[ext_resource path="res://graphics/collectibles/pal_star_red.png" type="Texture" id=5]
[ext_resource path="res://objects/hud/hud.gd" type="Script" id=6]
[ext_resource path="res://graphics/collectibles/pal_star_green.png" type="Texture" id=7]
[ext_resource path="res://graphics/collectibles/pal_star_blue.png" type="Texture" id=8]
[ext_resource path="res://graphics/collectibles/pal_star_magenta.png" type="Texture" id=9]
[ext_resource path="res://scripts/theme.tres" type="Theme" id=10]
[sub_resource type="ShaderMaterial" id=1]
shader = ExtResource( 1 )
shader_param/palette = ExtResource( 5 )
[sub_resource type="ShaderMaterial" id=2]
shader = ExtResource( 1 )
shader_param/palette = ExtResource( 2 )
[sub_resource type="ShaderMaterial" id=3]
shader = ExtResource( 1 )
shader_param/palette = ExtResource( 7 )
[sub_resource type="ShaderMaterial" id=4]
shader = ExtResource( 1 )
shader_param/palette = ExtResource( 8 )
[sub_resource type="ShaderMaterial" id=5]
shader = ExtResource( 1 )
shader_param/palette = ExtResource( 9 )
[node name="CanvasLayer" type="CanvasLayer"]
layer = 100
@ -40,82 +18,76 @@ margin_bottom = 1.0
script = ExtResource( 6 )
[node name="Back" type="Sprite" parent="HUD"]
position = Vector2( 128, 8 )
position = Vector2( 128, 95 )
texture = ExtResource( 3 )
[node name="GoldCounter" type="Label" parent="HUD"]
margin_left = 14.0
margin_top = 1.0
margin_right = 54.0
margin_bottom = 21.0
margin_left = 12.0
margin_top = -2.0
margin_right = 52.0
margin_bottom = 18.0
theme = ExtResource( 10 )
text = "000"
text = "00
"
[node name="ShardCounter" type="Label" parent="HUD"]
margin_left = 53.0
margin_top = 1.0
margin_right = 93.0
margin_bottom = 21.0
margin_left = 41.0
margin_top = -2.0
margin_right = 81.0
margin_bottom = 18.0
theme = ExtResource( 10 )
text = "00"
[node name="RedStar" type="Sprite" parent="HUD"]
visible = false
material = SubResource( 1 )
position = Vector2( 79, 8 )
texture = ExtResource( 4 )
position = Vector2( 86, 5 )
texture = ExtResource( 1 )
region_enabled = true
region_rect = Rect2( 0, 0, 11, 11 )
region_rect = Rect2( 0, 0, 8, 8 )
[node name="YellowStar" type="Sprite" parent="HUD"]
visible = false
material = SubResource( 2 )
position = Vector2( 92, 8 )
texture = ExtResource( 4 )
position = Vector2( 96, 5 )
texture = ExtResource( 1 )
region_enabled = true
region_rect = Rect2( 0, 0, 11, 11 )
region_rect = Rect2( 8, 0, 8, 8 )
[node name="GreenStar" type="Sprite" parent="HUD"]
visible = false
material = SubResource( 3 )
position = Vector2( 105, 8 )
texture = ExtResource( 4 )
position = Vector2( 106, 5 )
texture = ExtResource( 1 )
region_enabled = true
region_rect = Rect2( 0, 0, 11, 11 )
region_rect = Rect2( 16, 0, 8, 8 )
[node name="BlueStar" type="Sprite" parent="HUD"]
visible = false
material = SubResource( 4 )
position = Vector2( 118, 8 )
texture = ExtResource( 4 )
position = Vector2( 116, 5 )
texture = ExtResource( 1 )
region_enabled = true
region_rect = Rect2( 0, 0, 11, 11 )
region_rect = Rect2( 24, 0, 8, 8 )
[node name="MagentaStar" type="Sprite" parent="HUD"]
visible = false
material = SubResource( 5 )
position = Vector2( 131, 8 )
texture = ExtResource( 4 )
position = Vector2( 126, 5 )
texture = ExtResource( 1 )
region_enabled = true
region_rect = Rect2( 0, 0, 11, 11 )
region_rect = Rect2( 32, 0, 8, 8 )
[node name="ScoreText" type="Label" parent="HUD"]
margin_left = 142.0
margin_top = 1.0
margin_right = 226.0
margin_bottom = 21.0
margin_left = 137.0
margin_top = -2.0
margin_right = 221.0
margin_bottom = 18.0
theme = ExtResource( 10 )
text = "SCORE:"
[node name="ScoreCounter" type="Label" parent="HUD"]
margin_left = 180.0
margin_top = 1.0
margin_right = 264.0
margin_bottom = 21.0
margin_left = 179.0
margin_top = -2.0
margin_right = 263.0
margin_bottom = 18.0
theme = ExtResource( 10 )
text = "000000"
[node name="HighCounter" type="Label" parent="HUD"]
visible = false
margin_left = 178.0
margin_top = 178.0
margin_right = 262.0
@ -124,17 +96,17 @@ theme = ExtResource( 10 )
text = "High:000000"
[node name="LivesCounter" type="Label" parent="HUD"]
margin_left = 1.0
margin_top = 178.0
margin_right = 85.0
margin_bottom = 198.0
margin_left = 240.0
margin_top = -2.0
margin_right = 324.0
margin_bottom = 18.0
theme = ExtResource( 10 )
text = "Lives:2"
text = "2"
[node name="ArrowCounter" type="Label" parent="HUD"]
margin_left = 237.0
margin_top = 1.0
margin_right = 321.0
margin_bottom = 21.0
margin_left = 68.0
margin_top = -2.0
margin_right = 152.0
margin_bottom = 18.0
theme = ExtResource( 10 )
text = "00"
text = "0"

View file

@ -278,4 +278,9 @@ func debug():
if Input.is_action_pressed("debug_move_player"):
position = get_viewport().get_mouse_position()
print(get_viewport().get_mouse_position())
if Input.is_action_just_pressed("debug_1"):
Game.save()
if Input.is_action_just_pressed("debug_2"):
var save = ConfigFile.new()
save.load(str("user://file") + str(1) + str(".pr"))
Game.score = save.get_value(str(Game.current_level),"Score",0)

View file

@ -103,6 +103,11 @@ fullscreen={
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":70,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
]
}
debug_2={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":50,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
]
}
[physics]