Compare commits
90 Commits
Author | SHA1 | Date | |
---|---|---|---|
ba8184af9d | |||
9f31c97391 | |||
e5778812bc | |||
d89c65333e | |||
52743e8ad2 | |||
52c1300d09 | |||
50b3e35859 | |||
e9f3d7dc14 | |||
c64c4afd89 | |||
e714b7cbaf | |||
63728c90c6 | |||
9e9779b8a9 | |||
25d865bcbb | |||
73d3e59d93 | |||
8c7a4bef17 | |||
0b909091b7 | |||
8cc69e99da | |||
1cec50f4f6 | |||
6e9f5659ae | |||
69a21fe12f | |||
11e6e07098 | |||
a8dced21f1 | |||
c338885d67 | |||
dc7a6bd488 | |||
88f5dfb00f | |||
2417bd5b56 | |||
d7768f08ea | |||
05f61c76db | |||
5419864859 | |||
a915251506 | |||
1916c80784 | |||
762dd1bdf1 | |||
6868c73e49 | |||
4e33f3f78d | |||
d972725c03 | |||
5832f3a317 | |||
86218ffd84 | |||
4f8a301cde | |||
a69ade5438 | |||
d4b29230c7 | |||
e50e05558f | |||
5b4008a55c | |||
2b86cdec5c | |||
e45c31a2c6 | |||
47b7bc24b0 | |||
74e288c870 | |||
3c5fc96be3 | |||
0f8ac8d6ea | |||
9d3028961d | |||
60fbf36faa | |||
90d3481fb5 | |||
8ffd54ad8f | |||
7aa08d7000 | |||
78edef5396 | |||
45d5e7e116 | |||
6eb8ffdf86 | |||
e0e92d18c0 | |||
5cbd793e6c | |||
1359d6555a | |||
574e22ef74 | |||
ed5924f407 | |||
db1c211852 | |||
8009ffdf7e | |||
fd4688a3ab | |||
1c79e2d57b | |||
0194bbdc0d | |||
d0f9e894ee | |||
b4b5936b43 | |||
f1683613f6 | |||
ea0b840f35 | |||
6b8a92003e | |||
1ca2e138d7 | |||
b179c8dd9d | |||
1f9e8794a0 | |||
018871ac65 | |||
6c6d45fa1d | |||
b9f104726b | |||
4d32308d4f | |||
259967bde9 | |||
6d611a07df | |||
bbd3c0467b | |||
a36e448253 | |||
59429d92fa | |||
4e5706b065 | |||
1bb25f1c44 | |||
ea27f8a2e1 | |||
ad8b8ac7f8 | |||
a5d625832c | |||
807aae5b98 | |||
17a9614e78 |
3
.gitignore
vendored
@ -9,4 +9,5 @@ export_presets.cfg
|
|||||||
|
|
||||||
midi/FluidR3 GM.sf2
|
midi/FluidR3 GM.sf2
|
||||||
release/
|
release/
|
||||||
*.import
|
*.import
|
||||||
|
*.tmp
|
61
GridMap.gd
@ -1,61 +0,0 @@
|
|||||||
extends GridMap
|
|
||||||
|
|
||||||
const Tetromino = preload("res://Tetrominos/Tetromino.gd")
|
|
||||||
const ExplodingLine = preload("res://ExplodingLine.tscn")
|
|
||||||
|
|
||||||
const EMPTY_CELL = -1
|
|
||||||
const MINO = 0
|
|
||||||
|
|
||||||
export (int) var NB_LINES = 20
|
|
||||||
export (int) var NB_COLLUMNS = 10
|
|
||||||
|
|
||||||
var exploding_lines = []
|
|
||||||
|
|
||||||
func _ready():
|
|
||||||
for y in range(NB_LINES):
|
|
||||||
exploding_lines.append(ExplodingLine.instance())
|
|
||||||
add_child(exploding_lines[y])
|
|
||||||
exploding_lines[y].translation = Vector3(NB_COLLUMNS/2, y, 1)
|
|
||||||
|
|
||||||
func clear():
|
|
||||||
for position in get_used_cells():
|
|
||||||
set_cell_item(position.x, position.y, position.z, EMPTY_CELL)
|
|
||||||
|
|
||||||
func is_free_cell(position):
|
|
||||||
return (
|
|
||||||
0 <= position.x and position.x < NB_COLLUMNS
|
|
||||||
and position.y >= 0
|
|
||||||
and get_cell_item(position.x, position.y, 0) == GridMap.INVALID_CELL_ITEM
|
|
||||||
)
|
|
||||||
|
|
||||||
func possible_positions(initial_positions, movement):
|
|
||||||
var position
|
|
||||||
var test_positions = []
|
|
||||||
for i in range(4):
|
|
||||||
position = initial_positions[i] + movement
|
|
||||||
if is_free_cell(position):
|
|
||||||
test_positions.append(position)
|
|
||||||
if test_positions.size() == Tetromino.NB_MINOES:
|
|
||||||
return test_positions
|
|
||||||
else:
|
|
||||||
return []
|
|
||||||
|
|
||||||
func lock(piece):
|
|
||||||
for position in piece.positions():
|
|
||||||
set_cell_item(position.x, position.y, 0, MINO)
|
|
||||||
|
|
||||||
func clear_lines():
|
|
||||||
var nb_minoes
|
|
||||||
var lines_cleared = 0
|
|
||||||
for y in range(NB_LINES-1, -1, -1):
|
|
||||||
nb_minoes = 0
|
|
||||||
for x in range(NB_COLLUMNS):
|
|
||||||
if get_cell_item(x, y, 0) == MINO:
|
|
||||||
nb_minoes += 1
|
|
||||||
if nb_minoes == NB_COLLUMNS:
|
|
||||||
for y2 in range(y, NB_LINES+2):
|
|
||||||
for x in range(NB_COLLUMNS):
|
|
||||||
set_cell_item(x, y2, 0, get_cell_item(x, y2+1, 0))
|
|
||||||
lines_cleared += 1
|
|
||||||
exploding_lines[y].restart()
|
|
||||||
return lines_cleared
|
|
245
Main.gd
@ -1,245 +0,0 @@
|
|||||||
extends WorldEnvironment
|
|
||||||
|
|
||||||
const Tetromino = preload("res://Tetrominos/Tetromino.gd")
|
|
||||||
const TetroI = preload("res://Tetrominos/TetroI.tscn")
|
|
||||||
const TetroJ = preload("res://Tetrominos/TetroJ.tscn")
|
|
||||||
const TetroL = preload("res://Tetrominos/TetroL.tscn")
|
|
||||||
const TetroO = preload("res://Tetrominos/TetroO.tscn")
|
|
||||||
const TetroS = preload("res://Tetrominos/TetroS.tscn")
|
|
||||||
const TetroT = preload("res://Tetrominos/TetroT.tscn")
|
|
||||||
const TetroZ = preload("res://Tetrominos/TetroZ.tscn")
|
|
||||||
|
|
||||||
const password = "TETRIS 3000"
|
|
||||||
|
|
||||||
const NEXT_POSITION = Vector3(13, 16, 0)
|
|
||||||
const START_POSITION = Vector3(5, 20, 0)
|
|
||||||
const HOLD_POSITION = Vector3(-5, 16, 0)
|
|
||||||
|
|
||||||
const movements = {
|
|
||||||
"move_right": Vector3(1, 0, 0),
|
|
||||||
"move_left": Vector3(-1, 0, 0),
|
|
||||||
"soft_drop": Vector3(0, -1, 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
var random_bag = []
|
|
||||||
|
|
||||||
var next_piece
|
|
||||||
var current_piece
|
|
||||||
var held_piece
|
|
||||||
var current_piece_held = false
|
|
||||||
|
|
||||||
var autoshift_action = ""
|
|
||||||
|
|
||||||
var playing = false
|
|
||||||
|
|
||||||
signal piece_dropped(score)
|
|
||||||
signal piece_locked(lines, t_spin)
|
|
||||||
|
|
||||||
func _ready():
|
|
||||||
load_user_data()
|
|
||||||
|
|
||||||
func load_user_data():
|
|
||||||
var save_game = File.new()
|
|
||||||
if not save_game.file_exists("user://data.save"):
|
|
||||||
$Stats.high_score = 0
|
|
||||||
else:
|
|
||||||
save_game.open_encrypted_with_pass("user://data.save", File.READ, password)
|
|
||||||
$Stats.high_score = int(save_game.get_line())
|
|
||||||
$Stats/VBC/HighScore.text = str($Stats.high_score)
|
|
||||||
save_game.close()
|
|
||||||
|
|
||||||
func _on_Start_start(level):
|
|
||||||
$GridMap.clear()
|
|
||||||
if held_piece:
|
|
||||||
remove_child(held_piece)
|
|
||||||
held_piece = null
|
|
||||||
next_piece = random_piece()
|
|
||||||
new_piece()
|
|
||||||
$MidiPlayer.position = 0
|
|
||||||
$Start.visible = false
|
|
||||||
$Stats.new_game(level)
|
|
||||||
resume()
|
|
||||||
|
|
||||||
func new_piece():
|
|
||||||
if current_piece:
|
|
||||||
remove_child(current_piece)
|
|
||||||
current_piece = next_piece
|
|
||||||
current_piece.translation = START_POSITION
|
|
||||||
current_piece.emit_trail(true)
|
|
||||||
autoshift_action = ""
|
|
||||||
next_piece = random_piece()
|
|
||||||
next_piece.translation = NEXT_POSITION
|
|
||||||
if move(movements["soft_drop"]):
|
|
||||||
$DropTimer.start()
|
|
||||||
$LockDelay.start()
|
|
||||||
current_piece_held = false
|
|
||||||
else:
|
|
||||||
game_over()
|
|
||||||
|
|
||||||
func random_piece():
|
|
||||||
if not random_bag:
|
|
||||||
random_bag = [
|
|
||||||
TetroI, TetroJ, TetroL, TetroO,
|
|
||||||
TetroS, TetroT, TetroZ
|
|
||||||
]
|
|
||||||
var choice = randi() % random_bag.size()
|
|
||||||
var piece = random_bag[choice].instance()
|
|
||||||
random_bag.remove(choice)
|
|
||||||
add_child(piece)
|
|
||||||
return piece
|
|
||||||
|
|
||||||
func _on_Stats_level_up():
|
|
||||||
$DropTimer.wait_time = pow(0.8 - (($Stats.level - 1) * 0.007), $Stats.level - 1)
|
|
||||||
if $Stats.level > 15:
|
|
||||||
$LockDelay.wait_time = 0.5 * pow(0.9, $Stats.level-15)
|
|
||||||
|
|
||||||
func _process(delta):
|
|
||||||
if Input.is_action_just_pressed("pause"):
|
|
||||||
if playing:
|
|
||||||
pause()
|
|
||||||
$controls_ui.visible = true
|
|
||||||
elif $controls_ui.enable_resume:
|
|
||||||
resume()
|
|
||||||
if playing:
|
|
||||||
for action in movements:
|
|
||||||
if action == autoshift_action:
|
|
||||||
if not Input.is_action_pressed(action):
|
|
||||||
$AutoShiftDelay.stop()
|
|
||||||
$AutoShiftTimer.stop()
|
|
||||||
autoshift_action = ""
|
|
||||||
else:
|
|
||||||
if Input.is_action_pressed(action):
|
|
||||||
autoshift_action = action
|
|
||||||
process_autoshift_action()
|
|
||||||
$AutoShiftTimer.stop()
|
|
||||||
$AutoShiftDelay.start()
|
|
||||||
if Input.is_action_just_pressed("hard_drop"):
|
|
||||||
hard_drop()
|
|
||||||
if Input.is_action_just_pressed("rotate_clockwise"):
|
|
||||||
if rotate(Tetromino.CLOCKWISE):
|
|
||||||
$MidiPlayer.move()
|
|
||||||
if Input.is_action_just_pressed("rotate_counterclockwise"):
|
|
||||||
if rotate(Tetromino.COUNTERCLOCKWISE):
|
|
||||||
$MidiPlayer.move()
|
|
||||||
if Input.is_action_just_pressed("hold"):
|
|
||||||
hold()
|
|
||||||
|
|
||||||
func _on_AutoShiftDelay_timeout():
|
|
||||||
if playing and autoshift_action:
|
|
||||||
process_autoshift_action()
|
|
||||||
$AutoShiftTimer.start()
|
|
||||||
|
|
||||||
func _on_AutoShiftTimer_timeout():
|
|
||||||
if playing and autoshift_action:
|
|
||||||
process_autoshift_action()
|
|
||||||
|
|
||||||
func process_autoshift_action():
|
|
||||||
if move(movements[autoshift_action]):
|
|
||||||
$MidiPlayer.move()
|
|
||||||
if autoshift_action == "soft_drop":
|
|
||||||
emit_signal("piece_dropped", 1)
|
|
||||||
|
|
||||||
func hard_drop():
|
|
||||||
$MidiPlayer.move()
|
|
||||||
var score = 0
|
|
||||||
while move(movements["soft_drop"]):
|
|
||||||
score += 2
|
|
||||||
emit_signal("piece_dropped", score)
|
|
||||||
lock()
|
|
||||||
|
|
||||||
func move(movement):
|
|
||||||
if current_piece.move(movement):
|
|
||||||
$LockDelay.start()
|
|
||||||
return true
|
|
||||||
else:
|
|
||||||
return false
|
|
||||||
|
|
||||||
func rotate(direction):
|
|
||||||
if current_piece.rotate(direction):
|
|
||||||
$LockDelay.start()
|
|
||||||
return true
|
|
||||||
else:
|
|
||||||
return false
|
|
||||||
|
|
||||||
func _on_DropTimer_timeout():
|
|
||||||
move(movements["soft_drop"])
|
|
||||||
|
|
||||||
func _on_LockDelay_timeout():
|
|
||||||
if not move(movements["soft_drop"]):
|
|
||||||
lock()
|
|
||||||
|
|
||||||
func lock():
|
|
||||||
$GridMap.lock(current_piece)
|
|
||||||
emit_signal("piece_locked", $GridMap.clear_lines(), current_piece.t_spin)
|
|
||||||
new_piece()
|
|
||||||
|
|
||||||
func hold():
|
|
||||||
if not current_piece_held:
|
|
||||||
current_piece_held = true
|
|
||||||
var swap = current_piece
|
|
||||||
current_piece = held_piece
|
|
||||||
held_piece = swap
|
|
||||||
held_piece.emit_trail(false)
|
|
||||||
held_piece.translation = HOLD_POSITION
|
|
||||||
if current_piece:
|
|
||||||
current_piece.translation = START_POSITION
|
|
||||||
current_piece.emit_trail(true)
|
|
||||||
else:
|
|
||||||
new_piece()
|
|
||||||
|
|
||||||
func resume():
|
|
||||||
playing = true
|
|
||||||
$DropTimer.start()
|
|
||||||
$LockDelay.start()
|
|
||||||
$Stats.time = OS.get_system_time_secs() - $Stats.time
|
|
||||||
$Stats/Clock.start()
|
|
||||||
$MidiPlayer.resume()
|
|
||||||
$controls_ui.visible = false
|
|
||||||
$Stats.visible = true
|
|
||||||
$GridMap.visible = true
|
|
||||||
$Backs.visible = true
|
|
||||||
current_piece.visible = true
|
|
||||||
if held_piece:
|
|
||||||
held_piece.visible = true
|
|
||||||
next_piece.visible = true
|
|
||||||
|
|
||||||
func pause(hide=true):
|
|
||||||
playing = false
|
|
||||||
$Stats.time = OS.get_system_time_secs() - $Stats.time
|
|
||||||
if hide:
|
|
||||||
$Stats.visible = false
|
|
||||||
$GridMap.visible = false
|
|
||||||
$Backs.visible = false
|
|
||||||
current_piece.visible = false
|
|
||||||
if held_piece:
|
|
||||||
held_piece.visible = false
|
|
||||||
next_piece.visible = false
|
|
||||||
$MidiPlayer.stop()
|
|
||||||
$DropTimer.stop()
|
|
||||||
$LockDelay.stop()
|
|
||||||
$Stats/Clock.stop()
|
|
||||||
|
|
||||||
func game_over():
|
|
||||||
$FlashText.print("GAME\nOVER")
|
|
||||||
pause(false)
|
|
||||||
$ReplayButton.visible = true
|
|
||||||
|
|
||||||
func _on_ReplayButton_pressed():
|
|
||||||
pause()
|
|
||||||
$ReplayButton.visible = false
|
|
||||||
$Start.visible = true
|
|
||||||
|
|
||||||
func _notification(what):
|
|
||||||
match what:
|
|
||||||
MainLoop.NOTIFICATION_WM_FOCUS_OUT:
|
|
||||||
if playing:
|
|
||||||
pause()
|
|
||||||
MainLoop.NOTIFICATION_WM_QUIT_REQUEST:
|
|
||||||
save_user_data()
|
|
||||||
get_tree().quit()
|
|
||||||
|
|
||||||
func save_user_data():
|
|
||||||
var save_game = File.new()
|
|
||||||
save_game.open_encrypted_with_pass("user://data.save", File.WRITE, password)
|
|
||||||
save_game.store_line(str($Stats.high_score))
|
|
||||||
save_game.close()
|
|
@ -1 +1,6 @@
|
|||||||

|

|
||||||
|
|
||||||
|
[Downloads](https://github.com/adrienmalin/TETRIS3000/releases)
|
||||||
|
|
||||||
|
[Play in browser](https://adrienmalin.github.io/TETRIS3000/web/TETRIS3000.html)
|
||||||
|
|
||||||
|
88
Stats.gd
@ -1,88 +0,0 @@
|
|||||||
extends MarginContainer
|
|
||||||
|
|
||||||
const SCORES = [
|
|
||||||
[0, 4, 1],
|
|
||||||
[1, 8, 2],
|
|
||||||
[3, 12],
|
|
||||||
[5, 16],
|
|
||||||
[8]
|
|
||||||
]
|
|
||||||
const LINES_CLEARED_NAMES = ["", "SINGLE", "DOUBLE", "TRIPLE", "TETRIS"]
|
|
||||||
const T_SPIN_NAMES = ["", "T-SPIN", "MINI T-SPIN"]
|
|
||||||
|
|
||||||
var level
|
|
||||||
var goal
|
|
||||||
var score
|
|
||||||
var high_score
|
|
||||||
var time
|
|
||||||
var combos
|
|
||||||
|
|
||||||
signal flash_text(text)
|
|
||||||
signal level_up
|
|
||||||
|
|
||||||
func new_game(start_level):
|
|
||||||
level = start_level - 1
|
|
||||||
goal = 0
|
|
||||||
score = 0
|
|
||||||
$VBC/Score.text = str(score)
|
|
||||||
time = 0
|
|
||||||
$VBC/Time.text = "0:00:00"
|
|
||||||
combos = -1
|
|
||||||
new_level()
|
|
||||||
|
|
||||||
func new_level():
|
|
||||||
level += 1
|
|
||||||
goal += 5 * level
|
|
||||||
$VBC/Level.text = str(level)
|
|
||||||
$VBC/Goal.text = str(goal)
|
|
||||||
emit_signal("flash_text", "Level\n%d"%level)
|
|
||||||
emit_signal("level_up")
|
|
||||||
|
|
||||||
func _on_Clock_timeout():
|
|
||||||
show_time()
|
|
||||||
|
|
||||||
func show_time():
|
|
||||||
var time_elapsed = OS.get_system_time_secs() - time
|
|
||||||
var seconds = time_elapsed % 60
|
|
||||||
var minutes = int(time_elapsed/60) % 60
|
|
||||||
var hours = int(time_elapsed/3600)
|
|
||||||
$VBC/Time.text = str(hours) + ":%02d"%minutes + ":%02d"%seconds
|
|
||||||
|
|
||||||
func _on_Main_piece_dropped(ds):
|
|
||||||
score += ds
|
|
||||||
$VBC/Score.text = str(score)
|
|
||||||
|
|
||||||
func _on_Main_piece_locked(lines, t_spin):
|
|
||||||
var ds
|
|
||||||
if lines or t_spin:
|
|
||||||
var text = T_SPIN_NAMES[t_spin]
|
|
||||||
if text:
|
|
||||||
text += " "
|
|
||||||
text += LINES_CLEARED_NAMES[lines]
|
|
||||||
emit_signal("flash_text", text)
|
|
||||||
ds = SCORES[lines][t_spin]
|
|
||||||
goal -= ds
|
|
||||||
$VBC/Goal.text = str(goal)
|
|
||||||
ds *= 100
|
|
||||||
emit_signal("flash_text", str(ds))
|
|
||||||
score += ds
|
|
||||||
$VBC/Score.text = str(score)
|
|
||||||
if score > high_score:
|
|
||||||
high_score = score
|
|
||||||
$VBC/HighScore.text = str(high_score)
|
|
||||||
# Combos
|
|
||||||
if lines:
|
|
||||||
combos += 1
|
|
||||||
if combos > 0:
|
|
||||||
if combos == 1:
|
|
||||||
emit_signal("flash_text", "COMBO")
|
|
||||||
else:
|
|
||||||
emit_signal("flash_text", "COMBO x%d"%combos)
|
|
||||||
ds = (20 if lines==1 else 50) * combos * level
|
|
||||||
emit_signal("flash_text", str(ds))
|
|
||||||
score += ds
|
|
||||||
$VBC/Score.text = str(score)
|
|
||||||
else:
|
|
||||||
combos = -1
|
|
||||||
if goal <= 0:
|
|
||||||
new_level()
|
|
@ -1,55 +0,0 @@
|
|||||||
[gd_resource type="SpatialMaterial" format=2]
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
|
|
||||||
render_priority = 0
|
|
||||||
flags_transparent = true
|
|
||||||
flags_unshaded = false
|
|
||||||
flags_vertex_lighting = false
|
|
||||||
flags_no_depth_test = false
|
|
||||||
flags_use_point_size = false
|
|
||||||
flags_world_triplanar = false
|
|
||||||
flags_fixed_size = false
|
|
||||||
flags_albedo_tex_force_srgb = false
|
|
||||||
vertex_color_use_as_albedo = false
|
|
||||||
vertex_color_is_srgb = false
|
|
||||||
params_diffuse_mode = 0
|
|
||||||
params_specular_mode = 0
|
|
||||||
params_blend_mode = 1
|
|
||||||
params_cull_mode = 0
|
|
||||||
params_depth_draw_mode = 0
|
|
||||||
params_line_width = 1.0
|
|
||||||
params_point_size = 1.0
|
|
||||||
params_billboard_mode = 0
|
|
||||||
params_grow = false
|
|
||||||
params_use_alpha_scissor = false
|
|
||||||
albedo_color = Color( 0.601563, 0.775878, 1, 0.0338039 )
|
|
||||||
metallic = 0.18
|
|
||||||
metallic_specular = 1.0
|
|
||||||
metallic_texture_channel = 0
|
|
||||||
roughness = 0.46
|
|
||||||
roughness_texture_channel = 0
|
|
||||||
emission_enabled = false
|
|
||||||
normal_enabled = false
|
|
||||||
rim_enabled = false
|
|
||||||
clearcoat_enabled = false
|
|
||||||
anisotropy_enabled = false
|
|
||||||
ao_enabled = false
|
|
||||||
depth_enabled = false
|
|
||||||
subsurf_scatter_enabled = false
|
|
||||||
transmission_enabled = false
|
|
||||||
refraction_enabled = false
|
|
||||||
detail_enabled = false
|
|
||||||
uv1_scale = Vector3( 1, 1, 1 )
|
|
||||||
uv1_offset = Vector3( 0, 0, 0 )
|
|
||||||
uv1_triplanar = false
|
|
||||||
uv1_triplanar_sharpness = 1.0
|
|
||||||
uv2_scale = Vector3( 1, 1, 1 )
|
|
||||||
uv2_offset = Vector3( 0, 0, 0 )
|
|
||||||
uv2_triplanar = false
|
|
||||||
uv2_triplanar_sharpness = 1.0
|
|
||||||
proximity_fade_enable = true
|
|
||||||
proximity_fade_distance = 1.0
|
|
||||||
distance_fade_enable = false
|
|
||||||
_sections_unfolded = [ "Albedo", "Emission", "Metallic", "NormalMap", "Proximity Fade" ]
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
|||||||
extends "Tetromino.gd"
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
|||||||
extends "Tetromino.gd"
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
|||||||
extends "Tetromino.gd"
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
|||||||
extends "Tetromino.gd"
|
|
||||||
|
|
||||||
const T_SLOT = [
|
|
||||||
Vector3(-1, 1, 0),
|
|
||||||
Vector3(1, 1, 0),
|
|
||||||
Vector3(1, -1, 0),
|
|
||||||
Vector3(-1, -1, 0)
|
|
||||||
]
|
|
||||||
|
|
||||||
func rotate(direction):
|
|
||||||
var rotation_point = .rotate(direction)
|
|
||||||
if rotation_point and t_spin != T_SPIN:
|
|
||||||
var center = to_global(minoes[0].translation)
|
|
||||||
var a = not grid_map.is_free_cell(center + T_SLOT[orientation])
|
|
||||||
var b = not grid_map.is_free_cell(center + T_SLOT[(1+orientation)%4])
|
|
||||||
var c = not grid_map.is_free_cell(center + T_SLOT[(2+orientation)%4])
|
|
||||||
var d = not grid_map.is_free_cell(center + T_SLOT[(3+orientation)%4])
|
|
||||||
if a and b and (c or d):
|
|
||||||
t_spin = T_SPIN
|
|
||||||
elif c and d and (a or b):
|
|
||||||
if rotation_point == 5:
|
|
||||||
t_spin = T_SPIN
|
|
||||||
else:
|
|
||||||
t_spin = MINI_T_SPIN
|
|
||||||
return rotation_point
|
|
@ -1,2 +0,0 @@
|
|||||||
extends "Tetromino.gd"
|
|
||||||
|
|
@ -1 +1 @@
|
|||||||
theme: jekyll-theme-slate
|
theme: jekyll-theme-slate
|
||||||
|
@ -1,29 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="StreamTexture"
|
|
||||||
path="res://.import/16.png-f3b4844aade9b270cbb38cff295ce33e.stex"
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://icons/16.png"
|
|
||||||
dest_files=[ "res://.import/16.png-f3b4844aade9b270cbb38cff295ce33e.stex" ]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/hdr_mode=0
|
|
||||||
compress/normal_map=0
|
|
||||||
flags/repeat=0
|
|
||||||
flags/filter=true
|
|
||||||
flags/mipmaps=false
|
|
||||||
flags/anisotropic=false
|
|
||||||
flags/srgb=2
|
|
||||||
process/fix_alpha_border=true
|
|
||||||
process/premult_alpha=false
|
|
||||||
process/HDR_as_SRGB=false
|
|
||||||
stream=false
|
|
||||||
size_limit=0
|
|
||||||
detect_3d=true
|
|
||||||
svg/scale=1.0
|
|
@ -1,29 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="StreamTexture"
|
|
||||||
path="res://.import/256.png-9a56a9319a91fa74ee7ddb5c0b84a228.stex"
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://icons/256.png"
|
|
||||||
dest_files=[ "res://.import/256.png-9a56a9319a91fa74ee7ddb5c0b84a228.stex" ]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/hdr_mode=0
|
|
||||||
compress/normal_map=0
|
|
||||||
flags/repeat=0
|
|
||||||
flags/filter=true
|
|
||||||
flags/mipmaps=false
|
|
||||||
flags/anisotropic=false
|
|
||||||
flags/srgb=2
|
|
||||||
process/fix_alpha_border=true
|
|
||||||
process/premult_alpha=false
|
|
||||||
process/HDR_as_SRGB=false
|
|
||||||
stream=false
|
|
||||||
size_limit=0
|
|
||||||
detect_3d=true
|
|
||||||
svg/scale=1.0
|
|
@ -1,29 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="StreamTexture"
|
|
||||||
path="res://.import/32.png-2c676109efa1e249139d639d1746eda5.stex"
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://icons/32.png"
|
|
||||||
dest_files=[ "res://.import/32.png-2c676109efa1e249139d639d1746eda5.stex" ]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/hdr_mode=0
|
|
||||||
compress/normal_map=0
|
|
||||||
flags/repeat=0
|
|
||||||
flags/filter=true
|
|
||||||
flags/mipmaps=false
|
|
||||||
flags/anisotropic=false
|
|
||||||
flags/srgb=2
|
|
||||||
process/fix_alpha_border=true
|
|
||||||
process/premult_alpha=false
|
|
||||||
process/HDR_as_SRGB=false
|
|
||||||
stream=false
|
|
||||||
size_limit=0
|
|
||||||
detect_3d=true
|
|
||||||
svg/scale=1.0
|
|
@ -1,29 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="StreamTexture"
|
|
||||||
path="res://.import/48.png-477be3215ba369c304be5535b6005c78.stex"
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://icons/48.png"
|
|
||||||
dest_files=[ "res://.import/48.png-477be3215ba369c304be5535b6005c78.stex" ]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/hdr_mode=0
|
|
||||||
compress/normal_map=0
|
|
||||||
flags/repeat=0
|
|
||||||
flags/filter=true
|
|
||||||
flags/mipmaps=false
|
|
||||||
flags/anisotropic=false
|
|
||||||
flags/srgb=2
|
|
||||||
process/fix_alpha_border=true
|
|
||||||
process/premult_alpha=false
|
|
||||||
process/HDR_as_SRGB=false
|
|
||||||
stream=false
|
|
||||||
size_limit=0
|
|
||||||
detect_3d=true
|
|
||||||
svg/scale=1.0
|
|
@ -1,29 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="StreamTexture"
|
|
||||||
path="res://.import/splash.png-47c0e91fea9ce360c80365c194f47837.stex"
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://icons/splash.png"
|
|
||||||
dest_files=[ "res://.import/splash.png-47c0e91fea9ce360c80365c194f47837.stex" ]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/hdr_mode=0
|
|
||||||
compress/normal_map=0
|
|
||||||
flags/repeat=0
|
|
||||||
flags/filter=true
|
|
||||||
flags/mipmaps=false
|
|
||||||
flags/anisotropic=false
|
|
||||||
flags/srgb=2
|
|
||||||
process/fix_alpha_border=true
|
|
||||||
process/premult_alpha=false
|
|
||||||
process/HDR_as_SRGB=false
|
|
||||||
stream=false
|
|
||||||
size_limit=0
|
|
||||||
detect_3d=true
|
|
||||||
svg/scale=1.0
|
|
BIN
screenshot.png
Before Width: | Height: | Size: 382 KiB |
@ -1,29 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="StreamTexture"
|
|
||||||
path="res://.import/screenshot.png-024a21af5d37bf0f0dd0e2bccdd149d0.stex"
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://screenshot.png"
|
|
||||||
dest_files=[ "res://.import/screenshot.png-024a21af5d37bf0f0dd0e2bccdd149d0.stex" ]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/hdr_mode=0
|
|
||||||
compress/normal_map=0
|
|
||||||
flags/repeat=0
|
|
||||||
flags/filter=true
|
|
||||||
flags/mipmaps=false
|
|
||||||
flags/anisotropic=false
|
|
||||||
flags/srgb=2
|
|
||||||
process/fix_alpha_border=true
|
|
||||||
process/premult_alpha=false
|
|
||||||
process/HDR_as_SRGB=false
|
|
||||||
stream=false
|
|
||||||
size_limit=0
|
|
||||||
detect_3d=true
|
|
||||||
svg/scale=1.0
|
|
@ -1,6 +1,6 @@
|
|||||||
[gd_scene load_steps=10 format=2]
|
[gd_scene load_steps=7 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://Tetrominos/Mino/MinoMaterial.tres" type="Material" id=1]
|
[ext_resource path="res://Tetrominos/Mino/MinoMesh.tres" type="CubeMesh" id=1]
|
||||||
|
|
||||||
[sub_resource type="Gradient" id=1]
|
[sub_resource type="Gradient" id=1]
|
||||||
|
|
||||||
@ -30,19 +30,19 @@ render_priority = 0
|
|||||||
trail_divisor = 2
|
trail_divisor = 2
|
||||||
trail_color_modifier = SubResource( 4 )
|
trail_color_modifier = SubResource( 4 )
|
||||||
emission_shape = 2
|
emission_shape = 2
|
||||||
emission_box_extents = Vector3( 8, 0.5, 0.5 )
|
emission_box_extents = Vector3( 10, 1, 1 )
|
||||||
flag_align_y = false
|
flag_align_y = false
|
||||||
flag_rotate_y = true
|
flag_rotate_y = true
|
||||||
flag_disable_z = false
|
flag_disable_z = false
|
||||||
spread = 30.0
|
spread = 0.0
|
||||||
flatness = 0.0
|
flatness = 0.0
|
||||||
gravity = Vector3( 0, -30, 0 )
|
gravity = Vector3( 0, -10, 30 )
|
||||||
initial_velocity = 10.0
|
initial_velocity = 20.0
|
||||||
initial_velocity_random = 0.8
|
initial_velocity_random = 1.0
|
||||||
angular_velocity = 97.14
|
angular_velocity = 97.14
|
||||||
angular_velocity_random = 1.0
|
angular_velocity_random = 1.0
|
||||||
linear_accel = 100.0
|
linear_accel = 100.0
|
||||||
linear_accel_random = 0.84
|
linear_accel_random = 1.0
|
||||||
radial_accel = 8.48
|
radial_accel = 8.48
|
||||||
radial_accel_random = 0.85
|
radial_accel_random = 0.85
|
||||||
tangential_accel = 0.0
|
tangential_accel = 0.0
|
||||||
@ -61,38 +61,9 @@ anim_speed_random = 0.0
|
|||||||
anim_offset = 0.0
|
anim_offset = 0.0
|
||||||
anim_offset_random = 0.0
|
anim_offset_random = 0.0
|
||||||
anim_loop = false
|
anim_loop = false
|
||||||
_sections_unfolded = [ "Angular Velocity", "Color", "Emission Shape", "Gravity", "Scale", "Spread" ]
|
_sections_unfolded = [ "Angular Velocity", "Color", "Gravity", "Initial Velocity", "Linear Accel", "Scale", "Spread" ]
|
||||||
|
|
||||||
[sub_resource type="PrismMesh" id=6]
|
[node name="ExplodingLine" type="Particles" index="0"]
|
||||||
|
|
||||||
material = ExtResource( 1 )
|
|
||||||
custom_aabb = AABB( 0, 0, 0, 0, 0, 0 )
|
|
||||||
left_to_right = 2.98023e-008
|
|
||||||
size = Vector3( 0.2, 0.2, 0.2 )
|
|
||||||
subdivide_width = 2
|
|
||||||
subdivide_height = 0
|
|
||||||
subdivide_depth = 0
|
|
||||||
|
|
||||||
[sub_resource type="PrismMesh" id=7]
|
|
||||||
|
|
||||||
material = ExtResource( 1 )
|
|
||||||
custom_aabb = AABB( 0, 0, 0, 0, 0, 0 )
|
|
||||||
left_to_right = 0.5
|
|
||||||
size = Vector3( 0.2, 0.2, 0.2 )
|
|
||||||
subdivide_width = 2
|
|
||||||
subdivide_height = 0
|
|
||||||
subdivide_depth = 0
|
|
||||||
|
|
||||||
[sub_resource type="CubeMesh" id=8]
|
|
||||||
|
|
||||||
material = ExtResource( 1 )
|
|
||||||
custom_aabb = AABB( 0, 0, 0, 0, 0, 0 )
|
|
||||||
size = Vector3( 0.2, 0.2, 0.2 )
|
|
||||||
subdivide_width = 0
|
|
||||||
subdivide_height = 0
|
|
||||||
subdivide_depth = 0
|
|
||||||
|
|
||||||
[node name="ExplodingLine" type="Particles"]
|
|
||||||
|
|
||||||
layers = 1
|
layers = 1
|
||||||
material_override = null
|
material_override = null
|
||||||
@ -104,23 +75,21 @@ lod_min_hysteresis = 0.0
|
|||||||
lod_max_distance = 0.0
|
lod_max_distance = 0.0
|
||||||
lod_max_hysteresis = 0.0
|
lod_max_hysteresis = 0.0
|
||||||
emitting = false
|
emitting = false
|
||||||
amount = 800
|
amount = 40
|
||||||
lifetime = 2.0
|
lifetime = 2.0
|
||||||
one_shot = true
|
one_shot = true
|
||||||
preprocess = 0.0
|
preprocess = 0.0
|
||||||
speed_scale = 2.18
|
speed_scale = 2.18
|
||||||
explosiveness = 0.9
|
explosiveness = 1.0
|
||||||
randomness = 0.69
|
randomness = 0.0
|
||||||
fixed_fps = 0
|
fixed_fps = 0
|
||||||
fract_delta = true
|
fract_delta = true
|
||||||
visibility_aabb = AABB( -5, -0.5, -1, 10, 1, 2 )
|
visibility_aabb = AABB( -5, -0.5, -1, 10, 1, 2 )
|
||||||
local_coords = false
|
local_coords = false
|
||||||
draw_order = 0
|
draw_order = 0
|
||||||
process_material = SubResource( 5 )
|
process_material = SubResource( 5 )
|
||||||
draw_passes = 3
|
draw_passes = 1
|
||||||
draw_pass_1 = SubResource( 6 )
|
draw_pass_1 = ExtResource( 1 )
|
||||||
draw_pass_2 = SubResource( 7 )
|
|
||||||
draw_pass_3 = SubResource( 8 )
|
|
||||||
_sections_unfolded = [ "Draw Passes", "Drawing", "Process Material", "Time", "Transform" ]
|
_sections_unfolded = [ "Draw Passes", "Drawing", "Process Material", "Time", "Transform" ]
|
||||||
|
|
||||||
|
|
70
source/GridMap.gd
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
extends GridMap
|
||||||
|
|
||||||
|
const Tetromino = preload("res://Tetrominos/Tetromino.gd")
|
||||||
|
const ExplodingLine = preload("res://ExplodingLine.tscn")
|
||||||
|
|
||||||
|
const EMPTY_CELL = -1
|
||||||
|
const MINO = 0
|
||||||
|
|
||||||
|
var exploding_lines = []
|
||||||
|
var nb_collumns
|
||||||
|
var nb_lines
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
nb_collumns = int(get_parent().scale.x)
|
||||||
|
nb_lines = int(get_parent().scale.y)
|
||||||
|
for y in range(nb_lines):
|
||||||
|
exploding_lines.append(ExplodingLine.instance())
|
||||||
|
add_child(exploding_lines[y])
|
||||||
|
exploding_lines[y].translation = Vector3(nb_collumns/2, y, 1)
|
||||||
|
|
||||||
|
func clear():
|
||||||
|
for used_cell in get_used_cells():
|
||||||
|
set_cell_item(used_cell.x, used_cell.y, used_cell.z, EMPTY_CELL)
|
||||||
|
|
||||||
|
func is_free_cell(cell):
|
||||||
|
return (
|
||||||
|
0 <= cell.x and cell.x < nb_collumns
|
||||||
|
and cell.y >= 0
|
||||||
|
and get_cell_item(cell.x, cell.y, cell.z) == INVALID_CELL_ITEM
|
||||||
|
)
|
||||||
|
|
||||||
|
func possible_positions(initial_translations, movement):
|
||||||
|
var position
|
||||||
|
var test_translations = []
|
||||||
|
for i in range(4):
|
||||||
|
position = initial_translations[i] + movement
|
||||||
|
if is_free_cell(position):
|
||||||
|
test_translations.append(position)
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
if test_translations.size() == Tetromino.NB_MINOES:
|
||||||
|
return test_translations
|
||||||
|
else:
|
||||||
|
return []
|
||||||
|
|
||||||
|
func lock(piece):
|
||||||
|
var minoes_over_grid = 0
|
||||||
|
for position in piece.get_translations():
|
||||||
|
if position.y >= nb_lines:
|
||||||
|
minoes_over_grid += 1
|
||||||
|
set_cell_item(position.x, position.y, 0, MINO)
|
||||||
|
return minoes_over_grid < Tetromino.NB_MINOES
|
||||||
|
|
||||||
|
func clear_lines():
|
||||||
|
var lines_cleared = 0
|
||||||
|
for y in range(nb_lines-1, -1, -1):
|
||||||
|
var line_cleared = true
|
||||||
|
for x in range(nb_collumns):
|
||||||
|
if not get_cell_item(x, y, 0) == MINO:
|
||||||
|
line_cleared = false
|
||||||
|
break
|
||||||
|
if line_cleared:
|
||||||
|
for y2 in range(y, nb_lines+2):
|
||||||
|
for x in range(nb_collumns):
|
||||||
|
var above_cell = get_cell_item(x, y2+1, 0)
|
||||||
|
set_cell_item(x, y2, 0, above_cell)
|
||||||
|
lines_cleared += 1
|
||||||
|
exploding_lines[y].emitting = true
|
||||||
|
exploding_lines[y].restart()
|
||||||
|
return lines_cleared
|
221
source/Main.gd
Normal file
@ -0,0 +1,221 @@
|
|||||||
|
extends WorldEnvironment
|
||||||
|
|
||||||
|
const Tetromino = preload("res://Tetrominos/Tetromino.gd")
|
||||||
|
const TetroI = preload("res://Tetrominos/TetroI.tscn")
|
||||||
|
const TetroJ = preload("res://Tetrominos/TetroJ.tscn")
|
||||||
|
const TetroL = preload("res://Tetrominos/TetroL.tscn")
|
||||||
|
const TetroO = preload("res://Tetrominos/TetroO.tscn")
|
||||||
|
const TetroS = preload("res://Tetrominos/TetroS.tscn")
|
||||||
|
const TetroT = preload("res://Tetrominos/TetroT.tscn")
|
||||||
|
const TetroZ = preload("res://Tetrominos/TetroZ.tscn")
|
||||||
|
|
||||||
|
const THERE = Vector3(0, 0, 0)
|
||||||
|
|
||||||
|
const movements = {
|
||||||
|
"move_right": Vector3(1, 0, 0),
|
||||||
|
"move_left": Vector3(-1, 0, 0),
|
||||||
|
"soft_drop": Vector3(0, -1, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
var random_bag = []
|
||||||
|
|
||||||
|
var next_piece
|
||||||
|
var current_piece
|
||||||
|
var held_piece
|
||||||
|
var current_piece_held
|
||||||
|
var autoshift_action
|
||||||
|
|
||||||
|
var playing = false
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
randomize()
|
||||||
|
|
||||||
|
func new_game(level):
|
||||||
|
$Start.visible = false
|
||||||
|
next_piece = random_piece()
|
||||||
|
autoshift_action = ""
|
||||||
|
$LockDelay.wait_time = 0.5
|
||||||
|
$MidiPlayer.position = 0
|
||||||
|
$Stats.new_game(level)
|
||||||
|
new_piece()
|
||||||
|
resume()
|
||||||
|
|
||||||
|
func new_piece():
|
||||||
|
current_piece = next_piece
|
||||||
|
current_piece.translation = $Matrix/Position3D.translation
|
||||||
|
current_piece.emit_trail(true)
|
||||||
|
next_piece = random_piece()
|
||||||
|
next_piece.translation = $Next/Position3D.translation
|
||||||
|
if current_piece.move(THERE):
|
||||||
|
$DropTimer.start()
|
||||||
|
current_piece_held = false
|
||||||
|
else:
|
||||||
|
game_over()
|
||||||
|
|
||||||
|
func random_piece():
|
||||||
|
if not random_bag:
|
||||||
|
random_bag = [
|
||||||
|
TetroI, TetroJ, TetroL, TetroO,
|
||||||
|
TetroS, TetroT, TetroZ
|
||||||
|
]
|
||||||
|
var choice = randi() % random_bag.size()
|
||||||
|
var piece = random_bag[choice].instance()
|
||||||
|
random_bag.remove(choice)
|
||||||
|
add_child(piece)
|
||||||
|
return piece
|
||||||
|
|
||||||
|
func new_level(level):
|
||||||
|
if level <= 15:
|
||||||
|
$DropTimer.wait_time = pow(0.8 - ((level - 1) * 0.007), level - 1)
|
||||||
|
else:
|
||||||
|
$LockDelay.wait_time = 0.5 * pow(0.9, level-15)
|
||||||
|
|
||||||
|
func _unhandled_input(event):
|
||||||
|
if event.is_action_pressed("pause"):
|
||||||
|
if playing:
|
||||||
|
pause($controls_ui)
|
||||||
|
else:
|
||||||
|
resume()
|
||||||
|
if event.is_action_pressed("toggle_fullscreen"):
|
||||||
|
OS.window_fullscreen = not OS.window_fullscreen
|
||||||
|
if playing:
|
||||||
|
if autoshift_action and event.is_action_released(autoshift_action):
|
||||||
|
$AutoShiftDelay.stop()
|
||||||
|
$AutoShiftTimer.stop()
|
||||||
|
autoshift_action = ""
|
||||||
|
for action in movements:
|
||||||
|
if Input.is_action_pressed(action):
|
||||||
|
autoshift_action = action
|
||||||
|
process_autoshift()
|
||||||
|
$AutoShiftDelay.start()
|
||||||
|
break
|
||||||
|
for action in movements:
|
||||||
|
if action != autoshift_action:
|
||||||
|
if event.is_action_pressed(action):
|
||||||
|
$AutoShiftTimer.stop()
|
||||||
|
autoshift_action = action
|
||||||
|
process_autoshift()
|
||||||
|
$AutoShiftDelay.start()
|
||||||
|
break
|
||||||
|
if event.is_action_pressed("hard_drop"):
|
||||||
|
hard_drop()
|
||||||
|
if event.is_action_pressed("rotate_clockwise"):
|
||||||
|
current_piece.rotate(Tetromino.CLOCKWISE)
|
||||||
|
if event.is_action_pressed("rotate_counterclockwise"):
|
||||||
|
current_piece.rotate(Tetromino.COUNTERCLOCKWISE)
|
||||||
|
if event.is_action_pressed("hold"):
|
||||||
|
hold()
|
||||||
|
|
||||||
|
func _on_AutoShiftDelay_timeout():
|
||||||
|
if autoshift_action:
|
||||||
|
process_autoshift()
|
||||||
|
$AutoShiftTimer.start()
|
||||||
|
|
||||||
|
func _on_AutoShiftTimer_timeout():
|
||||||
|
if autoshift_action:
|
||||||
|
process_autoshift()
|
||||||
|
|
||||||
|
func process_autoshift():
|
||||||
|
var moved = current_piece.move(movements[autoshift_action])
|
||||||
|
if moved and (autoshift_action == "soft_drop"):
|
||||||
|
$Stats.piece_dropped(1)
|
||||||
|
|
||||||
|
func hard_drop():
|
||||||
|
var score = 0
|
||||||
|
while current_piece.move(movements["soft_drop"]):
|
||||||
|
score += 2
|
||||||
|
$Stats.piece_dropped(score)
|
||||||
|
$LockDelay.stop()
|
||||||
|
lock()
|
||||||
|
|
||||||
|
func _on_DropTimer_timeout():
|
||||||
|
if not current_piece.move(movements["soft_drop"]):
|
||||||
|
if $LockDelay.is_stopped():
|
||||||
|
lock()
|
||||||
|
|
||||||
|
func lock():
|
||||||
|
if $Matrix/GridMap.lock(current_piece):
|
||||||
|
var t_spin = current_piece.t_spin()
|
||||||
|
var lines_cleared = $Matrix/GridMap.clear_lines()
|
||||||
|
$Stats.piece_locked(lines_cleared, t_spin)
|
||||||
|
if lines_cleared or t_spin:
|
||||||
|
$MidiPlayer.piece_locked(lines_cleared)
|
||||||
|
remove_child(current_piece)
|
||||||
|
new_piece()
|
||||||
|
else:
|
||||||
|
game_over()
|
||||||
|
|
||||||
|
func hold():
|
||||||
|
if not current_piece_held:
|
||||||
|
current_piece_held = true
|
||||||
|
var swap = current_piece
|
||||||
|
current_piece = held_piece
|
||||||
|
held_piece = swap
|
||||||
|
held_piece.emit_trail(false)
|
||||||
|
held_piece.translation = $Hold/Position3D.translation
|
||||||
|
if current_piece:
|
||||||
|
current_piece.translation = $Matrix/Position3D.translation
|
||||||
|
current_piece.emit_trail(true)
|
||||||
|
else:
|
||||||
|
new_piece()
|
||||||
|
|
||||||
|
func resume():
|
||||||
|
playing = true
|
||||||
|
$DropTimer.start()
|
||||||
|
$LockDelay.start()
|
||||||
|
$Stats.time = OS.get_system_time_secs() - $Stats.time
|
||||||
|
$Stats/Clock.start()
|
||||||
|
$MidiPlayer.resume()
|
||||||
|
$controls_ui.visible = false
|
||||||
|
$Stats.visible = true
|
||||||
|
$Matrix.visible = true
|
||||||
|
$Matrix/GridMap.visible = true
|
||||||
|
$Hold.visible = true
|
||||||
|
$Next.visible = true
|
||||||
|
current_piece.visible = true
|
||||||
|
if held_piece:
|
||||||
|
held_piece.visible = true
|
||||||
|
next_piece.visible = true
|
||||||
|
|
||||||
|
func pause(gui=null):
|
||||||
|
playing = false
|
||||||
|
$MidiPlayer.stop()
|
||||||
|
$DropTimer.stop()
|
||||||
|
$LockDelay.stop()
|
||||||
|
$AutoShiftDelay.stop()
|
||||||
|
$AutoShiftTimer.stop()
|
||||||
|
$Stats/Clock.stop()
|
||||||
|
$Stats.time = OS.get_system_time_secs() - $Stats.time
|
||||||
|
if gui:
|
||||||
|
gui.visible = true
|
||||||
|
$Stats.visible = false
|
||||||
|
$Matrix.visible = false
|
||||||
|
$Matrix/GridMap.visible = false
|
||||||
|
$Hold.visible = false
|
||||||
|
$Next.visible = false
|
||||||
|
current_piece.visible = false
|
||||||
|
if held_piece:
|
||||||
|
held_piece.visible = false
|
||||||
|
next_piece.visible = false
|
||||||
|
|
||||||
|
func game_over():
|
||||||
|
pause()
|
||||||
|
current_piece.emit_trail(false)
|
||||||
|
$FlashText.print("GAME\nOVER")
|
||||||
|
$ReplayButton.visible = true
|
||||||
|
|
||||||
|
func _on_ReplayButton_pressed():
|
||||||
|
$ReplayButton.visible = false
|
||||||
|
remove_child(next_piece)
|
||||||
|
remove_child(current_piece)
|
||||||
|
if held_piece:
|
||||||
|
remove_child(held_piece)
|
||||||
|
held_piece = null
|
||||||
|
$Matrix/GridMap.clear()
|
||||||
|
pause($Start)
|
||||||
|
|
||||||
|
func _notification(what):
|
||||||
|
match what:
|
||||||
|
MainLoop.NOTIFICATION_WM_FOCUS_OUT:
|
||||||
|
if playing:
|
||||||
|
pause($controls_ui)
|
@ -1,7 +1,7 @@
|
|||||||
[gd_scene load_steps=21 format=2]
|
[gd_scene load_steps=21 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://starmap_g8k.jpg" type="Texture" id=1]
|
[ext_resource path="res://Main.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://Main.gd" type="Script" id=2]
|
[ext_resource path="res://aperture-vintage-472251-unsplash.jpg" type="Texture" id=2]
|
||||||
[ext_resource path="res://Tetrominos/Mino/MinoLibrary.tres" type="MeshLibrary" id=3]
|
[ext_resource path="res://Tetrominos/Mino/MinoLibrary.tres" type="MeshLibrary" id=3]
|
||||||
[ext_resource path="res://GridMap.gd" type="Script" id=4]
|
[ext_resource path="res://GridMap.gd" type="Script" id=4]
|
||||||
[ext_resource path="res://midi/MidiPlayer.tscn" type="PackedScene" id=5]
|
[ext_resource path="res://midi/MidiPlayer.tscn" type="PackedScene" id=5]
|
||||||
@ -10,26 +10,25 @@
|
|||||||
[ext_resource path="res://fonts/525-ROUN.TTF" type="DynamicFontData" id=8]
|
[ext_resource path="res://fonts/525-ROUN.TTF" type="DynamicFontData" id=8]
|
||||||
[ext_resource path="res://Stats.tscn" type="PackedScene" id=9]
|
[ext_resource path="res://Stats.tscn" type="PackedScene" id=9]
|
||||||
[ext_resource path="res://controls.tscn" type="PackedScene" id=10]
|
[ext_resource path="res://controls.tscn" type="PackedScene" id=10]
|
||||||
[ext_resource path="res://fonts/Gamer.ttf" type="DynamicFontData" id=11]
|
[ext_resource path="res://Start.tscn" type="PackedScene" id=11]
|
||||||
[ext_resource path="res://Start.tscn" type="PackedScene" id=12]
|
[ext_resource path="res://fonts/Gamer.ttf" type="DynamicFontData" id=12]
|
||||||
|
|
||||||
[sub_resource type="PanoramaSky" id=1]
|
[sub_resource type="PanoramaSky" id=1]
|
||||||
|
|
||||||
radiance_size = 4
|
radiance_size = 0
|
||||||
panorama = ExtResource( 1 )
|
|
||||||
|
|
||||||
[sub_resource type="Environment" id=2]
|
[sub_resource type="Environment" id=2]
|
||||||
|
|
||||||
resource_local_to_scene = true
|
resource_local_to_scene = true
|
||||||
background_mode = 2
|
background_mode = 0
|
||||||
background_sky = SubResource( 1 )
|
background_sky = SubResource( 1 )
|
||||||
background_sky_custom_fov = 0.0
|
background_sky_custom_fov = 0.0
|
||||||
background_color = Color( 0, 0, 0, 1 )
|
background_color = Color( 0, 0, 0, 1 )
|
||||||
background_energy = 3.0
|
background_energy = 0.0
|
||||||
background_canvas_max_layer = 0
|
background_canvas_max_layer = 0
|
||||||
ambient_light_color = Color( 0.469971, 0.542197, 0.6875, 1 )
|
ambient_light_color = Color( 0.86908, 0.949502, 0.958984, 1 )
|
||||||
ambient_light_energy = 0.0
|
ambient_light_energy = 2.0
|
||||||
ambient_light_sky_contribution = 1.0
|
ambient_light_sky_contribution = 0.92
|
||||||
fog_enabled = false
|
fog_enabled = false
|
||||||
fog_color = Color( 0.5, 0.6, 0.7, 1 )
|
fog_color = Color( 0.5, 0.6, 0.7, 1 )
|
||||||
fog_sun_color = Color( 1, 0.9, 0.7, 1 )
|
fog_sun_color = Color( 1, 0.9, 0.7, 1 )
|
||||||
@ -43,13 +42,13 @@ fog_height_enabled = false
|
|||||||
fog_height_min = 0.0
|
fog_height_min = 0.0
|
||||||
fog_height_max = 100.0
|
fog_height_max = 100.0
|
||||||
fog_height_curve = 1.0
|
fog_height_curve = 1.0
|
||||||
tonemap_mode = 0
|
tonemap_mode = 3
|
||||||
tonemap_exposure = 1.0
|
tonemap_exposure = 1.0
|
||||||
tonemap_white = 1.0
|
tonemap_white = 1.0
|
||||||
auto_exposure_enabled = false
|
auto_exposure_enabled = false
|
||||||
auto_exposure_scale = 0.4
|
auto_exposure_scale = 0.4
|
||||||
auto_exposure_min_luma = 0.05
|
auto_exposure_min_luma = 0.05
|
||||||
auto_exposure_max_luma = 8.0
|
auto_exposure_max_luma = 0.26
|
||||||
auto_exposure_speed = 0.5
|
auto_exposure_speed = 0.5
|
||||||
ss_reflections_enabled = false
|
ss_reflections_enabled = false
|
||||||
ss_reflections_max_steps = 64
|
ss_reflections_max_steps = 64
|
||||||
@ -86,7 +85,7 @@ glow_levels/4 = false
|
|||||||
glow_levels/5 = true
|
glow_levels/5 = true
|
||||||
glow_levels/6 = false
|
glow_levels/6 = false
|
||||||
glow_levels/7 = false
|
glow_levels/7 = false
|
||||||
glow_intensity = 2.26
|
glow_intensity = 6.17
|
||||||
glow_strength = 1.0
|
glow_strength = 1.0
|
||||||
glow_bloom = 0.0
|
glow_bloom = 0.0
|
||||||
glow_blend_mode = 2
|
glow_blend_mode = 2
|
||||||
@ -94,10 +93,10 @@ glow_hdr_threshold = 1.0
|
|||||||
glow_hdr_scale = 2.0
|
glow_hdr_scale = 2.0
|
||||||
glow_bicubic_upscale = false
|
glow_bicubic_upscale = false
|
||||||
adjustment_enabled = false
|
adjustment_enabled = false
|
||||||
adjustment_brightness = 0.35
|
adjustment_brightness = 0.27
|
||||||
adjustment_contrast = 1.0
|
adjustment_contrast = 1.0
|
||||||
adjustment_saturation = 0.34
|
adjustment_saturation = 0.34
|
||||||
_sections_unfolded = [ "Adjustments", "Ambient Light", "Background", "Fog", "Resource" ]
|
_sections_unfolded = [ "Adjustments", "Ambient Light", "Background", "Resource" ]
|
||||||
|
|
||||||
[sub_resource type="SpatialMaterial" id=3]
|
[sub_resource type="SpatialMaterial" id=3]
|
||||||
|
|
||||||
@ -227,17 +226,49 @@ size = 20
|
|||||||
use_mipmaps = false
|
use_mipmaps = false
|
||||||
use_filter = false
|
use_filter = false
|
||||||
extra_spacing_bottom = 5
|
extra_spacing_bottom = 5
|
||||||
font_data = ExtResource( 11 )
|
font_data = ExtResource( 12 )
|
||||||
_sections_unfolded = [ "Extra Spacing", "Font", "Settings" ]
|
_sections_unfolded = [ "Extra Spacing", "Font", "Settings" ]
|
||||||
|
|
||||||
[node name="Main" type="WorldEnvironment" index="0"]
|
[node name="Main" type="WorldEnvironment" index="0"]
|
||||||
|
|
||||||
environment = SubResource( 2 )
|
environment = SubResource( 2 )
|
||||||
script = ExtResource( 2 )
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
[node name="Camera" type="Camera" parent="." index="0"]
|
[node name="Background" type="Sprite3D" parent="." index="0"]
|
||||||
|
|
||||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 4.5, 10, 12 )
|
transform = Transform( 12.8, 0, 0, 0, 8.53, 0, 0, 0, 1, 5, 10, -32 )
|
||||||
|
layers = 1
|
||||||
|
material_override = null
|
||||||
|
cast_shadow = 1
|
||||||
|
extra_cull_margin = 0.0
|
||||||
|
use_in_baked_light = false
|
||||||
|
lod_min_distance = 0.0
|
||||||
|
lod_min_hysteresis = 0.0
|
||||||
|
lod_max_distance = 0.0
|
||||||
|
lod_max_hysteresis = 0.0
|
||||||
|
centered = true
|
||||||
|
offset = Vector2( 0, 0 )
|
||||||
|
flip_h = false
|
||||||
|
flip_v = false
|
||||||
|
modulate = Color( 0.334808, 0.343253, 0.359375, 0 )
|
||||||
|
opacity = 1.0
|
||||||
|
pixel_size = 0.01
|
||||||
|
axis = 2
|
||||||
|
transparent = false
|
||||||
|
shaded = true
|
||||||
|
double_sided = false
|
||||||
|
alpha_cut = 0
|
||||||
|
texture = ExtResource( 2 )
|
||||||
|
vframes = 1
|
||||||
|
hframes = 1
|
||||||
|
frame = 0
|
||||||
|
region_enabled = false
|
||||||
|
region_rect = Rect2( 0, 0, 0, 0 )
|
||||||
|
_sections_unfolded = [ "Animation", "Flags", "Geometry", "Transform" ]
|
||||||
|
|
||||||
|
[node name="Camera" type="Camera" parent="." index="1"]
|
||||||
|
|
||||||
|
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 4.5, 10, 20 )
|
||||||
keep_aspect = 1
|
keep_aspect = 1
|
||||||
cull_mask = 1048575
|
cull_mask = 1048575
|
||||||
environment = null
|
environment = null
|
||||||
@ -245,16 +276,16 @@ h_offset = 0.0
|
|||||||
v_offset = 0.0
|
v_offset = 0.0
|
||||||
doppler_tracking = 0
|
doppler_tracking = 0
|
||||||
projection = 0
|
projection = 0
|
||||||
current = false
|
current = true
|
||||||
fov = 100.0
|
fov = 70.0
|
||||||
size = 1.0
|
size = 1.0
|
||||||
near = 0.05
|
near = 0.05
|
||||||
far = -1.22275e+007
|
far = 500.0
|
||||||
_sections_unfolded = [ "Transform" ]
|
_sections_unfolded = [ "Transform" ]
|
||||||
|
|
||||||
[node name="DirectionalLight" type="DirectionalLight" parent="." index="1"]
|
[node name="DirectionalLight" type="DirectionalLight" parent="." index="2"]
|
||||||
|
|
||||||
transform = Transform( 0.376951, 0.677372, -0.631724, -0.295744, 0.734355, 0.610949, 0.877749, -0.0434695, 0.477145, -20, 30, 0 )
|
transform = Transform( 0.332668, 0.771982, -0.541642, 0.579657, 0.285656, 0.763151, 0.743861, -0.567843, -0.352456, 5, 30, 0 )
|
||||||
layers = 1
|
layers = 1
|
||||||
light_color = Color( 1, 1, 1, 1 )
|
light_color = Color( 1, 1, 1, 1 )
|
||||||
light_energy = 3.0
|
light_energy = 3.0
|
||||||
@ -280,8 +311,28 @@ directional_shadow_depth_range = 0
|
|||||||
directional_shadow_max_distance = 200.0
|
directional_shadow_max_distance = 200.0
|
||||||
_sections_unfolded = [ "Light", "Transform" ]
|
_sections_unfolded = [ "Light", "Transform" ]
|
||||||
|
|
||||||
[node name="GridMap" type="GridMap" parent="." index="2"]
|
[node name="Matrix" type="MeshInstance" parent="." index="3"]
|
||||||
|
|
||||||
|
transform = Transform( 10, 0, 0, 0, 20, 0, 0, 0, 1, 4.5, 9.5, 0 )
|
||||||
|
visible = false
|
||||||
|
layers = 1
|
||||||
|
material_override = null
|
||||||
|
cast_shadow = 1
|
||||||
|
extra_cull_margin = 0.0
|
||||||
|
use_in_baked_light = false
|
||||||
|
lod_min_distance = 0.0
|
||||||
|
lod_min_hysteresis = 0.0
|
||||||
|
lod_max_distance = 0.0
|
||||||
|
lod_max_hysteresis = 0.0
|
||||||
|
mesh = SubResource( 4 )
|
||||||
|
skeleton = NodePath("..")
|
||||||
|
material/0 = null
|
||||||
|
_sections_unfolded = [ "Transform", "material" ]
|
||||||
|
|
||||||
|
[node name="GridMap" type="GridMap" parent="Matrix" index="0"]
|
||||||
|
|
||||||
|
transform = Transform( 0.1, 0, 0, 0, 0.05, 0, 0, 0, 1, -0.45, -0.475, 0 )
|
||||||
|
visible = false
|
||||||
theme = ExtResource( 3 )
|
theme = ExtResource( 3 )
|
||||||
cell_size = Vector3( 1, 1, 1 )
|
cell_size = Vector3( 1, 1, 1 )
|
||||||
cell_octant_size = 8
|
cell_octant_size = 8
|
||||||
@ -298,36 +349,18 @@ script = ExtResource( 4 )
|
|||||||
_sections_unfolded = [ "Cell", "Transform" ]
|
_sections_unfolded = [ "Cell", "Transform" ]
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_editor_clip_": 1,
|
"_editor_clip_": 1,
|
||||||
"_editor_floor_": Vector3( 0, -1, 0 )
|
"_editor_floor_": Vector3( 0, -2, 0 )
|
||||||
}
|
}
|
||||||
NB_LINES = 20
|
|
||||||
NB_COLLUMNS = 10
|
|
||||||
|
|
||||||
[node name="Backs" type="Spatial" parent="." index="3"]
|
[node name="Position3D" type="Position3D" parent="Matrix" index="1"]
|
||||||
|
|
||||||
editor/display_folded = true
|
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 20, 0 )
|
||||||
visible = false
|
|
||||||
|
|
||||||
[node name="GridBack" type="MeshInstance" parent="Backs" index="0"]
|
|
||||||
|
|
||||||
transform = Transform( 10, 0, 0, 0, 20, 0, 0, 0, 1, 4.5, 9.5, 0 )
|
|
||||||
layers = 1
|
|
||||||
material_override = null
|
|
||||||
cast_shadow = 1
|
|
||||||
extra_cull_margin = 0.0
|
|
||||||
use_in_baked_light = false
|
|
||||||
lod_min_distance = 0.0
|
|
||||||
lod_min_hysteresis = 0.0
|
|
||||||
lod_max_distance = 0.0
|
|
||||||
lod_max_hysteresis = 0.0
|
|
||||||
mesh = SubResource( 4 )
|
|
||||||
skeleton = NodePath("..")
|
|
||||||
material/0 = null
|
|
||||||
_sections_unfolded = [ "Transform" ]
|
_sections_unfolded = [ "Transform" ]
|
||||||
|
|
||||||
[node name="HoldBack" type="MeshInstance" parent="Backs" index="1"]
|
[node name="Hold" type="MeshInstance" parent="." index="4"]
|
||||||
|
|
||||||
transform = Transform( 7, 0, 0, 0, 7, 0, 0, 0, 1, -5, 16, 0 )
|
transform = Transform( 7, 0, 0, 0, 7, 0, 0, 0, 1, -5, 16, 0 )
|
||||||
|
visible = false
|
||||||
layers = 1
|
layers = 1
|
||||||
material_override = null
|
material_override = null
|
||||||
cast_shadow = 1
|
cast_shadow = 1
|
||||||
@ -342,9 +375,15 @@ skeleton = NodePath("..")
|
|||||||
material/0 = null
|
material/0 = null
|
||||||
_sections_unfolded = [ "Transform" ]
|
_sections_unfolded = [ "Transform" ]
|
||||||
|
|
||||||
[node name="NextBack" type="MeshInstance" parent="Backs" index="2"]
|
[node name="Position3D" type="Position3D" parent="Hold" index="0"]
|
||||||
|
|
||||||
|
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -5, 16, 0 )
|
||||||
|
_sections_unfolded = [ "Transform" ]
|
||||||
|
|
||||||
|
[node name="Next" type="MeshInstance" parent="." index="5"]
|
||||||
|
|
||||||
transform = Transform( 7, 0, 0, 0, 7, 0, 0, 0, 1, 14, 16, 0 )
|
transform = Transform( 7, 0, 0, 0, 7, 0, 0, 0, 1, 14, 16, 0 )
|
||||||
|
visible = false
|
||||||
layers = 1
|
layers = 1
|
||||||
material_override = null
|
material_override = null
|
||||||
cast_shadow = 1
|
cast_shadow = 1
|
||||||
@ -359,41 +398,47 @@ skeleton = NodePath("..")
|
|||||||
material/0 = null
|
material/0 = null
|
||||||
_sections_unfolded = [ "Transform" ]
|
_sections_unfolded = [ "Transform" ]
|
||||||
|
|
||||||
[node name="DropTimer" type="Timer" parent="." index="4"]
|
[node name="Position3D" type="Position3D" parent="Next" index="0"]
|
||||||
|
|
||||||
|
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 13, 16, 0 )
|
||||||
|
_sections_unfolded = [ "Transform" ]
|
||||||
|
|
||||||
|
[node name="DropTimer" type="Timer" parent="." index="6"]
|
||||||
|
|
||||||
process_mode = 1
|
process_mode = 1
|
||||||
wait_time = 1.0
|
wait_time = 1.0
|
||||||
one_shot = false
|
one_shot = false
|
||||||
autostart = false
|
autostart = false
|
||||||
|
|
||||||
[node name="LockDelay" type="Timer" parent="." index="5"]
|
[node name="LockDelay" type="Timer" parent="." index="7"]
|
||||||
|
|
||||||
process_mode = 1
|
process_mode = 1
|
||||||
wait_time = 0.5
|
wait_time = 0.5
|
||||||
one_shot = true
|
one_shot = true
|
||||||
autostart = false
|
autostart = false
|
||||||
|
|
||||||
[node name="AutoShiftDelay" type="Timer" parent="." index="6"]
|
[node name="AutoShiftDelay" type="Timer" parent="." index="8"]
|
||||||
|
|
||||||
process_mode = 1
|
process_mode = 1
|
||||||
wait_time = 0.17
|
wait_time = 0.2
|
||||||
one_shot = true
|
one_shot = true
|
||||||
autostart = false
|
autostart = false
|
||||||
|
|
||||||
[node name="AutoShiftTimer" type="Timer" parent="." index="7"]
|
[node name="AutoShiftTimer" type="Timer" parent="." index="9"]
|
||||||
|
|
||||||
process_mode = 1
|
process_mode = 1
|
||||||
wait_time = 0.03
|
wait_time = 0.03
|
||||||
one_shot = false
|
one_shot = false
|
||||||
autostart = false
|
autostart = false
|
||||||
|
|
||||||
[node name="MidiPlayer" parent="." index="8" instance=ExtResource( 5 )]
|
[node name="MidiPlayer" parent="." index="10" instance=ExtResource( 5 )]
|
||||||
|
|
||||||
|
editor/display_folded = true
|
||||||
script = ExtResource( 6 )
|
script = ExtResource( 6 )
|
||||||
file = "res://midi/Tetris - Song A.mid"
|
_sections_unfolded = [ "Pause" ]
|
||||||
volume_db = -12
|
file = "res://midi/Korobeiniki.mid"
|
||||||
|
volume_db = -24
|
||||||
loop = true
|
loop = true
|
||||||
loop_start = 1.81
|
|
||||||
soundfont = "res://midi/TimGM6mb.sf2"
|
soundfont = "res://midi/TimGM6mb.sf2"
|
||||||
|
|
||||||
[node name="LineCLearTimer" type="Timer" parent="MidiPlayer" index="1"]
|
[node name="LineCLearTimer" type="Timer" parent="MidiPlayer" index="1"]
|
||||||
@ -403,7 +448,7 @@ wait_time = 1.41
|
|||||||
one_shot = true
|
one_shot = true
|
||||||
autostart = false
|
autostart = false
|
||||||
|
|
||||||
[node name="FlashText" type="Control" parent="." index="9"]
|
[node name="FlashText" type="Control" parent="." index="11"]
|
||||||
|
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
anchor_top = 0.5
|
anchor_top = 0.5
|
||||||
@ -420,6 +465,7 @@ mouse_default_cursor_shape = 0
|
|||||||
size_flags_horizontal = 1
|
size_flags_horizontal = 1
|
||||||
size_flags_vertical = 1
|
size_flags_vertical = 1
|
||||||
script = ExtResource( 7 )
|
script = ExtResource( 7 )
|
||||||
|
_sections_unfolded = [ "Material", "Size Flags", "Theme" ]
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="FlashText" index="0"]
|
[node name="Label" type="Label" parent="FlashText" index="0"]
|
||||||
|
|
||||||
@ -456,25 +502,35 @@ anims/Flash = SubResource( 7 )
|
|||||||
blend_times = [ ]
|
blend_times = [ ]
|
||||||
_sections_unfolded = [ "Playback Options" ]
|
_sections_unfolded = [ "Playback Options" ]
|
||||||
|
|
||||||
[node name="Stats" parent="." index="10" instance=ExtResource( 9 )]
|
[node name="Stats" parent="." index="12" instance=ExtResource( 9 )]
|
||||||
|
|
||||||
|
visible = false
|
||||||
|
anchor_left = 0.0
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_right = 0.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
margin_left = 95.0
|
||||||
|
margin_top = -250.0
|
||||||
|
margin_right = 205.0
|
||||||
|
margin_bottom = -40.0
|
||||||
|
|
||||||
|
[node name="controls_ui" parent="." index="13" instance=ExtResource( 10 )]
|
||||||
|
|
||||||
visible = false
|
visible = false
|
||||||
|
|
||||||
[node name="controls_ui" parent="." index="11" instance=ExtResource( 10 )]
|
[node name="Start" parent="." index="14" instance=ExtResource( 11 )]
|
||||||
|
|
||||||
visible = false
|
[node name="ReplayButton" type="Button" parent="." index="15"]
|
||||||
|
|
||||||
[node name="ReplayButton" type="Button" parent="." index="12"]
|
|
||||||
|
|
||||||
visible = false
|
visible = false
|
||||||
anchor_left = 1.0
|
anchor_left = 1.0
|
||||||
anchor_top = 1.0
|
anchor_top = 1.0
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
margin_left = -100.0
|
margin_left = -215.0
|
||||||
margin_top = -60.0
|
margin_top = -100.0
|
||||||
margin_right = -27.0
|
margin_right = -90.0
|
||||||
margin_bottom = -26.0
|
margin_bottom = -60.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
focus_mode = 2
|
focus_mode = 2
|
||||||
@ -488,23 +544,13 @@ toggle_mode = false
|
|||||||
enabled_focus_mode = 2
|
enabled_focus_mode = 2
|
||||||
shortcut = null
|
shortcut = null
|
||||||
group = null
|
group = null
|
||||||
text = "REPLAY"
|
text = "play again"
|
||||||
flat = false
|
flat = false
|
||||||
align = 1
|
align = 1
|
||||||
_sections_unfolded = [ "Margin", "custom_colors", "custom_fonts" ]
|
_sections_unfolded = [ "Margin", "custom_colors", "custom_fonts" ]
|
||||||
|
|
||||||
[node name="Start" parent="." index="13" instance=ExtResource( 12 )]
|
|
||||||
|
|
||||||
[connection signal="piece_dropped" from="." to="Stats" method="_on_Main_piece_dropped"]
|
|
||||||
|
|
||||||
[connection signal="piece_locked" from="." to="Stats" method="_on_Main_piece_locked"]
|
|
||||||
|
|
||||||
[connection signal="piece_locked" from="." to="MidiPlayer" method="_on_Main_piece_locked"]
|
|
||||||
|
|
||||||
[connection signal="timeout" from="DropTimer" to="." method="_on_DropTimer_timeout"]
|
[connection signal="timeout" from="DropTimer" to="." method="_on_DropTimer_timeout"]
|
||||||
|
|
||||||
[connection signal="timeout" from="LockDelay" to="." method="_on_LockDelay_timeout"]
|
|
||||||
|
|
||||||
[connection signal="timeout" from="AutoShiftDelay" to="." method="_on_AutoShiftDelay_timeout"]
|
[connection signal="timeout" from="AutoShiftDelay" to="." method="_on_AutoShiftDelay_timeout"]
|
||||||
|
|
||||||
[connection signal="timeout" from="AutoShiftTimer" to="." method="_on_AutoShiftTimer_timeout"]
|
[connection signal="timeout" from="AutoShiftTimer" to="." method="_on_AutoShiftTimer_timeout"]
|
||||||
@ -513,12 +559,10 @@ _sections_unfolded = [ "Margin", "custom_colors", "custom_fonts" ]
|
|||||||
|
|
||||||
[connection signal="animation_finished" from="FlashText/AnimationPlayer" to="FlashText" method="_on_AnimationPlayer_animation_finished"]
|
[connection signal="animation_finished" from="FlashText/AnimationPlayer" to="FlashText" method="_on_AnimationPlayer_animation_finished"]
|
||||||
|
|
||||||
[connection signal="flash_text" from="Stats" to="FlashText" method="print"]
|
[connection signal="level_up" from="Stats" to="." method="new_level"]
|
||||||
|
|
||||||
[connection signal="level_up" from="Stats" to="." method="_on_Stats_level_up"]
|
[connection signal="start" from="Start" to="." method="new_game"]
|
||||||
|
|
||||||
[connection signal="pressed" from="ReplayButton" to="." method="_on_ReplayButton_pressed"]
|
[connection signal="pressed" from="ReplayButton" to="." method="_on_ReplayButton_pressed"]
|
||||||
|
|
||||||
[connection signal="start" from="Start" to="." method="_on_Start_start"]
|
|
||||||
|
|
||||||
|
|
@ -2,13 +2,13 @@ extends "midi/MidiPlayer.gd"
|
|||||||
|
|
||||||
const Tetromino = preload("res://Tetrominos/Tetromino.gd")
|
const Tetromino = preload("res://Tetrominos/Tetromino.gd")
|
||||||
|
|
||||||
const LINE_CLEAR_CHANNELS = [2, 6]
|
const LINE_CLEAR_CHANNELS = [2]
|
||||||
const MOVE_CHANNELS = []
|
|
||||||
|
|
||||||
var muted_events = []
|
var muted_events = []
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
mute_channels(MOVE_CHANNELS+LINE_CLEAR_CHANNELS)
|
._ready()
|
||||||
|
mute_channels(LINE_CLEAR_CHANNELS)
|
||||||
|
|
||||||
func _init_channel( ):
|
func _init_channel( ):
|
||||||
._init_channel()
|
._init_channel()
|
||||||
@ -37,22 +37,17 @@ func unmute_channels(channels):
|
|||||||
for note in muted_events[channel_id]:
|
for note in muted_events[channel_id]:
|
||||||
_process_track_event_note_on(channel_status[channel_id], muted_events[channel_id][note])
|
_process_track_event_note_on(channel_status[channel_id], muted_events[channel_id][note])
|
||||||
|
|
||||||
func move():
|
func piece_locked(lines):
|
||||||
unmute_channels(MOVE_CHANNELS)
|
if lines == Tetromino.NB_MINOES:
|
||||||
mute_channels(MOVE_CHANNELS)
|
for channel in LINE_CLEAR_CHANNELS:
|
||||||
|
channel_status[channel].vomume = 127
|
||||||
func _on_Main_piece_locked(lines, t_spin):
|
$LineCLearTimer.wait_time = 0.86
|
||||||
if lines or t_spin:
|
else:
|
||||||
if lines == Tetromino.NB_MINOES:
|
for channel in LINE_CLEAR_CHANNELS:
|
||||||
for channel in LINE_CLEAR_CHANNELS:
|
channel_status[channel].vomume = 100
|
||||||
channel_status[channel].vomume = 127
|
$LineCLearTimer.wait_time = 0.43
|
||||||
$LineCLearTimer.wait_time = 0.86
|
unmute_channels(LINE_CLEAR_CHANNELS)
|
||||||
else:
|
$LineCLearTimer.start()
|
||||||
for channel in LINE_CLEAR_CHANNELS:
|
|
||||||
channel_status[channel].vomume = 100
|
|
||||||
$LineCLearTimer.wait_time = 0.43
|
|
||||||
unmute_channels(LINE_CLEAR_CHANNELS)
|
|
||||||
$LineCLearTimer.start()
|
|
||||||
|
|
||||||
func _on_LineCLearTimer_timeout():
|
func _on_LineCLearTimer_timeout():
|
||||||
mute_channels(LINE_CLEAR_CHANNELS)
|
mute_channels(LINE_CLEAR_CHANNELS)
|
@ -17,7 +17,7 @@ _sections_unfolded = [ "Extra Spacing", "Font", "Font/fallback", "Settings" ]
|
|||||||
|
|
||||||
default_font = SubResource( 1 )
|
default_font = SubResource( 1 )
|
||||||
|
|
||||||
[node name="Start" type="Control"]
|
[node name="Start" type="Control" index="0"]
|
||||||
|
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
anchor_top = 0.5
|
anchor_top = 0.5
|
||||||
@ -68,9 +68,9 @@ anchor_left = 0.5
|
|||||||
anchor_top = 0.5
|
anchor_top = 0.5
|
||||||
anchor_right = 0.5
|
anchor_right = 0.5
|
||||||
anchor_bottom = 0.5
|
anchor_bottom = 0.5
|
||||||
margin_left = -78.0
|
margin_left = -83.0
|
||||||
margin_top = -20.0
|
margin_top = -20.0
|
||||||
margin_right = 118.0
|
margin_right = 113.0
|
||||||
margin_bottom = 17.0
|
margin_bottom = 17.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
@ -97,9 +97,9 @@ anchor_left = 0.5
|
|||||||
anchor_top = 0.5
|
anchor_top = 0.5
|
||||||
anchor_right = 0.5
|
anchor_right = 0.5
|
||||||
anchor_bottom = 0.5
|
anchor_bottom = 0.5
|
||||||
margin_left = -80.0
|
margin_left = -85.0
|
||||||
margin_top = 29.0
|
margin_top = 29.0
|
||||||
margin_right = 90.0
|
margin_right = 85.0
|
||||||
margin_bottom = 69.0
|
margin_bottom = 69.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
113
source/Stats.gd
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
extends MarginContainer
|
||||||
|
|
||||||
|
const SCORES = [
|
||||||
|
{"": 0, "MINI T-SPIN": 1, "T-SPIN": 4},
|
||||||
|
{"": 1, "MINI T-SPIN": 2, "T-SPIN": 8},
|
||||||
|
{"": 3, "T-SPIN": 12},
|
||||||
|
{"": 5, "T-SPIN": 16},
|
||||||
|
{"": 8}
|
||||||
|
]
|
||||||
|
const LINES_CLEARED_NAMES = ["", "SINGLE", "DOUBLE", "TRIPLE", "TETRIS"]
|
||||||
|
const password = "TETRIS 3000"
|
||||||
|
|
||||||
|
var level
|
||||||
|
var goal
|
||||||
|
var score
|
||||||
|
var high_score
|
||||||
|
var time
|
||||||
|
var combos
|
||||||
|
var flash_text
|
||||||
|
|
||||||
|
signal level_up(level)
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
load_user_data()
|
||||||
|
flash_text = get_node("../FlashText")
|
||||||
|
|
||||||
|
func load_user_data():
|
||||||
|
var save_game = File.new()
|
||||||
|
if not save_game.file_exists("user://data.save"):
|
||||||
|
high_score = 0
|
||||||
|
else:
|
||||||
|
save_game.open_encrypted_with_pass("user://data.save", File.READ, password)
|
||||||
|
high_score = int(save_game.get_line())
|
||||||
|
$VBC/HighScore.text = str(high_score)
|
||||||
|
save_game.close()
|
||||||
|
|
||||||
|
func new_game(start_level):
|
||||||
|
level = start_level - 1
|
||||||
|
goal = 0
|
||||||
|
score = 0
|
||||||
|
$VBC/Score.text = str(score)
|
||||||
|
time = 0
|
||||||
|
$VBC/Time.text = "0:00:00"
|
||||||
|
combos = -1
|
||||||
|
new_level()
|
||||||
|
|
||||||
|
func new_level():
|
||||||
|
level += 1
|
||||||
|
goal += 5 * level
|
||||||
|
$VBC/Level.text = str(level)
|
||||||
|
$VBC/Goal.text = str(goal)
|
||||||
|
flash_text.print("Level\n%d"%level)
|
||||||
|
emit_signal("level_up", level)
|
||||||
|
|
||||||
|
func _on_Clock_timeout():
|
||||||
|
show_time()
|
||||||
|
|
||||||
|
func show_time():
|
||||||
|
var time_elapsed = OS.get_system_time_secs() - time
|
||||||
|
var seconds = time_elapsed % 60
|
||||||
|
var minutes = int(time_elapsed/60) % 60
|
||||||
|
var hours = int(time_elapsed/3600)
|
||||||
|
$VBC/Time.text = str(hours) + ":%02d"%minutes + ":%02d"%seconds
|
||||||
|
|
||||||
|
func piece_dropped(ds):
|
||||||
|
score += ds
|
||||||
|
$VBC/Score.text = str(score)
|
||||||
|
|
||||||
|
func piece_locked(lines, t_spin):
|
||||||
|
var ds
|
||||||
|
if lines or t_spin:
|
||||||
|
if lines and t_spin:
|
||||||
|
flash_text.print(t_spin + " " + LINES_CLEARED_NAMES[lines])
|
||||||
|
elif lines:
|
||||||
|
flash_text.print(LINES_CLEARED_NAMES[lines])
|
||||||
|
elif t_spin:
|
||||||
|
flash_text.print(t_spin)
|
||||||
|
goal -= SCORES[lines][""]
|
||||||
|
$VBC/Goal.text = str(goal)
|
||||||
|
ds = 100 * level * SCORES[lines][t_spin]
|
||||||
|
flash_text.print(str(ds))
|
||||||
|
score += ds
|
||||||
|
$VBC/Score.text = str(score)
|
||||||
|
if score > high_score:
|
||||||
|
high_score = score
|
||||||
|
$VBC/HighScore.text = str(high_score)
|
||||||
|
# Combos
|
||||||
|
if lines:
|
||||||
|
combos += 1
|
||||||
|
if combos > 0:
|
||||||
|
if combos == 1:
|
||||||
|
flash_text.print("COMBO")
|
||||||
|
else:
|
||||||
|
flash_text.print("COMBO x%d"%combos)
|
||||||
|
ds = (20 if lines==1 else 50) * combos * level
|
||||||
|
emit_signal("flash_text", str(ds))
|
||||||
|
score += ds
|
||||||
|
$VBC/Score.text = str(score)
|
||||||
|
else:
|
||||||
|
combos = -1
|
||||||
|
if goal <= 0:
|
||||||
|
new_level()
|
||||||
|
|
||||||
|
func _notification(what):
|
||||||
|
match what:
|
||||||
|
MainLoop.NOTIFICATION_WM_QUIT_REQUEST:
|
||||||
|
save_user_data()
|
||||||
|
|
||||||
|
func save_user_data():
|
||||||
|
var save_game = File.new()
|
||||||
|
save_game.open_encrypted_with_pass("user://data.save", File.WRITE, password)
|
||||||
|
save_game.store_line(str(high_score))
|
||||||
|
save_game.close()
|
@ -3,7 +3,7 @@
|
|||||||
[ext_resource path="res://Stats.gd" type="Script" id=1]
|
[ext_resource path="res://Stats.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://fonts/Gamer.ttf" type="DynamicFontData" id=2]
|
[ext_resource path="res://fonts/Gamer.ttf" type="DynamicFontData" id=2]
|
||||||
|
|
||||||
[sub_resource type="DynamicFont" id=2]
|
[sub_resource type="DynamicFont" id=1]
|
||||||
|
|
||||||
size = 20
|
size = 20
|
||||||
use_mipmaps = false
|
use_mipmaps = false
|
||||||
@ -70,7 +70,7 @@ mouse_filter = 2
|
|||||||
mouse_default_cursor_shape = 0
|
mouse_default_cursor_shape = 0
|
||||||
size_flags_horizontal = 1
|
size_flags_horizontal = 1
|
||||||
size_flags_vertical = 4
|
size_flags_vertical = 4
|
||||||
custom_fonts/font = SubResource( 2 )
|
custom_fonts/font = SubResource( 1 )
|
||||||
custom_colors/font_color = Color( 0.756214, 0.921978, 0.990234, 1 )
|
custom_colors/font_color = Color( 0.756214, 0.921978, 0.990234, 1 )
|
||||||
text = "Score:"
|
text = "Score:"
|
||||||
percent_visible = 1.0
|
percent_visible = 1.0
|
||||||
@ -93,7 +93,7 @@ mouse_filter = 2
|
|||||||
mouse_default_cursor_shape = 0
|
mouse_default_cursor_shape = 0
|
||||||
size_flags_horizontal = 1
|
size_flags_horizontal = 1
|
||||||
size_flags_vertical = 4
|
size_flags_vertical = 4
|
||||||
custom_fonts/font = SubResource( 2 )
|
custom_fonts/font = SubResource( 1 )
|
||||||
custom_colors/font_color = Color( 0.756214, 0.921978, 0.990234, 1 )
|
custom_colors/font_color = Color( 0.756214, 0.921978, 0.990234, 1 )
|
||||||
text = "0"
|
text = "0"
|
||||||
align = 2
|
align = 2
|
||||||
@ -117,7 +117,7 @@ mouse_filter = 2
|
|||||||
mouse_default_cursor_shape = 0
|
mouse_default_cursor_shape = 0
|
||||||
size_flags_horizontal = 1
|
size_flags_horizontal = 1
|
||||||
size_flags_vertical = 4
|
size_flags_vertical = 4
|
||||||
custom_fonts/font = SubResource( 2 )
|
custom_fonts/font = SubResource( 1 )
|
||||||
custom_colors/font_color = Color( 0.756214, 0.921978, 0.990234, 1 )
|
custom_colors/font_color = Color( 0.756214, 0.921978, 0.990234, 1 )
|
||||||
text = "High score:"
|
text = "High score:"
|
||||||
percent_visible = 1.0
|
percent_visible = 1.0
|
||||||
@ -140,7 +140,7 @@ mouse_filter = 2
|
|||||||
mouse_default_cursor_shape = 0
|
mouse_default_cursor_shape = 0
|
||||||
size_flags_horizontal = 1
|
size_flags_horizontal = 1
|
||||||
size_flags_vertical = 4
|
size_flags_vertical = 4
|
||||||
custom_fonts/font = SubResource( 2 )
|
custom_fonts/font = SubResource( 1 )
|
||||||
custom_colors/font_color = Color( 0.756214, 0.921978, 0.990234, 1 )
|
custom_colors/font_color = Color( 0.756214, 0.921978, 0.990234, 1 )
|
||||||
text = "0"
|
text = "0"
|
||||||
align = 2
|
align = 2
|
||||||
@ -164,7 +164,7 @@ mouse_filter = 2
|
|||||||
mouse_default_cursor_shape = 0
|
mouse_default_cursor_shape = 0
|
||||||
size_flags_horizontal = 1
|
size_flags_horizontal = 1
|
||||||
size_flags_vertical = 4
|
size_flags_vertical = 4
|
||||||
custom_fonts/font = SubResource( 2 )
|
custom_fonts/font = SubResource( 1 )
|
||||||
custom_colors/font_color = Color( 0.756214, 0.921978, 0.990234, 1 )
|
custom_colors/font_color = Color( 0.756214, 0.921978, 0.990234, 1 )
|
||||||
text = "Time"
|
text = "Time"
|
||||||
percent_visible = 1.0
|
percent_visible = 1.0
|
||||||
@ -186,7 +186,7 @@ mouse_filter = 2
|
|||||||
mouse_default_cursor_shape = 0
|
mouse_default_cursor_shape = 0
|
||||||
size_flags_horizontal = 1
|
size_flags_horizontal = 1
|
||||||
size_flags_vertical = 4
|
size_flags_vertical = 4
|
||||||
custom_fonts/font = SubResource( 2 )
|
custom_fonts/font = SubResource( 1 )
|
||||||
custom_colors/font_color = Color( 0.756214, 0.921978, 0.990234, 1 )
|
custom_colors/font_color = Color( 0.756214, 0.921978, 0.990234, 1 )
|
||||||
text = "0:00:00"
|
text = "0:00:00"
|
||||||
align = 2
|
align = 2
|
||||||
@ -209,7 +209,7 @@ mouse_filter = 2
|
|||||||
mouse_default_cursor_shape = 0
|
mouse_default_cursor_shape = 0
|
||||||
size_flags_horizontal = 1
|
size_flags_horizontal = 1
|
||||||
size_flags_vertical = 4
|
size_flags_vertical = 4
|
||||||
custom_fonts/font = SubResource( 2 )
|
custom_fonts/font = SubResource( 1 )
|
||||||
custom_colors/font_color = Color( 0.756214, 0.921978, 0.990234, 1 )
|
custom_colors/font_color = Color( 0.756214, 0.921978, 0.990234, 1 )
|
||||||
text = "Level:"
|
text = "Level:"
|
||||||
percent_visible = 1.0
|
percent_visible = 1.0
|
||||||
@ -231,7 +231,7 @@ mouse_filter = 2
|
|||||||
mouse_default_cursor_shape = 0
|
mouse_default_cursor_shape = 0
|
||||||
size_flags_horizontal = 1
|
size_flags_horizontal = 1
|
||||||
size_flags_vertical = 4
|
size_flags_vertical = 4
|
||||||
custom_fonts/font = SubResource( 2 )
|
custom_fonts/font = SubResource( 1 )
|
||||||
custom_colors/font_color = Color( 0.756214, 0.921978, 0.990234, 1 )
|
custom_colors/font_color = Color( 0.756214, 0.921978, 0.990234, 1 )
|
||||||
text = "0"
|
text = "0"
|
||||||
align = 2
|
align = 2
|
||||||
@ -254,7 +254,7 @@ mouse_filter = 2
|
|||||||
mouse_default_cursor_shape = 0
|
mouse_default_cursor_shape = 0
|
||||||
size_flags_horizontal = 1
|
size_flags_horizontal = 1
|
||||||
size_flags_vertical = 4
|
size_flags_vertical = 4
|
||||||
custom_fonts/font = SubResource( 2 )
|
custom_fonts/font = SubResource( 1 )
|
||||||
custom_colors/font_color = Color( 0.756214, 0.921978, 0.990234, 1 )
|
custom_colors/font_color = Color( 0.756214, 0.921978, 0.990234, 1 )
|
||||||
text = "Goal:"
|
text = "Goal:"
|
||||||
percent_visible = 1.0
|
percent_visible = 1.0
|
||||||
@ -276,7 +276,7 @@ mouse_filter = 2
|
|||||||
mouse_default_cursor_shape = 0
|
mouse_default_cursor_shape = 0
|
||||||
size_flags_horizontal = 1
|
size_flags_horizontal = 1
|
||||||
size_flags_vertical = 4
|
size_flags_vertical = 4
|
||||||
custom_fonts/font = SubResource( 2 )
|
custom_fonts/font = SubResource( 1 )
|
||||||
custom_colors/font_color = Color( 0.756214, 0.921978, 0.990234, 1 )
|
custom_colors/font_color = Color( 0.756214, 0.921978, 0.990234, 1 )
|
||||||
text = "0"
|
text = "0"
|
||||||
align = 2
|
align = 2
|
@ -123,7 +123,7 @@ params_point_size = 1.0
|
|||||||
params_billboard_mode = 0
|
params_billboard_mode = 0
|
||||||
params_grow = false
|
params_grow = false
|
||||||
params_use_alpha_scissor = false
|
params_use_alpha_scissor = false
|
||||||
albedo_color = Color( 0.601563, 0.775878, 1, 0.0196078 )
|
albedo_color = Color( 0.601563, 0.775878, 1, 0.0045098 )
|
||||||
metallic = 0.68
|
metallic = 0.68
|
||||||
metallic_specular = 1.0
|
metallic_specular = 1.0
|
||||||
metallic_texture_channel = 0
|
metallic_texture_channel = 0
|
@ -23,15 +23,15 @@ params_point_size = 1.0
|
|||||||
params_billboard_mode = 0
|
params_billboard_mode = 0
|
||||||
params_grow = false
|
params_grow = false
|
||||||
params_use_alpha_scissor = false
|
params_use_alpha_scissor = false
|
||||||
albedo_color = Color( 0.601563, 0.775878, 1, 0.162157 )
|
albedo_color = Color( 0.601563, 0.775878, 1, 0.486471 )
|
||||||
metallic = 1.0
|
metallic = 1.0
|
||||||
metallic_specular = 1.0
|
metallic_specular = 0.63
|
||||||
metallic_texture_channel = 4
|
metallic_texture_channel = 4
|
||||||
roughness = 0.46
|
roughness = 0.46
|
||||||
roughness_texture_channel = 0
|
roughness_texture_channel = 0
|
||||||
emission_enabled = true
|
emission_enabled = true
|
||||||
emission = Color( 0.755859, 1, 0.914169, 1 )
|
emission = Color( 0.755859, 1, 0.914169, 1 )
|
||||||
emission_energy = 1.0
|
emission_energy = 0.2
|
||||||
emission_operator = 0
|
emission_operator = 0
|
||||||
emission_on_uv2 = false
|
emission_on_uv2 = false
|
||||||
normal_enabled = false
|
normal_enabled = false
|
@ -1,10 +1,9 @@
|
|||||||
[gd_scene load_steps=3 format=2]
|
[gd_scene load_steps=3 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://Tetrominos/TetroJ.gd" type="Script" id=1]
|
[ext_resource path="res://Tetrominos/Tetromino.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://Tetrominos/Mino/Mino.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://Tetrominos/Mino/Mino.tscn" type="PackedScene" id=2]
|
||||||
|
|
||||||
|
[node name="TetroJ" type="Spatial"]
|
||||||
[node name="TetroJ" type="Spatial" index="0"]
|
|
||||||
|
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
|
@ -1,9 +1,8 @@
|
|||||||
[gd_scene load_steps=3 format=2]
|
[gd_scene load_steps=3 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://Tetrominos/TetroL.gd" type="Script" id=1]
|
[ext_resource path="res://Tetrominos/Tetromino.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://Tetrominos/Mino/Mino.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://Tetrominos/Mino/Mino.tscn" type="PackedScene" id=2]
|
||||||
|
|
||||||
|
|
||||||
[node name="TetroL" type="Spatial" index="0"]
|
[node name="TetroL" type="Spatial" index="0"]
|
||||||
|
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
@ -1,4 +1,5 @@
|
|||||||
extends "Tetromino.gd"
|
extends "Tetromino.gd"
|
||||||
|
|
||||||
func rotate(direction):
|
func rotate(direction):
|
||||||
pass
|
return false
|
||||||
|
|
@ -3,8 +3,7 @@
|
|||||||
[ext_resource path="res://Tetrominos/TetroO.gd" type="Script" id=1]
|
[ext_resource path="res://Tetrominos/TetroO.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://Tetrominos/Mino/Mino.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://Tetrominos/Mino/Mino.tscn" type="PackedScene" id=2]
|
||||||
|
|
||||||
|
[node name="TetroO" type="Spatial"]
|
||||||
[node name="TetroO" type="Spatial" index="0"]
|
|
||||||
|
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
|
@ -1,9 +1,8 @@
|
|||||||
[gd_scene load_steps=3 format=2]
|
[gd_scene load_steps=3 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://Tetrominos/TetroS.gd" type="Script" id=1]
|
[ext_resource path="res://Tetrominos/Tetromino.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://Tetrominos/Mino/Mino.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://Tetrominos/Mino/Mino.tscn" type="PackedScene" id=2]
|
||||||
|
|
||||||
|
|
||||||
[node name="TetroS" type="Spatial" index="0"]
|
[node name="TetroS" type="Spatial" index="0"]
|
||||||
|
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
21
source/Tetrominos/TetroT.gd
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
extends "Tetromino.gd"
|
||||||
|
|
||||||
|
const T_SLOT = [
|
||||||
|
Vector3(-1, 1, 0),
|
||||||
|
Vector3(1, 1, 0),
|
||||||
|
Vector3(1, -1, 0),
|
||||||
|
Vector3(-1, -1, 0)
|
||||||
|
]
|
||||||
|
|
||||||
|
func t_spin():
|
||||||
|
if rotated_last:
|
||||||
|
var center = to_global(minoes[0].translation)
|
||||||
|
var a = not grid_map.is_free_cell(center + T_SLOT[orientation])
|
||||||
|
var b = not grid_map.is_free_cell(center + T_SLOT[(1+orientation)%4])
|
||||||
|
var c = not grid_map.is_free_cell(center + T_SLOT[(3+orientation)%4])
|
||||||
|
var d = not grid_map.is_free_cell(center + T_SLOT[(2+orientation)%4])
|
||||||
|
if rotation_point_5_used or (a and b and (c or d)):
|
||||||
|
return "T-SPIN"
|
||||||
|
elif c and d and (a or b):
|
||||||
|
return "MINI T-SPIN"
|
||||||
|
return ""
|
@ -3,8 +3,7 @@
|
|||||||
[ext_resource path="res://Tetrominos/TetroT.gd" type="Script" id=1]
|
[ext_resource path="res://Tetrominos/TetroT.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://Tetrominos/Mino/Mino.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://Tetrominos/Mino/Mino.tscn" type="PackedScene" id=2]
|
||||||
|
|
||||||
|
[node name="TetroT" type="Spatial"]
|
||||||
[node name="TetroT" type="Spatial" index="0"]
|
|
||||||
|
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
|
@ -1,9 +1,8 @@
|
|||||||
[gd_scene load_steps=3 format=2]
|
[gd_scene load_steps=3 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://Tetrominos/TetroZ.gd" type="Script" id=1]
|
[ext_resource path="res://Tetrominos/Tetromino.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://Tetrominos/Mino/Mino.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://Tetrominos/Mino/Mino.tscn" type="PackedScene" id=2]
|
||||||
|
|
||||||
|
|
||||||
[node name="TetroZ" type="Spatial" index="0"]
|
[node name="TetroZ" type="Spatial" index="0"]
|
||||||
|
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
@ -3,9 +3,6 @@ extends Spatial
|
|||||||
const NB_MINOES = 4
|
const NB_MINOES = 4
|
||||||
const CLOCKWISE = -1
|
const CLOCKWISE = -1
|
||||||
const COUNTERCLOCKWISE = 1
|
const COUNTERCLOCKWISE = 1
|
||||||
const NO_T_SPIN = 0
|
|
||||||
const T_SPIN = 1
|
|
||||||
const MINI_T_SPIN = 2
|
|
||||||
const SUPER_ROTATION_SYSTEM = [
|
const SUPER_ROTATION_SYSTEM = [
|
||||||
{
|
{
|
||||||
COUNTERCLOCKWISE: [
|
COUNTERCLOCKWISE: [
|
||||||
@ -73,59 +70,66 @@ const SUPER_ROTATION_SYSTEM = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
var minoes
|
var minoes = []
|
||||||
var grid_map
|
var grid_map
|
||||||
|
var lock_delay
|
||||||
var orientation = 0
|
var orientation = 0
|
||||||
var t_spin = NO_T_SPIN
|
var rotation_point_5_used = false
|
||||||
|
var rotated_last = false
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
randomize()
|
|
||||||
minoes = [$Mino0, $Mino1, $Mino2, $Mino3]
|
|
||||||
grid_map = get_parent().get_node("GridMap")
|
|
||||||
|
|
||||||
func positions():
|
|
||||||
var p = []
|
|
||||||
for mino in minoes:
|
|
||||||
p.append(to_global(mino.translation))
|
|
||||||
return p
|
|
||||||
|
|
||||||
func rotated_positions(direction):
|
|
||||||
var translations = [to_global(minoes[0].translation) ]
|
|
||||||
for i in range(1, 4):
|
|
||||||
var v = to_global(minoes[i].translation)
|
|
||||||
v -= to_global(minoes[0].translation)
|
|
||||||
v = Vector3(-1*direction*v.y, direction*v.x, 0)
|
|
||||||
v += to_global(minoes[0].translation)
|
|
||||||
translations.append(v)
|
|
||||||
return translations
|
|
||||||
|
|
||||||
func apply_positions(positions):
|
|
||||||
for i in range(NB_MINOES):
|
for i in range(NB_MINOES):
|
||||||
minoes[i].translation = to_local(positions[i])
|
minoes.append(get_node("Mino"+str(i)))
|
||||||
|
grid_map = get_node("../Matrix/GridMap")
|
||||||
|
lock_delay = get_node("../LockDelay")
|
||||||
|
|
||||||
|
func set_translations(translations):
|
||||||
|
for i in range(NB_MINOES):
|
||||||
|
minoes[i].translation = to_local(translations[i])
|
||||||
|
|
||||||
|
func get_translations():
|
||||||
|
var translations = []
|
||||||
|
for mino in minoes:
|
||||||
|
translations.append(to_global(mino.translation))
|
||||||
|
return translations
|
||||||
|
|
||||||
func move(movement):
|
func move(movement):
|
||||||
if grid_map.possible_positions(positions(), movement):
|
if grid_map.possible_positions(get_translations(), movement):
|
||||||
translate(movement)
|
translate(movement)
|
||||||
|
lock_delay.start()
|
||||||
|
rotated_last = false
|
||||||
return true
|
return true
|
||||||
else:
|
return false
|
||||||
return false
|
|
||||||
|
|
||||||
func rotate(direction):
|
func rotate(direction):
|
||||||
var rotated_positions = rotated_positions(direction)
|
var translations = get_translations()
|
||||||
|
var rotated_translations = [translations[0]]
|
||||||
|
var center = translations[0]
|
||||||
|
for i in range(1, NB_MINOES):
|
||||||
|
var rt = translations[i] - center
|
||||||
|
rt = Vector3(-1*direction*rt.y, direction*rt.x, 0)
|
||||||
|
rt += center
|
||||||
|
rotated_translations.append(rt)
|
||||||
var movements = SUPER_ROTATION_SYSTEM[orientation][direction]
|
var movements = SUPER_ROTATION_SYSTEM[orientation][direction]
|
||||||
for i in range(movements.size()):
|
for i in range(movements.size()):
|
||||||
if grid_map.possible_positions(rotated_positions, movements[i]):
|
if grid_map.possible_positions(rotated_translations, movements[i]):
|
||||||
orientation -= direction
|
orientation = (orientation - direction) % NB_MINOES
|
||||||
orientation %= NB_MINOES
|
set_translations(rotated_translations)
|
||||||
apply_positions(rotated_positions)
|
|
||||||
translate(movements[i])
|
translate(movements[i])
|
||||||
return i+1
|
lock_delay.start()
|
||||||
return 0
|
rotated_last = true
|
||||||
|
if i == 4:
|
||||||
|
rotation_point_5_used = true
|
||||||
|
return true
|
||||||
|
return false
|
||||||
|
|
||||||
func emit_trail(emit):
|
func t_spin():
|
||||||
|
return ""
|
||||||
|
|
||||||
|
func emit_trail(visible):
|
||||||
var trail
|
var trail
|
||||||
for mino in minoes:
|
for mino in minoes:
|
||||||
trail = mino.get_node("Trail")
|
trail = mino.get_node("Trail")
|
||||||
trail.emitting = emit
|
trail.emitting = visible
|
||||||
trail.restart()
|
trail.visible = visible
|
||||||
mino.get_node("SpotLight").visible = emit
|
mino.get_node("SpotLight").visible = visible
|
BIN
source/aperture-vintage-472251-unsplash.jpg
Normal file
After Width: | Height: | Size: 348 KiB |
@ -1,17 +1,5 @@
|
|||||||
extends Control
|
extends Control
|
||||||
|
|
||||||
# Note for the reader:
|
|
||||||
#
|
|
||||||
# This demo conveniently uses the same names for actions and for the container nodes
|
|
||||||
# that hold each remapping button. This allow to get back to the button based simply
|
|
||||||
# on the name of the corresponding action, but it might not be so simple in your project.
|
|
||||||
#
|
|
||||||
# A better approach for large-scale input remapping might be to do the connections between
|
|
||||||
# buttons and wait_for_input through the code, passing as arguments both the name of the
|
|
||||||
# action and the node, e.g.:
|
|
||||||
# button.connect("pressed", self, "wait_for_input", [ button, action ])
|
|
||||||
|
|
||||||
# Constants
|
|
||||||
const INPUT_ACTIONS = [
|
const INPUT_ACTIONS = [
|
||||||
"move_left",
|
"move_left",
|
||||||
"move_right",
|
"move_right",
|
||||||
@ -24,11 +12,8 @@ const INPUT_ACTIONS = [
|
|||||||
]
|
]
|
||||||
const CONFIG_FILE = "user://input.cfg"
|
const CONFIG_FILE = "user://input.cfg"
|
||||||
|
|
||||||
# Member variables
|
|
||||||
var action # To register the action the UI is currently handling
|
var action # To register the action the UI is currently handling
|
||||||
var button # Button node corresponding to the above action
|
var button # Button node corresponding to the above action
|
||||||
var enable_resume = true
|
|
||||||
|
|
||||||
|
|
||||||
# Load/save input mapping to a config file
|
# Load/save input mapping to a config file
|
||||||
# Changes done while testing the demo will be persistent, saved to CONFIG_FILE
|
# Changes done while testing the demo will be persistent, saved to CONFIG_FILE
|
||||||
@ -74,8 +59,7 @@ func wait_for_input(action_bind):
|
|||||||
action = action_bind
|
action = action_bind
|
||||||
# See note at the beginning of the script
|
# See note at the beginning of the script
|
||||||
button = get_node("bindings").get_node(action).get_node("Button")
|
button = get_node("bindings").get_node(action).get_node("Button")
|
||||||
#get_node("contextual_help").text = "Press a key to assign to the '" + action + "' action."
|
button.text = "Press key"
|
||||||
enable_resume = false
|
|
||||||
set_process_input(true)
|
set_process_input(true)
|
||||||
|
|
||||||
|
|
||||||
@ -85,9 +69,7 @@ func _input(event):
|
|||||||
# Register the event as handled and stop polling
|
# Register the event as handled and stop polling
|
||||||
get_tree().set_input_as_handled()
|
get_tree().set_input_as_handled()
|
||||||
set_process_input(false)
|
set_process_input(false)
|
||||||
# Reinitialise the contextual help label
|
|
||||||
#get_node("contextual_help").text = "Click a key binding to reassign it, or press the Cancel action."
|
|
||||||
|
|
||||||
# Display the string corresponding to the pressed key
|
# Display the string corresponding to the pressed key
|
||||||
var scancode = OS.get_scancode_string(event.scancode)
|
var scancode = OS.get_scancode_string(event.scancode)
|
||||||
button.text = scancode
|
button.text = scancode
|
||||||
@ -97,9 +79,8 @@ func _input(event):
|
|||||||
# Add the new key binding
|
# Add the new key binding
|
||||||
InputMap.action_add_event(action, event)
|
InputMap.action_add_event(action, event)
|
||||||
save_to_config("input", action, scancode)
|
save_to_config("input", action, scancode)
|
||||||
enable_resume = true
|
hint_text()
|
||||||
|
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
# Load config if existing, if not it will be generated with default values
|
# Load config if existing, if not it will be generated with default values
|
||||||
load_config()
|
load_config()
|
||||||
@ -111,6 +92,13 @@ func _ready():
|
|||||||
var button = get_node("bindings").get_node(action).get_node("Button")
|
var button = get_node("bindings").get_node(action).get_node("Button")
|
||||||
button.text = OS.get_scancode_string(input_event.scancode)
|
button.text = OS.get_scancode_string(input_event.scancode)
|
||||||
button.connect("pressed", self, "wait_for_input", [action])
|
button.connect("pressed", self, "wait_for_input", [action])
|
||||||
|
|
||||||
|
hint_text()
|
||||||
|
|
||||||
|
func hint_text():
|
||||||
|
var input_event = InputMap.get_action_list("pause")[0]
|
||||||
|
var scancode = OS.get_scancode_string(input_event.scancode)
|
||||||
|
$hint.text = "Press ["+ scancode + "] to resume\nor click on a button to change key assignment"
|
||||||
|
|
||||||
# Do not start processing input until a button is pressed
|
# Do not start processing input until a button is pressed
|
||||||
set_process_input(false)
|
set_process_input(false)
|
@ -1,30 +1,27 @@
|
|||||||
[gd_scene load_steps=6 format=2]
|
[gd_scene load_steps=12 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://controls.gd" type="Script" id=1]
|
[ext_resource path="res://controls.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://fonts/TitleFont.tres" type="DynamicFont" id=2]
|
[ext_resource path="res://fonts/TitleFont.tres" type="DynamicFont" id=2]
|
||||||
[ext_resource path="res://fonts/Gamer.ttf" type="DynamicFontData" id=3]
|
[ext_resource path="res://fonts/ButtonFont.tres" type="DynamicFont" id=3]
|
||||||
[ext_resource path="res://fonts/ButtonFont.tres" type="DynamicFont" id=4]
|
[ext_resource path="res://icons/arrowLeft.png" type="Texture" id=4]
|
||||||
|
[ext_resource path="res://icons/arrowRight.png" type="Texture" id=5]
|
||||||
|
[ext_resource path="res://icons/clockwise.png" type="Texture" id=6]
|
||||||
|
[ext_resource path="res://icons/counterclockwise.png" type="Texture" id=7]
|
||||||
|
[ext_resource path="res://icons/arrowDown.png" type="Texture" id=8]
|
||||||
|
[ext_resource path="res://icons/harddrop.png" type="Texture" id=9]
|
||||||
|
[ext_resource path="res://icons/hold.png" type="Texture" id=10]
|
||||||
|
[ext_resource path="res://icons/pause.png" type="Texture" id=11]
|
||||||
|
|
||||||
[sub_resource type="DynamicFont" id=2]
|
[node name="controls_ui" type="Control" index="0"]
|
||||||
|
|
||||||
size = 20
|
|
||||||
use_mipmaps = true
|
|
||||||
use_filter = false
|
|
||||||
extra_spacing_top = -4
|
|
||||||
extra_spacing_bottom = -4
|
|
||||||
font_data = ExtResource( 3 )
|
|
||||||
_sections_unfolded = [ "Extra Spacing", "Font", "Settings" ]
|
|
||||||
|
|
||||||
[node name="controls_ui" type="Control"]
|
|
||||||
|
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
anchor_top = 0.5
|
anchor_top = 0.5
|
||||||
anchor_right = 0.5
|
anchor_right = 0.5
|
||||||
anchor_bottom = 0.5
|
anchor_bottom = 0.5
|
||||||
margin_left = -30.0
|
margin_left = -30.0
|
||||||
margin_top = 10.0
|
margin_top = 20.0
|
||||||
margin_right = 10.0
|
margin_right = 10.0
|
||||||
margin_bottom = 50.0
|
margin_bottom = 60.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
mouse_filter = 0
|
mouse_filter = 0
|
||||||
@ -42,10 +39,10 @@ anchor_left = 0.0
|
|||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
anchor_bottom = 0.0
|
anchor_bottom = 0.0
|
||||||
margin_left = -40.0
|
margin_left = -220.0
|
||||||
margin_top = -150.0
|
margin_top = -190.0
|
||||||
margin_right = 110.0
|
margin_right = 280.0
|
||||||
margin_bottom = -111.0
|
margin_bottom = -151.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
mouse_filter = 2
|
mouse_filter = 2
|
||||||
@ -56,6 +53,8 @@ custom_fonts/font = ExtResource( 2 )
|
|||||||
custom_colors/font_color = Color( 0.443137, 0.709804, 0.819608, 0.533333 )
|
custom_colors/font_color = Color( 0.443137, 0.709804, 0.819608, 0.533333 )
|
||||||
custom_colors/font_color_shadow = Color( 1, 1, 1, 0.0968627 )
|
custom_colors/font_color_shadow = Color( 1, 1, 1, 0.0968627 )
|
||||||
text = "PAUSE"
|
text = "PAUSE"
|
||||||
|
align = 1
|
||||||
|
valign = 1
|
||||||
percent_visible = 1.0
|
percent_visible = 1.0
|
||||||
lines_skipped = 0
|
lines_skipped = 0
|
||||||
max_lines_visible = -1
|
max_lines_visible = -1
|
||||||
@ -84,10 +83,10 @@ anchor_left = 0.0
|
|||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
anchor_bottom = 0.0
|
anchor_bottom = 0.0
|
||||||
margin_left = 50.0
|
margin_left = 20.0
|
||||||
margin_top = 50.0
|
margin_top = 65.0
|
||||||
margin_right = 90.0
|
margin_right = 60.0
|
||||||
margin_bottom = 90.0
|
margin_bottom = 105.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
mouse_filter = 0
|
mouse_filter = 0
|
||||||
@ -95,38 +94,14 @@ mouse_default_cursor_shape = 0
|
|||||||
size_flags_horizontal = 2
|
size_flags_horizontal = 2
|
||||||
size_flags_vertical = 2
|
size_flags_vertical = 2
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="bindings/move_left" index="0"]
|
[node name="Button" type="Button" parent="bindings/move_left" index="0"]
|
||||||
|
|
||||||
anchor_left = 0.0
|
|
||||||
anchor_top = 0.0
|
|
||||||
anchor_right = 0.0
|
|
||||||
anchor_bottom = 0.0
|
|
||||||
margin_right = 69.0
|
|
||||||
margin_bottom = 29.0
|
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
|
||||||
rect_clip_content = false
|
|
||||||
mouse_filter = 2
|
|
||||||
mouse_default_cursor_shape = 0
|
|
||||||
size_flags_horizontal = 2
|
|
||||||
size_flags_vertical = 0
|
|
||||||
custom_fonts/font = SubResource( 2 )
|
|
||||||
custom_colors/font_color = Color( 0.752941, 0.921569, 0.988235, 1 )
|
|
||||||
text = "move
|
|
||||||
left"
|
|
||||||
valign = 1
|
|
||||||
percent_visible = 1.0
|
|
||||||
lines_skipped = 0
|
|
||||||
max_lines_visible = -1
|
|
||||||
_sections_unfolded = [ "Rect", "custom_fonts" ]
|
|
||||||
|
|
||||||
[node name="Button" type="Button" parent="bindings/move_left" index="1"]
|
|
||||||
|
|
||||||
anchor_left = 0.0
|
anchor_left = 0.0
|
||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
anchor_bottom = 0.0
|
anchor_bottom = 0.0
|
||||||
margin_left = 80.0
|
margin_left = 80.0
|
||||||
margin_right = 155.0
|
margin_right = 174.0
|
||||||
margin_bottom = 37.0
|
margin_bottom = 37.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
@ -135,25 +110,32 @@ mouse_filter = 0
|
|||||||
mouse_default_cursor_shape = 0
|
mouse_default_cursor_shape = 0
|
||||||
size_flags_horizontal = 2
|
size_flags_horizontal = 2
|
||||||
size_flags_vertical = 2
|
size_flags_vertical = 2
|
||||||
custom_fonts/font = ExtResource( 4 )
|
custom_fonts/font = ExtResource( 3 )
|
||||||
toggle_mode = false
|
toggle_mode = false
|
||||||
enabled_focus_mode = 2
|
enabled_focus_mode = 2
|
||||||
shortcut = null
|
shortcut = null
|
||||||
group = null
|
group = null
|
||||||
|
text = "Press key"
|
||||||
flat = false
|
flat = false
|
||||||
align = 1
|
align = 1
|
||||||
_sections_unfolded = [ "Rect" ]
|
_sections_unfolded = [ "Rect" ]
|
||||||
|
|
||||||
|
[node name="arrowLeft" type="Sprite" parent="bindings/move_left" index="1"]
|
||||||
|
|
||||||
|
position = Vector2( 30, 20 )
|
||||||
|
scale = Vector2( 0.75, 0.75 )
|
||||||
|
texture = ExtResource( 4 )
|
||||||
|
|
||||||
[node name="move_right" type="Control" parent="bindings" index="1"]
|
[node name="move_right" type="Control" parent="bindings" index="1"]
|
||||||
|
|
||||||
anchor_left = 0.0
|
anchor_left = 0.0
|
||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
anchor_bottom = 0.0
|
anchor_bottom = 0.0
|
||||||
margin_left = 226.0
|
margin_left = 220.0
|
||||||
margin_top = 51.0
|
margin_top = 65.0
|
||||||
margin_right = 266.0
|
margin_right = 260.0
|
||||||
margin_bottom = 91.0
|
margin_bottom = 105.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
mouse_filter = 0
|
mouse_filter = 0
|
||||||
@ -161,32 +143,7 @@ mouse_default_cursor_shape = 0
|
|||||||
size_flags_horizontal = 2
|
size_flags_horizontal = 2
|
||||||
size_flags_vertical = 2
|
size_flags_vertical = 2
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="bindings/move_right" index="0"]
|
[node name="Button" type="Button" parent="bindings/move_right" index="0"]
|
||||||
|
|
||||||
anchor_left = 0.0
|
|
||||||
anchor_top = 0.0
|
|
||||||
anchor_right = 0.0
|
|
||||||
anchor_bottom = 0.0
|
|
||||||
margin_left = 5.0
|
|
||||||
margin_top = -1.0
|
|
||||||
margin_right = 80.0
|
|
||||||
margin_bottom = 31.0
|
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
|
||||||
rect_clip_content = false
|
|
||||||
mouse_filter = 2
|
|
||||||
mouse_default_cursor_shape = 0
|
|
||||||
size_flags_horizontal = 2
|
|
||||||
size_flags_vertical = 0
|
|
||||||
custom_fonts/font = SubResource( 2 )
|
|
||||||
custom_colors/font_color = Color( 0.752941, 0.921569, 0.988235, 1 )
|
|
||||||
text = "move
|
|
||||||
right"
|
|
||||||
valign = 1
|
|
||||||
percent_visible = 1.0
|
|
||||||
lines_skipped = 0
|
|
||||||
max_lines_visible = -1
|
|
||||||
|
|
||||||
[node name="Button" type="Button" parent="bindings/move_right" index="1"]
|
|
||||||
|
|
||||||
anchor_left = 0.0
|
anchor_left = 0.0
|
||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
@ -194,7 +151,7 @@ anchor_right = 0.0
|
|||||||
anchor_bottom = 0.0
|
anchor_bottom = 0.0
|
||||||
margin_left = 84.0
|
margin_left = 84.0
|
||||||
margin_top = -1.0
|
margin_top = -1.0
|
||||||
margin_right = 159.0
|
margin_right = 178.0
|
||||||
margin_bottom = 36.0
|
margin_bottom = 36.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
@ -203,13 +160,22 @@ mouse_filter = 0
|
|||||||
mouse_default_cursor_shape = 0
|
mouse_default_cursor_shape = 0
|
||||||
size_flags_horizontal = 2
|
size_flags_horizontal = 2
|
||||||
size_flags_vertical = 2
|
size_flags_vertical = 2
|
||||||
custom_fonts/font = ExtResource( 4 )
|
custom_fonts/font = ExtResource( 3 )
|
||||||
toggle_mode = false
|
toggle_mode = false
|
||||||
enabled_focus_mode = 2
|
enabled_focus_mode = 2
|
||||||
shortcut = null
|
shortcut = null
|
||||||
group = null
|
group = null
|
||||||
|
text = "Press key"
|
||||||
flat = false
|
flat = false
|
||||||
align = 1
|
align = 1
|
||||||
|
_sections_unfolded = [ "custom_fonts" ]
|
||||||
|
|
||||||
|
[node name="arrowRight" type="Sprite" parent="bindings/move_right" index="1"]
|
||||||
|
|
||||||
|
position = Vector2( 34, 19 )
|
||||||
|
scale = Vector2( 0.8, 0.8 )
|
||||||
|
texture = ExtResource( 5 )
|
||||||
|
_sections_unfolded = [ "Transform" ]
|
||||||
|
|
||||||
[node name="rotate_clockwise" type="Control" parent="bindings" index="2"]
|
[node name="rotate_clockwise" type="Control" parent="bindings" index="2"]
|
||||||
|
|
||||||
@ -217,10 +183,10 @@ anchor_left = 0.0
|
|||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
anchor_bottom = 0.0
|
anchor_bottom = 0.0
|
||||||
margin_left = 50.0
|
margin_left = 224.0
|
||||||
margin_top = 100.0
|
margin_top = 114.0
|
||||||
margin_right = 90.0
|
margin_right = 264.0
|
||||||
margin_bottom = 140.0
|
margin_bottom = 154.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
mouse_filter = 0
|
mouse_filter = 0
|
||||||
@ -228,37 +194,14 @@ mouse_default_cursor_shape = 0
|
|||||||
size_flags_horizontal = 2
|
size_flags_horizontal = 2
|
||||||
size_flags_vertical = 2
|
size_flags_vertical = 2
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="bindings/rotate_clockwise" index="0"]
|
[node name="Button" type="Button" parent="bindings/rotate_clockwise" index="0"]
|
||||||
|
|
||||||
anchor_left = 0.0
|
|
||||||
anchor_top = 0.0
|
|
||||||
anchor_right = 0.0
|
|
||||||
anchor_bottom = 0.0
|
|
||||||
margin_right = 118.0
|
|
||||||
margin_bottom = 32.0
|
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
|
||||||
rect_clip_content = false
|
|
||||||
mouse_filter = 2
|
|
||||||
mouse_default_cursor_shape = 0
|
|
||||||
size_flags_horizontal = 2
|
|
||||||
size_flags_vertical = 0
|
|
||||||
custom_fonts/font = SubResource( 2 )
|
|
||||||
custom_colors/font_color = Color( 0.752941, 0.921569, 0.988235, 1 )
|
|
||||||
text = "rotate
|
|
||||||
clockwise"
|
|
||||||
valign = 1
|
|
||||||
percent_visible = 1.0
|
|
||||||
lines_skipped = 0
|
|
||||||
max_lines_visible = -1
|
|
||||||
|
|
||||||
[node name="Button" type="Button" parent="bindings/rotate_clockwise" index="1"]
|
|
||||||
|
|
||||||
anchor_left = 0.0
|
anchor_left = 0.0
|
||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
anchor_bottom = 0.0
|
anchor_bottom = 0.0
|
||||||
margin_left = 80.0
|
margin_left = 80.0
|
||||||
margin_right = 155.0
|
margin_right = 174.0
|
||||||
margin_bottom = 37.0
|
margin_bottom = 37.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
@ -267,14 +210,21 @@ mouse_filter = 0
|
|||||||
mouse_default_cursor_shape = 0
|
mouse_default_cursor_shape = 0
|
||||||
size_flags_horizontal = 2
|
size_flags_horizontal = 2
|
||||||
size_flags_vertical = 2
|
size_flags_vertical = 2
|
||||||
custom_fonts/font = ExtResource( 4 )
|
custom_fonts/font = ExtResource( 3 )
|
||||||
toggle_mode = false
|
toggle_mode = false
|
||||||
enabled_focus_mode = 2
|
enabled_focus_mode = 2
|
||||||
shortcut = null
|
shortcut = null
|
||||||
group = null
|
group = null
|
||||||
|
text = "Press key"
|
||||||
flat = false
|
flat = false
|
||||||
align = 1
|
align = 1
|
||||||
_sections_unfolded = [ "custom_fonts" ]
|
_sections_unfolded = [ "Rect", "custom_fonts" ]
|
||||||
|
|
||||||
|
[node name="clockwise" type="Sprite" parent="bindings/rotate_clockwise" index="1"]
|
||||||
|
|
||||||
|
position = Vector2( 30, 15 )
|
||||||
|
scale = Vector2( 0.8, 0.8 )
|
||||||
|
texture = ExtResource( 6 )
|
||||||
|
|
||||||
[node name="rotate_counterclockwise" type="Control" parent="bindings" index="3"]
|
[node name="rotate_counterclockwise" type="Control" parent="bindings" index="3"]
|
||||||
|
|
||||||
@ -282,10 +232,10 @@ anchor_left = 0.0
|
|||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
anchor_bottom = 0.0
|
anchor_bottom = 0.0
|
||||||
margin_left = 226.0
|
margin_left = 15.0
|
||||||
margin_top = 101.0
|
margin_top = 115.0
|
||||||
margin_right = 266.0
|
margin_right = 55.0
|
||||||
margin_bottom = 141.0
|
margin_bottom = 155.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
mouse_filter = 0
|
mouse_filter = 0
|
||||||
@ -293,33 +243,7 @@ mouse_default_cursor_shape = 0
|
|||||||
size_flags_horizontal = 2
|
size_flags_horizontal = 2
|
||||||
size_flags_vertical = 2
|
size_flags_vertical = 2
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="bindings/rotate_counterclockwise" index="0"]
|
[node name="Button" type="Button" parent="bindings/rotate_counterclockwise" index="0"]
|
||||||
|
|
||||||
anchor_left = 0.0
|
|
||||||
anchor_top = 0.0
|
|
||||||
anchor_right = 0.0
|
|
||||||
anchor_bottom = 0.0
|
|
||||||
margin_left = 5.0
|
|
||||||
margin_top = -2.0
|
|
||||||
margin_right = 177.0
|
|
||||||
margin_bottom = 37.0
|
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
|
||||||
rect_clip_content = false
|
|
||||||
mouse_filter = 2
|
|
||||||
mouse_default_cursor_shape = 0
|
|
||||||
size_flags_horizontal = 2
|
|
||||||
size_flags_vertical = 0
|
|
||||||
custom_fonts/font = SubResource( 2 )
|
|
||||||
custom_colors/font_color = Color( 0.752941, 0.921569, 0.988235, 1 )
|
|
||||||
text = "rotate
|
|
||||||
counter
|
|
||||||
clockwise"
|
|
||||||
valign = 1
|
|
||||||
percent_visible = 1.0
|
|
||||||
lines_skipped = 0
|
|
||||||
max_lines_visible = -1
|
|
||||||
|
|
||||||
[node name="Button" type="Button" parent="bindings/rotate_counterclockwise" index="1"]
|
|
||||||
|
|
||||||
anchor_left = 0.0
|
anchor_left = 0.0
|
||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
@ -327,7 +251,7 @@ anchor_right = 0.0
|
|||||||
anchor_bottom = 0.0
|
anchor_bottom = 0.0
|
||||||
margin_left = 84.0
|
margin_left = 84.0
|
||||||
margin_top = -1.0
|
margin_top = -1.0
|
||||||
margin_right = 159.0
|
margin_right = 178.0
|
||||||
margin_bottom = 36.0
|
margin_bottom = 36.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
@ -336,25 +260,32 @@ mouse_filter = 0
|
|||||||
mouse_default_cursor_shape = 0
|
mouse_default_cursor_shape = 0
|
||||||
size_flags_horizontal = 2
|
size_flags_horizontal = 2
|
||||||
size_flags_vertical = 2
|
size_flags_vertical = 2
|
||||||
custom_fonts/font = ExtResource( 4 )
|
custom_fonts/font = ExtResource( 3 )
|
||||||
toggle_mode = false
|
toggle_mode = false
|
||||||
enabled_focus_mode = 2
|
enabled_focus_mode = 2
|
||||||
shortcut = null
|
shortcut = null
|
||||||
group = null
|
group = null
|
||||||
|
text = "Press key"
|
||||||
flat = false
|
flat = false
|
||||||
align = 1
|
align = 1
|
||||||
_sections_unfolded = [ "Rect" ]
|
_sections_unfolded = [ "Rect" ]
|
||||||
|
|
||||||
|
[node name="counterclockwise" type="Sprite" parent="bindings/rotate_counterclockwise" index="1"]
|
||||||
|
|
||||||
|
position = Vector2( 35, 15 )
|
||||||
|
scale = Vector2( 0.82, 0.82 )
|
||||||
|
texture = ExtResource( 7 )
|
||||||
|
|
||||||
[node name="soft_drop" type="Control" parent="bindings" index="4"]
|
[node name="soft_drop" type="Control" parent="bindings" index="4"]
|
||||||
|
|
||||||
anchor_left = 0.0
|
anchor_left = 0.0
|
||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
anchor_bottom = 0.0
|
anchor_bottom = 0.0
|
||||||
margin_left = 50.0
|
margin_left = 20.0
|
||||||
margin_top = 150.0
|
margin_top = 165.0
|
||||||
margin_right = 90.0
|
margin_right = 60.0
|
||||||
margin_bottom = 190.0
|
margin_bottom = 205.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
mouse_filter = 0
|
mouse_filter = 0
|
||||||
@ -362,37 +293,14 @@ mouse_default_cursor_shape = 0
|
|||||||
size_flags_horizontal = 2
|
size_flags_horizontal = 2
|
||||||
size_flags_vertical = 2
|
size_flags_vertical = 2
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="bindings/soft_drop" index="0"]
|
[node name="Button" type="Button" parent="bindings/soft_drop" index="0"]
|
||||||
|
|
||||||
anchor_left = 0.0
|
|
||||||
anchor_top = 0.0
|
|
||||||
anchor_right = 0.0
|
|
||||||
anchor_bottom = 0.0
|
|
||||||
margin_right = 66.0
|
|
||||||
margin_bottom = 32.0
|
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
|
||||||
rect_clip_content = false
|
|
||||||
mouse_filter = 2
|
|
||||||
mouse_default_cursor_shape = 0
|
|
||||||
size_flags_horizontal = 2
|
|
||||||
size_flags_vertical = 0
|
|
||||||
custom_fonts/font = SubResource( 2 )
|
|
||||||
custom_colors/font_color = Color( 0.752941, 0.921569, 0.988235, 1 )
|
|
||||||
text = "soft
|
|
||||||
drop"
|
|
||||||
valign = 1
|
|
||||||
percent_visible = 1.0
|
|
||||||
lines_skipped = 0
|
|
||||||
max_lines_visible = -1
|
|
||||||
|
|
||||||
[node name="Button" type="Button" parent="bindings/soft_drop" index="1"]
|
|
||||||
|
|
||||||
anchor_left = 0.0
|
anchor_left = 0.0
|
||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
anchor_bottom = 0.0
|
anchor_bottom = 0.0
|
||||||
margin_left = 80.0
|
margin_left = 80.0
|
||||||
margin_right = 155.0
|
margin_right = 174.0
|
||||||
margin_bottom = 37.0
|
margin_bottom = 37.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
@ -401,24 +309,32 @@ mouse_filter = 0
|
|||||||
mouse_default_cursor_shape = 0
|
mouse_default_cursor_shape = 0
|
||||||
size_flags_horizontal = 2
|
size_flags_horizontal = 2
|
||||||
size_flags_vertical = 2
|
size_flags_vertical = 2
|
||||||
custom_fonts/font = ExtResource( 4 )
|
custom_fonts/font = ExtResource( 3 )
|
||||||
toggle_mode = false
|
toggle_mode = false
|
||||||
enabled_focus_mode = 2
|
enabled_focus_mode = 2
|
||||||
shortcut = null
|
shortcut = null
|
||||||
group = null
|
group = null
|
||||||
|
text = "Press key"
|
||||||
flat = false
|
flat = false
|
||||||
align = 1
|
align = 1
|
||||||
|
|
||||||
|
[node name="arrowDown" type="Sprite" parent="bindings/soft_drop" index="1"]
|
||||||
|
|
||||||
|
position = Vector2( 30, 20 )
|
||||||
|
scale = Vector2( 0.8, 0.8 )
|
||||||
|
texture = ExtResource( 8 )
|
||||||
|
_sections_unfolded = [ "Transform" ]
|
||||||
|
|
||||||
[node name="hard_drop" type="Control" parent="bindings" index="5"]
|
[node name="hard_drop" type="Control" parent="bindings" index="5"]
|
||||||
|
|
||||||
anchor_left = 0.0
|
anchor_left = 0.0
|
||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
anchor_bottom = 0.0
|
anchor_bottom = 0.0
|
||||||
margin_left = 226.0
|
margin_left = 220.0
|
||||||
margin_top = 151.0
|
margin_top = 165.0
|
||||||
margin_right = 266.0
|
margin_right = 260.0
|
||||||
margin_bottom = 191.0
|
margin_bottom = 205.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
mouse_filter = 0
|
mouse_filter = 0
|
||||||
@ -426,32 +342,7 @@ mouse_default_cursor_shape = 0
|
|||||||
size_flags_horizontal = 2
|
size_flags_horizontal = 2
|
||||||
size_flags_vertical = 2
|
size_flags_vertical = 2
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="bindings/hard_drop" index="0"]
|
[node name="Button" type="Button" parent="bindings/hard_drop" index="0"]
|
||||||
|
|
||||||
anchor_left = 0.0
|
|
||||||
anchor_top = 0.0
|
|
||||||
anchor_right = 0.0
|
|
||||||
anchor_bottom = 0.0
|
|
||||||
margin_left = 5.0
|
|
||||||
margin_top = -1.0
|
|
||||||
margin_right = 75.0
|
|
||||||
margin_bottom = 31.0
|
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
|
||||||
rect_clip_content = false
|
|
||||||
mouse_filter = 2
|
|
||||||
mouse_default_cursor_shape = 0
|
|
||||||
size_flags_horizontal = 2
|
|
||||||
size_flags_vertical = 0
|
|
||||||
custom_fonts/font = SubResource( 2 )
|
|
||||||
custom_colors/font_color = Color( 0.752941, 0.921569, 0.988235, 1 )
|
|
||||||
text = "hard
|
|
||||||
drop"
|
|
||||||
valign = 1
|
|
||||||
percent_visible = 1.0
|
|
||||||
lines_skipped = 0
|
|
||||||
max_lines_visible = -1
|
|
||||||
|
|
||||||
[node name="Button" type="Button" parent="bindings/hard_drop" index="1"]
|
|
||||||
|
|
||||||
anchor_left = 0.0
|
anchor_left = 0.0
|
||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
@ -459,7 +350,7 @@ anchor_right = 0.0
|
|||||||
anchor_bottom = 0.0
|
anchor_bottom = 0.0
|
||||||
margin_left = 84.0
|
margin_left = 84.0
|
||||||
margin_top = -1.0
|
margin_top = -1.0
|
||||||
margin_right = 159.0
|
margin_right = 178.0
|
||||||
margin_bottom = 36.0
|
margin_bottom = 36.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
@ -468,24 +359,32 @@ mouse_filter = 0
|
|||||||
mouse_default_cursor_shape = 0
|
mouse_default_cursor_shape = 0
|
||||||
size_flags_horizontal = 2
|
size_flags_horizontal = 2
|
||||||
size_flags_vertical = 2
|
size_flags_vertical = 2
|
||||||
custom_fonts/font = ExtResource( 4 )
|
custom_fonts/font = ExtResource( 3 )
|
||||||
toggle_mode = false
|
toggle_mode = false
|
||||||
enabled_focus_mode = 2
|
enabled_focus_mode = 2
|
||||||
shortcut = null
|
shortcut = null
|
||||||
group = null
|
group = null
|
||||||
|
text = "Press key"
|
||||||
flat = false
|
flat = false
|
||||||
align = 1
|
align = 1
|
||||||
|
|
||||||
|
[node name="harddrop" type="Sprite" parent="bindings/hard_drop" index="1"]
|
||||||
|
|
||||||
|
position = Vector2( 34, 19 )
|
||||||
|
scale = Vector2( 0.75, 0.75 )
|
||||||
|
texture = ExtResource( 9 )
|
||||||
|
_sections_unfolded = [ "Transform", "Z Index" ]
|
||||||
|
|
||||||
[node name="hold" type="Control" parent="bindings" index="6"]
|
[node name="hold" type="Control" parent="bindings" index="6"]
|
||||||
|
|
||||||
anchor_left = 0.0
|
anchor_left = 0.0
|
||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
anchor_bottom = 0.0
|
anchor_bottom = 0.0
|
||||||
margin_left = 50.0
|
margin_left = 20.0
|
||||||
margin_top = 200.0
|
margin_top = 215.0
|
||||||
margin_right = 90.0
|
margin_right = 60.0
|
||||||
margin_bottom = 240.0
|
margin_bottom = 255.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
mouse_filter = 0
|
mouse_filter = 0
|
||||||
@ -493,36 +392,14 @@ mouse_default_cursor_shape = 0
|
|||||||
size_flags_horizontal = 2
|
size_flags_horizontal = 2
|
||||||
size_flags_vertical = 2
|
size_flags_vertical = 2
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="bindings/hold" index="0"]
|
[node name="Button" type="Button" parent="bindings/hold" index="0"]
|
||||||
|
|
||||||
anchor_left = 0.0
|
|
||||||
anchor_top = 0.0
|
|
||||||
anchor_right = 0.0
|
|
||||||
anchor_bottom = 0.0
|
|
||||||
margin_right = 55.0
|
|
||||||
margin_bottom = 40.0
|
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
|
||||||
rect_clip_content = false
|
|
||||||
mouse_filter = 2
|
|
||||||
mouse_default_cursor_shape = 0
|
|
||||||
size_flags_horizontal = 2
|
|
||||||
size_flags_vertical = 0
|
|
||||||
custom_fonts/font = SubResource( 2 )
|
|
||||||
custom_colors/font_color = Color( 0.752941, 0.921569, 0.988235, 1 )
|
|
||||||
text = "hold"
|
|
||||||
valign = 1
|
|
||||||
percent_visible = 1.0
|
|
||||||
lines_skipped = 0
|
|
||||||
max_lines_visible = -1
|
|
||||||
|
|
||||||
[node name="Button" type="Button" parent="bindings/hold" index="1"]
|
|
||||||
|
|
||||||
anchor_left = 0.0
|
anchor_left = 0.0
|
||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
anchor_bottom = 0.0
|
anchor_bottom = 0.0
|
||||||
margin_left = 80.0
|
margin_left = 80.0
|
||||||
margin_right = 155.0
|
margin_right = 174.0
|
||||||
margin_bottom = 37.0
|
margin_bottom = 37.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
@ -531,24 +408,31 @@ mouse_filter = 0
|
|||||||
mouse_default_cursor_shape = 0
|
mouse_default_cursor_shape = 0
|
||||||
size_flags_horizontal = 2
|
size_flags_horizontal = 2
|
||||||
size_flags_vertical = 2
|
size_flags_vertical = 2
|
||||||
custom_fonts/font = ExtResource( 4 )
|
custom_fonts/font = ExtResource( 3 )
|
||||||
toggle_mode = false
|
toggle_mode = false
|
||||||
enabled_focus_mode = 2
|
enabled_focus_mode = 2
|
||||||
shortcut = null
|
shortcut = null
|
||||||
group = null
|
group = null
|
||||||
|
text = "Press key"
|
||||||
flat = false
|
flat = false
|
||||||
align = 1
|
align = 1
|
||||||
|
|
||||||
|
[node name="hold" type="Sprite" parent="bindings/hold" index="1"]
|
||||||
|
|
||||||
|
position = Vector2( 30, 20 )
|
||||||
|
scale = Vector2( 0.8, 0.8 )
|
||||||
|
texture = ExtResource( 10 )
|
||||||
|
|
||||||
[node name="pause" type="Control" parent="bindings" index="7"]
|
[node name="pause" type="Control" parent="bindings" index="7"]
|
||||||
|
|
||||||
anchor_left = 0.0
|
anchor_left = 0.0
|
||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
anchor_bottom = 0.0
|
anchor_bottom = 0.0
|
||||||
margin_left = 226.0
|
margin_left = 220.0
|
||||||
margin_top = 201.0
|
margin_top = 215.0
|
||||||
margin_right = 266.0
|
margin_right = 260.0
|
||||||
margin_bottom = 241.0
|
margin_bottom = 255.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
mouse_filter = 0
|
mouse_filter = 0
|
||||||
@ -556,33 +440,7 @@ mouse_default_cursor_shape = 0
|
|||||||
size_flags_horizontal = 2
|
size_flags_horizontal = 2
|
||||||
size_flags_vertical = 2
|
size_flags_vertical = 2
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="bindings/pause" index="0"]
|
[node name="Button" type="Button" parent="bindings/pause" index="0"]
|
||||||
|
|
||||||
anchor_left = 0.0
|
|
||||||
anchor_top = 0.0
|
|
||||||
anchor_right = 0.0
|
|
||||||
anchor_bottom = 0.0
|
|
||||||
margin_left = 5.0
|
|
||||||
margin_top = 3.0
|
|
||||||
margin_right = 106.0
|
|
||||||
margin_bottom = 35.0
|
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
|
||||||
rect_clip_content = false
|
|
||||||
mouse_filter = 2
|
|
||||||
mouse_default_cursor_shape = 0
|
|
||||||
size_flags_horizontal = 2
|
|
||||||
size_flags_vertical = 0
|
|
||||||
custom_fonts/font = SubResource( 2 )
|
|
||||||
custom_colors/font_color = Color( 0.752941, 0.921569, 0.988235, 1 )
|
|
||||||
text = "pause
|
|
||||||
resume"
|
|
||||||
valign = 1
|
|
||||||
percent_visible = 1.0
|
|
||||||
lines_skipped = 0
|
|
||||||
max_lines_visible = -1
|
|
||||||
_sections_unfolded = [ "custom_fonts" ]
|
|
||||||
|
|
||||||
[node name="Button" type="Button" parent="bindings/pause" index="1"]
|
|
||||||
|
|
||||||
anchor_left = 0.0
|
anchor_left = 0.0
|
||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
@ -590,7 +448,7 @@ anchor_right = 0.0
|
|||||||
anchor_bottom = 0.0
|
anchor_bottom = 0.0
|
||||||
margin_left = 84.0
|
margin_left = 84.0
|
||||||
margin_top = -1.0
|
margin_top = -1.0
|
||||||
margin_right = 159.0
|
margin_right = 178.0
|
||||||
margin_bottom = 36.0
|
margin_bottom = 36.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
@ -599,12 +457,46 @@ mouse_filter = 0
|
|||||||
mouse_default_cursor_shape = 0
|
mouse_default_cursor_shape = 0
|
||||||
size_flags_horizontal = 2
|
size_flags_horizontal = 2
|
||||||
size_flags_vertical = 2
|
size_flags_vertical = 2
|
||||||
custom_fonts/font = ExtResource( 4 )
|
custom_fonts/font = ExtResource( 3 )
|
||||||
toggle_mode = false
|
toggle_mode = false
|
||||||
enabled_focus_mode = 2
|
enabled_focus_mode = 2
|
||||||
shortcut = null
|
shortcut = null
|
||||||
group = null
|
group = null
|
||||||
|
text = "Press key"
|
||||||
flat = false
|
flat = false
|
||||||
align = 1
|
align = 1
|
||||||
|
|
||||||
|
[node name="pause" type="Sprite" parent="bindings/pause" index="1"]
|
||||||
|
|
||||||
|
position = Vector2( 34, 19 )
|
||||||
|
scale = Vector2( 0.8, 0.8 )
|
||||||
|
texture = ExtResource( 11 )
|
||||||
|
_sections_unfolded = [ "Transform" ]
|
||||||
|
|
||||||
|
[node name="hint" type="Label" parent="." index="2"]
|
||||||
|
|
||||||
|
anchor_left = 0.0
|
||||||
|
anchor_top = 0.0
|
||||||
|
anchor_right = 0.0
|
||||||
|
anchor_bottom = 0.0
|
||||||
|
margin_left = -220.0
|
||||||
|
margin_top = -135.0
|
||||||
|
margin_right = 280.0
|
||||||
|
margin_bottom = -84.0
|
||||||
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
|
rect_clip_content = false
|
||||||
|
mouse_filter = 2
|
||||||
|
mouse_default_cursor_shape = 0
|
||||||
|
size_flags_horizontal = 1
|
||||||
|
size_flags_vertical = 4
|
||||||
|
custom_fonts/font = ExtResource( 3 )
|
||||||
|
text = "Press [pause key] to resume
|
||||||
|
or click on a button to change key assignment"
|
||||||
|
align = 1
|
||||||
|
valign = 1
|
||||||
|
percent_visible = 1.0
|
||||||
|
lines_skipped = 0
|
||||||
|
max_lines_visible = -1
|
||||||
|
_sections_unfolded = [ "custom_fonts" ]
|
||||||
|
|
||||||
|
|
Before Width: | Height: | Size: 208 B After Width: | Height: | Size: 208 B |
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 384 B After Width: | Height: | Size: 384 B |
Before Width: | Height: | Size: 418 B After Width: | Height: | Size: 418 B |
BIN
source/icons/arrowDown.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
source/icons/arrowLeft.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
source/icons/arrowRight.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
source/icons/clockwise.png
Normal file
After Width: | Height: | Size: 665 B |
BIN
source/icons/counterclockwise.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
source/icons/harddrop.png
Normal file
After Width: | Height: | Size: 503 B |
BIN
source/icons/hold.png
Normal file
After Width: | Height: | Size: 602 B |
Before Width: | Height: | Size: 211 KiB After Width: | Height: | Size: 211 KiB |
BIN
source/icons/pause.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
source/midi/Korobeiniki.mid
Normal file
@ -197,7 +197,7 @@ func seek( to_position ):
|
|||||||
var length = len(self.track_status.events)
|
var length = len(self.track_status.events)
|
||||||
while pointer < length:
|
while pointer < length:
|
||||||
var event_chunk = self.track_status.events[pointer]
|
var event_chunk = self.track_status.events[pointer]
|
||||||
if self.position < event_chunk.time:
|
if self.position <= event_chunk.time:
|
||||||
break
|
break
|
||||||
pointer += 1
|
pointer += 1
|
||||||
self.track_status.event_pointer = pointer
|
self.track_status.event_pointer = pointer
|
BIN
source/midi/TimGM6mb.sf2
Normal file
@ -12,14 +12,14 @@ config_version=3
|
|||||||
|
|
||||||
config/name="TETRIS 3000"
|
config/name="TETRIS 3000"
|
||||||
run/main_scene="res://Main.tscn"
|
run/main_scene="res://Main.tscn"
|
||||||
boot_splash/image="res://icons/splash.png"
|
boot_splash/image="res://splash.png"
|
||||||
config/icon="res://icons/48.png"
|
config/icon="res://icons/48.png"
|
||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
|
||||||
window/size/width=500
|
window/size/width=640
|
||||||
window/size/height=500
|
window/size/height=480
|
||||||
window/stretch/mode="2d"
|
window/vsync/use_vsync=false
|
||||||
window/stretch/aspect="expand"
|
window/stretch/aspect="expand"
|
||||||
|
|
||||||
[gui]
|
[gui]
|
||||||
@ -44,7 +44,10 @@ rotate_clockwise=[ Object(InputEventKey,"resource_local_to_scene":false,"resourc
|
|||||||
]
|
]
|
||||||
rotate_counterclockwise=[ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777238,"unicode":0,"echo":false,"script":null)
|
rotate_counterclockwise=[ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777238,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
|
toggle_fullscreen=[ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":true,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777221,"unicode":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
|
||||||
[rendering]
|
[rendering]
|
||||||
|
|
||||||
threads/thread_model=2
|
environment/default_clear_color=Color( 0, 0, 0, 1 )
|
||||||
|
quality/main_loop_type=""
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
BIN
starmap_g8k.jpg
Before Width: | Height: | Size: 6.7 MiB |
@ -1,29 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="StreamTexture"
|
|
||||||
path="res://.import/starmap_g8k.jpg-617060714ab9f6908ea55c401bab327a.stex"
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://starmap_g8k.jpg"
|
|
||||||
dest_files=[ "res://.import/starmap_g8k.jpg-617060714ab9f6908ea55c401bab327a.stex" ]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/hdr_mode=0
|
|
||||||
compress/normal_map=0
|
|
||||||
flags/repeat=0
|
|
||||||
flags/filter=true
|
|
||||||
flags/mipmaps=false
|
|
||||||
flags/anisotropic=false
|
|
||||||
flags/srgb=2
|
|
||||||
process/fix_alpha_border=true
|
|
||||||
process/premult_alpha=false
|
|
||||||
process/HDR_as_SRGB=false
|
|
||||||
stream=false
|
|
||||||
size_limit=0
|
|
||||||
detect_3d=true
|
|
||||||
svg/scale=1.0
|
|
BIN
web/TETRIS3000.pck
Normal file
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
BIN
web/favicon.ico
Normal file
After Width: | Height: | Size: 208 B |
BIN
web/screenshot.png
Normal file
After Width: | Height: | Size: 398 KiB |