mirror of
https://github.com/HarmonyHoney/tiny_crate.git
synced 2026-01-23 02:34:53 +00:00
More Creator progress! (=
This commit is contained in:
parent
c20f3c8ca6
commit
94e6307c72
13 changed files with 379 additions and 287 deletions
BIN
media/image/creator.png
Normal file
BIN
media/image/creator.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 166 B |
|
|
@ -50,12 +50,21 @@ var btnp_pick = false
|
|||
|
||||
export var is_attract_mode = false
|
||||
|
||||
onready var sprite_mat : ShaderMaterial = $Sprite.material
|
||||
|
||||
func _enter_tree():
|
||||
if Engine.editor_hint or Shared.is_level_select: return
|
||||
|
||||
Shared.player = self
|
||||
|
||||
func _ready():
|
||||
# palette
|
||||
sprite_mat.set_shader_param("hat_swap", Shared.palette[Shared.player_colors[0]])
|
||||
sprite_mat.set_shader_param("skin_swap", Shared.palette[Shared.player_colors[1]])
|
||||
sprite_mat.set_shader_param("suit_swap", Shared.palette[Shared.player_colors[2]])
|
||||
sprite_mat.set_shader_param("eye_swap", Shared.palette[Shared.player_colors[3]])
|
||||
sprite_mat.set_shader_param("shoe_swap", Shared.palette[Shared.player_colors[3]])
|
||||
|
||||
if Engine.editor_hint: return
|
||||
|
||||
node_sprite.flip_h = randf() > 0.5
|
||||
|
|
|
|||
|
|
@ -7,47 +7,10 @@
|
|||
[ext_resource path="res://media/audio/sfx/sfx10.wav" type="AudioStream" id=5]
|
||||
[ext_resource path="res://media/audio/sfx/box_drop.wav" type="AudioStream" id=6]
|
||||
[ext_resource path="res://media/audio/sfx/push.wav" type="AudioStream" id=7]
|
||||
|
||||
[sub_resource type="Shader" id=8]
|
||||
code = "shader_type canvas_item;
|
||||
|
||||
uniform vec4 hat : hint_color = vec4(0.0);
|
||||
uniform vec4 eye : hint_color = vec4(0.0);
|
||||
uniform vec4 skin : hint_color = vec4(0.0);
|
||||
uniform vec4 suit : hint_color = vec4(0.0);
|
||||
uniform vec4 shoe : hint_color = vec4(0.0);
|
||||
|
||||
uniform vec4 hat_swap : hint_color = vec4(0.0);
|
||||
uniform vec4 eye_swap : hint_color = vec4(0.0);
|
||||
uniform vec4 skin_swap : hint_color = vec4(0.0);
|
||||
uniform vec4 suit_swap : hint_color = vec4(0.0);
|
||||
uniform vec4 shoe_swap : hint_color = vec4(0.0);
|
||||
|
||||
|
||||
void fragment(){
|
||||
vec4 col = texture(TEXTURE, UV);
|
||||
|
||||
if (col == hat){
|
||||
col = hat_swap;
|
||||
}
|
||||
else if (col == eye){
|
||||
col = eye_swap;
|
||||
}
|
||||
else if (col == skin){
|
||||
col = skin_swap;
|
||||
}
|
||||
else if (col == suit){
|
||||
col = suit_swap;
|
||||
}
|
||||
else if (col == shoe){
|
||||
col = shoe_swap;
|
||||
}
|
||||
|
||||
COLOR = col;
|
||||
}"
|
||||
[ext_resource path="res://src/shader/player_palette_swap.gdshader" type="Shader" id=8]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id=9]
|
||||
shader = SubResource( 8 )
|
||||
shader = ExtResource( 8 )
|
||||
shader_param/hat = Color( 1, 0, 0, 1 )
|
||||
shader_param/eye = Color( 0, 1, 0, 1 )
|
||||
shader_param/skin = Color( 0, 0, 1, 1 )
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ extends Node
|
|||
onready var api_file = load("silent_wolf_api_key.gd")
|
||||
var api_key := ""
|
||||
var is_online := false
|
||||
var username := "player_name"
|
||||
var scores := {}
|
||||
|
||||
signal new_score
|
||||
|
|
@ -12,9 +11,7 @@ func _ready():
|
|||
is_online = api_file is Script
|
||||
if !is_online: return
|
||||
|
||||
if OS.has_environment("USERNAME"):
|
||||
username = OS.get_environment("USERNAME")
|
||||
print("Leaderboard username: ", username)
|
||||
print("Leaderboard Shared.username: ", Shared.username)
|
||||
|
||||
api_key = api_file.source_code.strip_edges().replace('"', "")
|
||||
SilentWolf.configure({
|
||||
|
|
@ -27,7 +24,7 @@ func _ready():
|
|||
|
||||
|
||||
yield(get_tree(), "idle_frame")
|
||||
SilentWolf.Scores.persist_score(username, 1)
|
||||
SilentWolf.Scores.persist_score(Shared.username, 1)
|
||||
|
||||
func refresh_scores():
|
||||
if !is_online: return
|
||||
|
|
@ -56,5 +53,5 @@ func refresh_score(map_name):
|
|||
func submit_score(board_name, score):
|
||||
if !is_online: return
|
||||
|
||||
SilentWolf.Scores.persist_score("dinkle_" + username + "", score, board_name)
|
||||
SilentWolf.Scores.persist_score("dinkle_" + Shared.username + "", score, board_name)
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,10 @@ var is_note := false
|
|||
var notes := {}
|
||||
var is_note_replay := false
|
||||
|
||||
var username := "crate_kid"
|
||||
export (Array, Color) var palette := []
|
||||
var player_colors = [8, 0, 11, 13]
|
||||
|
||||
func _ready():
|
||||
print("Shared._ready(): ")
|
||||
|
||||
|
|
@ -170,7 +174,7 @@ func change_map():
|
|||
UI.notes.visible = is_level_select
|
||||
UI.notes_label.text = str(notes.size())
|
||||
UI.keys(false, false)
|
||||
UI.pause_label("score" if is_level_select else "menu")
|
||||
UI.labels("pick", "erase" if scene_path == creator_path else "back", "score" if is_level_select else "menu")
|
||||
|
||||
if is_in_game:
|
||||
TouchScreen.turn_arrows(false)
|
||||
|
|
@ -204,9 +208,7 @@ func change_map():
|
|||
UI.keys(false, true)
|
||||
TouchScreen.show_keys(false, true, false)
|
||||
elif scene_path == creator_path:
|
||||
UI.keys(true, true, true)
|
||||
TouchScreen.turn_arrows(false)
|
||||
TouchScreen.show_keys(true, true, true, true)
|
||||
UI.keys(true, true, false)
|
||||
|
||||
### Saving and Loading
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ shader = ExtResource( 3 )
|
|||
|
||||
[node name="Shared" type="Node"]
|
||||
script = ExtResource( 1 )
|
||||
palette = [ Color( 0.670588, 0.321569, 0.211765, 1 ), Color( 0.494118, 0.145098, 0.32549, 1 ), Color( 0.372549, 0.341176, 0.309804, 1 ), Color( 0.513726, 0.462745, 0.611765, 1 ), Color( 0.760784, 0.764706, 0.780392, 1 ), Color( 1, 1, 1, 1 ), Color( 1, 0, 0.301961, 1 ), Color( 1, 0.639216, 0, 1 ), Color( 1, 0.92549, 0.152941, 1 ), Color( 0, 0.894118, 0.211765, 1 ), Color( 0, 0.529412, 0.317647, 1 ), Color( 0.160784, 0.678431, 1, 1 ), Color( 1, 0.466667, 0.658824, 1 ), Color( 1, 0.8, 0.666667, 1 ) ]
|
||||
|
||||
[node name="Ghost" type="Sprite" parent="."]
|
||||
modulate = Color( 1, 1, 1, 0.65098 )
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
extends CanvasLayer
|
||||
|
||||
onready var x := $Center/Control/List/X
|
||||
onready var x_label := $Center/Control/List/X/Desc
|
||||
onready var c := $Center/Control/List/C
|
||||
onready var c_label := $Center/Control/List/C/Desc
|
||||
onready var top := $Center/Control/Top
|
||||
onready var pause_label := $Center/Control/Top/P/Desc
|
||||
|
||||
|
|
@ -19,5 +21,7 @@ func keys(left := true, right := true, is_expand := true, _top := false):
|
|||
top.visible = _top
|
||||
spacer.size_flags_horizontal = spacer.SIZE_EXPAND_FILL if is_expand else spacer.SIZE_FILL
|
||||
|
||||
func pause_label(arg := "menu"):
|
||||
pause_label.text = arg
|
||||
func labels (_x := "pick", _c := "back", _pause := "menu"):
|
||||
x_label.text = _x
|
||||
c_label.text = _c
|
||||
pause_label.text = _pause
|
||||
|
|
|
|||
|
|
@ -74,13 +74,13 @@ text = "pick"
|
|||
|
||||
[node name="Spacer" type="Control" parent="Center/Control/List"]
|
||||
margin_left = 39.0
|
||||
margin_right = 179.0
|
||||
margin_right = 173.0
|
||||
margin_bottom = 12.0
|
||||
rect_min_size = Vector2( 4, 0 )
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="C" type="HBoxContainer" parent="Center/Control/List"]
|
||||
margin_left = 179.0
|
||||
margin_left = 173.0
|
||||
margin_right = 218.0
|
||||
margin_bottom = 12.0
|
||||
custom_constants/separation = 2
|
||||
|
|
@ -96,10 +96,10 @@ uppercase = true
|
|||
[node name="Desc" type="Label" parent="Center/Control/List/C"]
|
||||
margin_left = 15.0
|
||||
margin_top = 3.0
|
||||
margin_right = 39.0
|
||||
margin_right = 45.0
|
||||
margin_bottom = 9.0
|
||||
custom_fonts/font = SubResource( 3 )
|
||||
text = "back"
|
||||
text = "erase"
|
||||
|
||||
[node name="Notes" type="Control" parent="Center/Control"]
|
||||
margin_left = 3.0
|
||||
|
|
|
|||
|
|
@ -1,26 +1,26 @@
|
|||
extends Node2D
|
||||
|
||||
onready var keyboard := $Keyboard
|
||||
onready var keyboard := $Menu/Keyboard
|
||||
var rows : Array = []#keyboard.get_children()
|
||||
|
||||
onready var cursor_node := $Cursor
|
||||
onready var cursor_node := $Menu/Cursor
|
||||
var cursor_x := 0
|
||||
var cursor_y := 0
|
||||
onready var arrows := $Menu/Arrows
|
||||
|
||||
onready var name_label := $Name
|
||||
onready var done_node := $Done
|
||||
onready var name_label := $Menu/Name
|
||||
onready var done_node := $Menu/Done
|
||||
|
||||
export (Array, Color) var palette := []
|
||||
var colors = [7, 0, 10, 13]
|
||||
var colors = [0, 0, 0, 0]
|
||||
var swatches = []
|
||||
|
||||
onready var player_mat : ShaderMaterial = $Player/Sprite.material
|
||||
|
||||
var is_input := true
|
||||
|
||||
func _ready():
|
||||
# setup rows & columns
|
||||
rows = []
|
||||
for i in $ColorPick.get_children():
|
||||
for i in $Menu/ColorPick.get_children():
|
||||
rows.append([i])
|
||||
|
||||
for i in keyboard.get_children():
|
||||
|
|
@ -31,39 +31,57 @@ func _ready():
|
|||
|
||||
# setup swatches
|
||||
swatches = []
|
||||
for i in $Colors.get_children():
|
||||
for i in $Menu/Colors.get_children():
|
||||
swatches.append(i.get_children())
|
||||
|
||||
for i in 4:
|
||||
fill_swatches(i)
|
||||
|
||||
name_label.text = Shared.username
|
||||
colors = Shared.player_colors
|
||||
for i in 4:
|
||||
set_color(i, colors[i])
|
||||
fill_swatches(i)
|
||||
|
||||
func _input(event):
|
||||
if event.is_action_pressed("jump"):
|
||||
# write letter
|
||||
if cursor_y > 3 and cursor_y < 8:
|
||||
var s = rows[cursor_y][cursor_x].get_child(0).text
|
||||
var l = name_label.text
|
||||
name_label.text = (l + s).substr(0, 16)
|
||||
elif event.is_action_pressed("action"):
|
||||
if !is_input: return
|
||||
|
||||
var btnx = btn.p("right") - btn.p("left")
|
||||
var btny = btn.p("down") - btn.p("up")
|
||||
var is_jump = event.is_action_pressed("jump")
|
||||
var is_action = event.is_action_pressed("action")
|
||||
|
||||
if btny != 0:
|
||||
if (cursor_y == 3 and btny == 1) or (cursor_y == 8 and btny == -1): cursor_x = 4
|
||||
move_cursor(cursor_x, cursor_y + btny)
|
||||
|
||||
elif cursor_y < 4:
|
||||
if btnx != 0 or is_jump or is_action:
|
||||
var c = btnx
|
||||
if btnx == 0:
|
||||
c = 1 if is_action else -1
|
||||
set_color(cursor_y, colors[cursor_y] + c)
|
||||
fill_swatches()
|
||||
elif cursor_y > 3 and cursor_y < 8:
|
||||
if btnx != 0:
|
||||
move_cursor(cursor_x + btnx)
|
||||
# erase letter
|
||||
if cursor_y > 3 and cursor_y < 8:
|
||||
if is_action:
|
||||
var s = name_label.text
|
||||
s.erase(s.length() - 1, 1)
|
||||
name_label.text = s
|
||||
else:
|
||||
var btnx = btn.p("right") - btn.p("left")
|
||||
var btny = btn.p("down") - btn.p("up")
|
||||
|
||||
if btnx != 0:
|
||||
move_cursor(cursor_x + btnx)
|
||||
|
||||
if cursor_y < 4:
|
||||
set_color(cursor_y, colors[cursor_y] + btnx)
|
||||
fill_swatches()
|
||||
elif btny != 0:
|
||||
if cursor_y == 4 and btny == -1: cursor_x = 4
|
||||
move_cursor(cursor_x, cursor_y + btny)
|
||||
|
||||
# write letter
|
||||
elif is_jump:
|
||||
var s = rows[cursor_y][cursor_x].get_child(0).text
|
||||
var l = name_label.text
|
||||
name_label.text = (l + s).substr(0, 16)
|
||||
elif cursor_y == rows.size() - 1:
|
||||
if is_jump:
|
||||
Shared.wipe_scene(Shared.main_menu_path)
|
||||
is_input = false
|
||||
Shared.username = name_label.text
|
||||
Shared.player_colors = colors
|
||||
|
||||
func move_cursor(_x := cursor_x, _y = cursor_y):
|
||||
cursor_y = clamp(_y, 0, rows.size() - 1)
|
||||
|
|
@ -71,19 +89,22 @@ func move_cursor(_x := cursor_x, _y = cursor_y):
|
|||
|
||||
cursor_node.rect_global_position = rows[cursor_y][cursor_x].rect_global_position
|
||||
cursor_node.rect_size = rows[cursor_y][cursor_x].rect_size
|
||||
|
||||
arrows.rect_global_position = cursor_node.rect_global_position
|
||||
arrows.visible = cursor_y < 4
|
||||
|
||||
|
||||
func set_color(_row := cursor_y, _col = colors[cursor_y]):
|
||||
colors[_row] = wrapi(_col, 0, palette.size())
|
||||
colors[_row] = wrapi(_col, 0, Shared.palette.size())
|
||||
|
||||
var params = [["hat"], ["skin"], ["suit"], ["eye", "shoe"]]
|
||||
for i in params[_row]:
|
||||
player_mat.set_shader_param(i + "_swap", palette[colors[_row]])
|
||||
player_mat.set_shader_param(i + "_swap", Shared.palette[colors[_row]])
|
||||
|
||||
func fill_swatches(_row := cursor_y):
|
||||
var offset = [-2, -1, 0, 1, 2]
|
||||
for i in 5:
|
||||
swatches[_row][i].color = palette[wrapi(colors[_row] + offset[i], 0, palette.size())]
|
||||
swatches[_row][i].color = Shared.palette[wrapi(colors[_row] + offset[i], 0, Shared.palette.size())]
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -6,7 +6,7 @@ onready var quit_menu := $Control/Quit
|
|||
|
||||
var cursor := 0 setget set_cursor
|
||||
var menu_items := []
|
||||
var main_items := ["play", "options", "credits"]
|
||||
var main_items := ["play", "creator", "options", "credits"]
|
||||
var quit_items := ["yes", "no"]
|
||||
var is_input = true
|
||||
|
||||
|
|
@ -49,6 +49,10 @@ func menu_select(tag : String = menu_items[cursor].to_lower()):
|
|||
Shared.wipe_scene(Shared.level_select_path)
|
||||
is_input = false
|
||||
node_audio_play.play()
|
||||
"creator":
|
||||
Shared.wipe_scene(Shared.creator_path)
|
||||
is_input = false
|
||||
node_audio_play.play()
|
||||
"options":
|
||||
Shared.wipe_scene(Shared.options_menu_path)
|
||||
is_input = false
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
[gd_scene load_steps=25 format=2]
|
||||
[gd_scene load_steps=26 format=2]
|
||||
|
||||
[ext_resource path="res://media/image/creator.png" type="Texture" id=1]
|
||||
[ext_resource path="res://src/menu/StartMenu.gd" type="Script" id=3]
|
||||
[ext_resource path="res://media/image/HarmonyHoneyLogo.png" type="Texture" id=4]
|
||||
[ext_resource path="res://media/font/ThaleahFat.ttf" type="DynamicFontData" id=5]
|
||||
|
|
@ -59,13 +60,13 @@ margin_left = 2.0
|
|||
margin_top = 32.0
|
||||
margin_right = 66.0
|
||||
margin_bottom = 104.0
|
||||
custom_constants/separation = 9
|
||||
custom_constants/separation = 5
|
||||
alignment = 1
|
||||
|
||||
[node name="Item" type="HBoxContainer" parent="Control/Menu/List"]
|
||||
margin_top = 9.0
|
||||
margin_top = 4.0
|
||||
margin_right = 64.0
|
||||
margin_bottom = 21.0
|
||||
margin_bottom = 16.0
|
||||
rect_min_size = Vector2( 0, 12 )
|
||||
custom_constants/separation = 2
|
||||
|
||||
|
|
@ -90,10 +91,38 @@ custom_fonts/font = SubResource( 3 )
|
|||
text = "play"
|
||||
uppercase = true
|
||||
|
||||
[node name="Item2" type="HBoxContainer" parent="Control/Menu/List"]
|
||||
margin_top = 30.0
|
||||
[node name="Item4" type="HBoxContainer" parent="Control/Menu/List"]
|
||||
margin_top = 21.0
|
||||
margin_right = 64.0
|
||||
margin_bottom = 42.0
|
||||
margin_bottom = 33.0
|
||||
rect_min_size = Vector2( 0, 12 )
|
||||
custom_constants/separation = 2
|
||||
|
||||
[node name="Image" type="Control" parent="Control/Menu/List/Item4"]
|
||||
margin_right = 8.0
|
||||
margin_bottom = 12.0
|
||||
rect_min_size = Vector2( 8, 8 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="Control/Menu/List/Item4/Image"]
|
||||
position = Vector2( 0, 2 )
|
||||
texture = ExtResource( 1 )
|
||||
centered = false
|
||||
hframes = 4
|
||||
frame = 2
|
||||
|
||||
[node name="Label" type="Label" parent="Control/Menu/List/Item4"]
|
||||
margin_left = 10.0
|
||||
margin_top = 2.0
|
||||
margin_right = 52.0
|
||||
margin_bottom = 10.0
|
||||
custom_fonts/font = SubResource( 3 )
|
||||
text = "style"
|
||||
uppercase = true
|
||||
|
||||
[node name="Item2" type="HBoxContainer" parent="Control/Menu/List"]
|
||||
margin_top = 38.0
|
||||
margin_right = 64.0
|
||||
margin_bottom = 50.0
|
||||
rect_min_size = Vector2( 0, 12 )
|
||||
custom_constants/separation = 2
|
||||
|
||||
|
|
@ -120,9 +149,9 @@ text = "option"
|
|||
uppercase = true
|
||||
|
||||
[node name="Item3" type="HBoxContainer" parent="Control/Menu/List"]
|
||||
margin_top = 51.0
|
||||
margin_top = 55.0
|
||||
margin_right = 64.0
|
||||
margin_bottom = 63.0
|
||||
margin_bottom = 67.0
|
||||
rect_min_size = Vector2( 0, 12 )
|
||||
custom_constants/separation = 2
|
||||
|
||||
|
|
|
|||
|
|
@ -5,5 +5,4 @@ func _ready():
|
|||
Music.play()
|
||||
$AudioStreamPlayer.play()
|
||||
yield(get_tree().create_timer(1.5), "timeout")
|
||||
#Shared.wipe_scene(Shared.main_menu_path)
|
||||
Shared.wipe_scene("res://src/menu/Creator.tscn")
|
||||
Shared.wipe_scene(Shared.main_menu_path)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue