score and lives partially implemented
This commit is contained in:
parent
39ae7beeee
commit
bb8d2a7b97
11 changed files with 250 additions and 3 deletions
BIN
Sprites/SamLife.png
Normal file
BIN
Sprites/SamLife.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
34
Sprites/SamLife.png.import
Normal file
34
Sprites/SamLife.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bwq8fwuhoax4i"
|
||||
path="res://.godot/imported/SamLife.png-2024cbca94d1577c1d36a8b5ca0d9656.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/SamLife.png"
|
||||
dest_files=["res://.godot/imported/SamLife.png-2024cbca94d1577c1d36a8b5ca0d9656.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
|
||||
BIN
Sprites/ScoreLife.png
Normal file
BIN
Sprites/ScoreLife.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.4 KiB |
34
Sprites/ScoreLife.png.import
Normal file
34
Sprites/ScoreLife.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://drtw5y8tfkxp8"
|
||||
path="res://.godot/imported/ScoreLife.png-130362f7dedfbe819c0a9f58ac1366b5.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/ScoreLife.png"
|
||||
dest_files=["res://.godot/imported/ScoreLife.png-130362f7dedfbe819c0a9f58ac1366b5.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
|
||||
BIN
Sprites/hint00.png
Normal file
BIN
Sprites/hint00.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.2 KiB |
34
Sprites/hint00.png.import
Normal file
34
Sprites/hint00.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://n6rnl67gxggv"
|
||||
path="res://.godot/imported/hint00.png-ad7451de35b2c48aeb0a011e3432342e.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/hint00.png"
|
||||
dest_files=["res://.godot/imported/hint00.png-ad7451de35b2c48aeb0a011e3432342e.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
|
||||
BIN
Sprites/targetBG.png
Normal file
BIN
Sprites/targetBG.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2 KiB |
34
Sprites/targetBG.png.import
Normal file
34
Sprites/targetBG.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c8u0xx3dnbcwq"
|
||||
path="res://.godot/imported/targetBG.png-32fdb92588e5d2db60a3d201162c9609.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/targetBG.png"
|
||||
dest_files=["res://.godot/imported/targetBG.png-32fdb92588e5d2db60a3d201162c9609.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
|
||||
81
game.tscn
81
game.tscn
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=7 format=3 uid="uid://sntwtley2f7d"]
|
||||
[gd_scene load_steps=13 format=3 uid="uid://sntwtley2f7d"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://dj6mkweo8kgcs" path="res://Sprites/smol-up.png" id="1_80nbo"]
|
||||
[ext_resource type="Script" uid="uid://c7c1yy0hv1u3r" path="res://logic.gd" id="1_e2o6t"]
|
||||
|
|
@ -6,13 +6,26 @@
|
|||
[ext_resource type="Texture2D" uid="uid://ducbe6ucctlr6" path="res://Sprites/smol-down.png" id="4_ryrav"]
|
||||
[ext_resource type="Texture2D" uid="uid://25g6athehh1s" path="res://Sprites/smol-left.png" id="5_eow3j"]
|
||||
[ext_resource type="Texture2D" uid="uid://y2ytspjqefbk" path="res://Sprites/smol-blank.png" id="6_ryrav"]
|
||||
[ext_resource type="Texture2D" uid="uid://n6rnl67gxggv" path="res://Sprites/hint00.png" id="7_hve3p"]
|
||||
[ext_resource type="Texture2D" uid="uid://drtw5y8tfkxp8" path="res://Sprites/ScoreLife.png" id="8_mfdv2"]
|
||||
[ext_resource type="Texture2D" uid="uid://bwq8fwuhoax4i" path="res://Sprites/SamLife.png" id="9_iotsf"]
|
||||
[ext_resource type="Texture2D" uid="uid://c8u0xx3dnbcwq" path="res://Sprites/targetBG.png" id="10_lc2xo"]
|
||||
|
||||
[node name="Node2D" type="Node2D" node_paths=PackedStringArray("icon_container", "progress_bar", "scroll_container")]
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_215e1"]
|
||||
font_size = 30
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_7sc4i"]
|
||||
font_size = 30
|
||||
|
||||
[node name="Node2D" type="Node2D" node_paths=PackedStringArray("icon_container", "progress_bar", "scroll_container", "score_label", "life_container")]
|
||||
script = ExtResource("1_e2o6t")
|
||||
icon_container = NodePath("CanvasLayer/VBoxContainer/HFlowContainer/HBoxContainer")
|
||||
icons = Array[Texture]([ExtResource("1_80nbo"), ExtResource("3_7jktm"), ExtResource("4_ryrav"), ExtResource("5_eow3j"), ExtResource("6_ryrav")])
|
||||
progress_bar = NodePath("CanvasLayer/VBoxContainer/ProgressBar")
|
||||
scroll_container = NodePath("CanvasLayer/VBoxContainer/HFlowContainer")
|
||||
score_label = NodePath("CanvasLayer/Score_Lives Display/ScoreLabel")
|
||||
life_container = NodePath("CanvasLayer/Score_Lives Display/Lives")
|
||||
life_texture = ExtResource("9_iotsf")
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
|
||||
|
|
@ -209,3 +222,67 @@ texture = ExtResource("6_ryrav")
|
|||
layout_mode = 2
|
||||
max_value = 1.0
|
||||
step = 0.0
|
||||
|
||||
[node name="Hint" type="TextureRect" parent="CanvasLayer"]
|
||||
offset_left = 47.0
|
||||
offset_top = 47.0
|
||||
offset_right = 240.0
|
||||
offset_bottom = 307.0
|
||||
texture = ExtResource("7_hve3p")
|
||||
|
||||
[node name="Score_Lives Display" type="TextureRect" parent="CanvasLayer"]
|
||||
offset_left = 902.0
|
||||
offset_top = 51.0
|
||||
offset_right = 1095.0
|
||||
offset_bottom = 311.0
|
||||
texture = ExtResource("8_mfdv2")
|
||||
|
||||
[node name="ScoreLabel" type="Label" parent="CanvasLayer/Score_Lives Display"]
|
||||
layout_mode = 0
|
||||
offset_left = 36.0
|
||||
offset_top = 111.0
|
||||
offset_right = 156.0
|
||||
offset_bottom = 153.0
|
||||
text = "8888888"
|
||||
label_settings = SubResource("LabelSettings_215e1")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Lives" type="HBoxContainer" parent="CanvasLayer/Score_Lives Display"]
|
||||
layout_mode = 0
|
||||
offset_left = 37.0
|
||||
offset_top = 197.0
|
||||
offset_right = 153.0
|
||||
offset_bottom = 241.0
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="CanvasLayer/Score_Lives Display/Lives"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
texture = ExtResource("9_iotsf")
|
||||
|
||||
[node name="TextureRect2" type="TextureRect" parent="CanvasLayer/Score_Lives Display/Lives"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
texture = ExtResource("9_iotsf")
|
||||
|
||||
[node name="TextureRect3" type="TextureRect" parent="CanvasLayer/Score_Lives Display/Lives"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
texture = ExtResource("9_iotsf")
|
||||
|
||||
[node name="RoundDisplay" type="TextureRect" parent="."]
|
||||
offset_left = 902.0
|
||||
offset_top = 338.0
|
||||
offset_right = 1095.0
|
||||
offset_bottom = 488.0
|
||||
texture = ExtResource("10_lc2xo")
|
||||
|
||||
[node name="Label" type="Label" parent="RoundDisplay"]
|
||||
layout_mode = 0
|
||||
offset_left = 57.0
|
||||
offset_top = 81.0
|
||||
offset_right = 136.0
|
||||
offset_bottom = 123.0
|
||||
text = "8 of 8"
|
||||
label_settings = SubResource("LabelSettings_7sc4i")
|
||||
horizontal_alignment = 1
|
||||
|
|
|
|||
35
logic.gd
35
logic.gd
|
|
@ -8,6 +8,9 @@ extends Node2D
|
|||
@export var icons : Array[Texture]
|
||||
@export var progress_bar : ProgressBar
|
||||
@export var scroll_container : ScrollContainer
|
||||
@export var score_label : Label
|
||||
@export var life_container : HBoxContainer
|
||||
@export var life_texture : Texture
|
||||
var current_time : float = 5
|
||||
var score : int = 0
|
||||
var lives : int = 3
|
||||
|
|
@ -23,14 +26,29 @@ var target_scroll : float
|
|||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
#start_round()
|
||||
draw_lives()
|
||||
pass # Replace with function body.
|
||||
|
||||
func draw_lives():
|
||||
for child in life_container.get_children():
|
||||
child.queue_free()
|
||||
for i in range(lives):
|
||||
var new_tex = TextureRect.new()
|
||||
new_tex.texture = life_texture
|
||||
life_container.add_child(new_tex)
|
||||
|
||||
func lose_life():
|
||||
lives -= 1
|
||||
draw_lives()
|
||||
if lives <= 0:
|
||||
#end game
|
||||
pass
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
target_scroll = (codepos*50) - 550
|
||||
scroll_container.scroll_horizontal = lerpf(scroll_container.scroll_horizontal,target_scroll,0.05)
|
||||
|
||||
score_label.text = str(score)
|
||||
|
||||
if gaming:
|
||||
current_time -= delta
|
||||
|
|
@ -39,6 +57,10 @@ func _process(delta: float) -> void:
|
|||
test_break -= delta
|
||||
if test_break <= 0:
|
||||
start_round()
|
||||
|
||||
if gaming and current_time <= 0:
|
||||
lose_round()
|
||||
|
||||
if Input.is_action_just_pressed("up"):
|
||||
process_input(0)
|
||||
elif Input.is_action_just_pressed("right"):
|
||||
|
|
@ -61,7 +83,9 @@ func process_input(direction : int):
|
|||
if(code[codepos] == direction):
|
||||
#correct input
|
||||
icon_container.get_child(codepos).modulate = Color(0,1,0)
|
||||
score += codepos+1
|
||||
codepos += 1
|
||||
|
||||
if(codepos == code_len):
|
||||
win_round()
|
||||
else:
|
||||
|
|
@ -72,15 +96,24 @@ func process_input(direction : int):
|
|||
icon_container.get_child(i).modulate = Color(1,1,1)
|
||||
|
||||
func win_round():
|
||||
#todo: bous for remaining time?
|
||||
gaming = false
|
||||
codepos = 0
|
||||
test_break = 1.5 # todo: replace with gamer samurai animation stuff
|
||||
if ghost_tokens > 0:
|
||||
ghost_tokens -= 1
|
||||
code_len += 1
|
||||
|
||||
else:
|
||||
ghost_tokens = 2
|
||||
code_len -= 1
|
||||
score += 100
|
||||
|
||||
func lose_round():
|
||||
gaming = false
|
||||
codepos = 0
|
||||
test_break = 1.5
|
||||
lose_life()
|
||||
|
||||
func generate_code():
|
||||
code.clear()
|
||||
|
|
|
|||
|
|
@ -48,5 +48,6 @@ left={
|
|||
|
||||
[rendering]
|
||||
|
||||
textures/canvas_textures/default_texture_filter=0
|
||||
renderer/rendering_method="gl_compatibility"
|
||||
renderer/rendering_method.mobile="gl_compatibility"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue