Compare commits
33 Commits
Author | SHA1 | Date | |
---|---|---|---|
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 |
@ -1,2 +1 @@
|
|||||||
theme: jekyll-theme-slate
|
theme: jekyll-theme-slate
|
||||||
show_downloads: true
|
|
||||||
|
@ -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" ]
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,57 +6,65 @@ const ExplodingLine = preload("res://ExplodingLine.tscn")
|
|||||||
const EMPTY_CELL = -1
|
const EMPTY_CELL = -1
|
||||||
const MINO = 0
|
const MINO = 0
|
||||||
|
|
||||||
export (int) var NB_LINES = 20
|
|
||||||
export (int) var NB_COLLUMNS = 10
|
|
||||||
|
|
||||||
var exploding_lines = []
|
var exploding_lines = []
|
||||||
|
var nb_collumns
|
||||||
|
var nb_lines
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
for y in range(NB_LINES):
|
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())
|
exploding_lines.append(ExplodingLine.instance())
|
||||||
add_child(exploding_lines[y])
|
add_child(exploding_lines[y])
|
||||||
exploding_lines[y].translation = Vector3(NB_COLLUMNS/2, y, 1)
|
exploding_lines[y].translation = Vector3(nb_collumns/2, y, 1)
|
||||||
|
|
||||||
func clear():
|
func clear():
|
||||||
for position in get_used_cells():
|
for used_cell in get_used_cells():
|
||||||
set_cell_item(position.x, position.y, position.z, EMPTY_CELL)
|
set_cell_item(used_cell.x, used_cell.y, used_cell.z, EMPTY_CELL)
|
||||||
|
|
||||||
func is_free_cell(position):
|
func is_free_cell(cell):
|
||||||
return (
|
return (
|
||||||
0 <= position.x and position.x < NB_COLLUMNS
|
0 <= cell.x and cell.x < nb_collumns
|
||||||
and position.y >= 0
|
and cell.y >= 0
|
||||||
and get_cell_item(position.x, position.y, 0) == GridMap.INVALID_CELL_ITEM
|
and get_cell_item(cell.x, cell.y, cell.z) == INVALID_CELL_ITEM
|
||||||
)
|
)
|
||||||
|
|
||||||
func possible_positions(initial_positions, movement):
|
func possible_positions(initial_translations, movement):
|
||||||
var position
|
var position
|
||||||
var test_positions = []
|
var test_translations = []
|
||||||
for i in range(4):
|
for i in range(4):
|
||||||
position = initial_positions[i] + movement
|
position = initial_translations[i] + movement
|
||||||
if is_free_cell(position):
|
if is_free_cell(position):
|
||||||
test_positions.append(position)
|
test_translations.append(position)
|
||||||
if test_positions.size() == Tetromino.NB_MINOES:
|
else:
|
||||||
return test_positions
|
break
|
||||||
|
if test_translations.size() == Tetromino.NB_MINOES:
|
||||||
|
return test_translations
|
||||||
else:
|
else:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
func lock(piece):
|
func lock(piece):
|
||||||
for position in piece.positions():
|
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)
|
set_cell_item(position.x, position.y, 0, MINO)
|
||||||
|
return minoes_over_grid < Tetromino.NB_MINOES
|
||||||
|
|
||||||
func clear_lines():
|
func clear_lines():
|
||||||
var line_cleared
|
var line_cleared
|
||||||
var lines_cleared = 0
|
var lines_cleared = 0
|
||||||
for y in range(NB_LINES-1, -1, -1):
|
for y in range(nb_lines-1, -1, -1):
|
||||||
line_cleared = true
|
line_cleared = true
|
||||||
for x in range(NB_COLLUMNS):
|
for x in range(nb_collumns):
|
||||||
if not get_cell_item(x, y, 0) == MINO:
|
if not get_cell_item(x, y, 0) == MINO:
|
||||||
line_cleared = false
|
line_cleared = false
|
||||||
break
|
break
|
||||||
if line_cleared:
|
if line_cleared:
|
||||||
for y2 in range(y, NB_LINES+2):
|
for y2 in range(y, nb_lines+2):
|
||||||
for x in range(NB_COLLUMNS):
|
for x in range(nb_collumns):
|
||||||
set_cell_item(x, y2, 0, get_cell_item(x, y2+1, 0))
|
set_cell_item(x, y2, 0, get_cell_item(x, y2+1, 0))
|
||||||
lines_cleared += 1
|
lines_cleared += 1
|
||||||
|
exploding_lines[y].emitting = true
|
||||||
exploding_lines[y].restart()
|
exploding_lines[y].restart()
|
||||||
return lines_cleared
|
return lines_cleared
|
216
source/Main.gd
216
source/Main.gd
@ -9,11 +9,7 @@ const TetroS = preload("res://Tetrominos/TetroS.tscn")
|
|||||||
const TetroT = preload("res://Tetrominos/TetroT.tscn")
|
const TetroT = preload("res://Tetrominos/TetroT.tscn")
|
||||||
const TetroZ = preload("res://Tetrominos/TetroZ.tscn")
|
const TetroZ = preload("res://Tetrominos/TetroZ.tscn")
|
||||||
|
|
||||||
const password = "TETRIS 3000"
|
const THERE = Vector3(0, 0, 0)
|
||||||
|
|
||||||
const NEXT_POSITION = Vector3(13, 16, 0)
|
|
||||||
const START_POSITION = Vector3(5, 20, 0)
|
|
||||||
const HOLD_POSITION = Vector3(-5, 16, 0)
|
|
||||||
|
|
||||||
const movements = {
|
const movements = {
|
||||||
"move_right": Vector3(1, 0, 0),
|
"move_right": Vector3(1, 0, 0),
|
||||||
@ -27,55 +23,30 @@ var next_piece
|
|||||||
var current_piece
|
var current_piece
|
||||||
var held_piece
|
var held_piece
|
||||||
var current_piece_held
|
var current_piece_held
|
||||||
|
var autoshift_action
|
||||||
var autoshift_action = ""
|
|
||||||
|
|
||||||
var playing = false
|
var playing = false
|
||||||
|
|
||||||
signal piece_dropped(score)
|
func new_game(level):
|
||||||
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
|
|
||||||
current_piece_held = false
|
|
||||||
next_piece = random_piece()
|
|
||||||
new_piece()
|
|
||||||
$MidiPlayer.position = 0
|
|
||||||
$Start.visible = false
|
$Start.visible = false
|
||||||
|
$Matrix/GridMap.clear()
|
||||||
|
next_piece = random_piece()
|
||||||
|
autoshift_action = ""
|
||||||
|
$MidiPlayer.position = 0
|
||||||
$Stats.new_game(level)
|
$Stats.new_game(level)
|
||||||
|
new_piece()
|
||||||
resume()
|
resume()
|
||||||
|
|
||||||
func new_piece():
|
func new_piece():
|
||||||
if current_piece:
|
|
||||||
remove_child(current_piece)
|
|
||||||
current_piece = next_piece
|
current_piece = next_piece
|
||||||
current_piece.translation = START_POSITION
|
current_piece.translation = $Matrix/Position3D.translation
|
||||||
current_piece.emit_trail(true)
|
current_piece.emit_trail(true)
|
||||||
autoshift_action = ""
|
|
||||||
next_piece = random_piece()
|
next_piece = random_piece()
|
||||||
next_piece.translation = NEXT_POSITION
|
next_piece.translation = $Next/Position3D.translation
|
||||||
if move(movements["soft_drop"]):
|
if current_piece.move(THERE):
|
||||||
$DropTimer.start()
|
$DropTimer.start()
|
||||||
$LockDelay.start()
|
|
||||||
current_piece_held = false
|
current_piece_held = false
|
||||||
else:
|
else:
|
||||||
current_piece.translate(movements["soft_drop"])
|
|
||||||
game_over()
|
game_over()
|
||||||
|
|
||||||
func random_piece():
|
func random_piece():
|
||||||
@ -90,88 +61,86 @@ func random_piece():
|
|||||||
add_child(piece)
|
add_child(piece)
|
||||||
return piece
|
return piece
|
||||||
|
|
||||||
func _on_Stats_level_up():
|
func new_level(level):
|
||||||
$DropTimer.wait_time = pow(0.8 - (($Stats.level - 1) * 0.007), $Stats.level - 1)
|
if level <= 15:
|
||||||
if $Stats.level > 15:
|
$DropTimer.wait_time = pow(0.8 - ((level - 1) * 0.007), level - 1)
|
||||||
$LockDelay.wait_time = 0.5 * pow(0.9, $Stats.level-15)
|
else:
|
||||||
|
$DropTimer.wait_time = 0.01
|
||||||
|
$LockDelay.wait_time = 0.5 * pow(0.9, level-15)
|
||||||
|
|
||||||
func _process(delta):
|
func _unhandled_input(event):
|
||||||
if Input.is_action_just_pressed("pause"):
|
if event.is_action_pressed("pause"):
|
||||||
if playing:
|
if playing:
|
||||||
pause()
|
pause($controls_ui)
|
||||||
$controls_ui.visible = true
|
|
||||||
elif $controls_ui.enable_resume:
|
elif $controls_ui.enable_resume:
|
||||||
resume()
|
resume()
|
||||||
if Input.is_action_just_pressed("toggle_fullscreen"):
|
if event.is_action_pressed("toggle_fullscreen"):
|
||||||
OS.window_fullscreen = !OS.window_fullscreen
|
OS.window_fullscreen = not OS.window_fullscreen
|
||||||
if playing:
|
if playing:
|
||||||
for action in movements:
|
if autoshift_action and event.is_action_released(autoshift_action):
|
||||||
if action == autoshift_action:
|
$AutoShiftDelay.stop()
|
||||||
if not Input.is_action_pressed(action):
|
$AutoShiftTimer.stop()
|
||||||
$AutoShiftDelay.stop()
|
autoshift_action = ""
|
||||||
$AutoShiftTimer.stop()
|
for action in movements:
|
||||||
autoshift_action = ""
|
|
||||||
else:
|
|
||||||
if Input.is_action_pressed(action):
|
if Input.is_action_pressed(action):
|
||||||
autoshift_action = action
|
autoshift_action = action
|
||||||
process_autoshift_action()
|
process_autoshift()
|
||||||
$AutoShiftTimer.stop()
|
|
||||||
$AutoShiftDelay.start()
|
$AutoShiftDelay.start()
|
||||||
if Input.is_action_just_pressed("hard_drop"):
|
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()
|
hard_drop()
|
||||||
if Input.is_action_just_pressed("rotate_clockwise"):
|
if event.is_action_pressed("rotate_clockwise"):
|
||||||
rotate(Tetromino.CLOCKWISE)
|
current_piece.rotate(Tetromino.CLOCKWISE)
|
||||||
if Input.is_action_just_pressed("rotate_counterclockwise"):
|
if event.is_action_pressed("rotate_counterclockwise"):
|
||||||
rotate(Tetromino.COUNTERCLOCKWISE)
|
current_piece.rotate(Tetromino.COUNTERCLOCKWISE)
|
||||||
if Input.is_action_just_pressed("hold"):
|
if event.is_action_pressed("hold"):
|
||||||
hold()
|
hold()
|
||||||
|
|
||||||
func _on_AutoShiftDelay_timeout():
|
func _on_AutoShiftDelay_timeout():
|
||||||
if playing and autoshift_action:
|
if autoshift_action:
|
||||||
process_autoshift_action()
|
process_autoshift()
|
||||||
$AutoShiftTimer.start()
|
$AutoShiftTimer.start()
|
||||||
|
|
||||||
func _on_AutoShiftTimer_timeout():
|
func _on_AutoShiftTimer_timeout():
|
||||||
if playing and autoshift_action:
|
if autoshift_action:
|
||||||
process_autoshift_action()
|
process_autoshift()
|
||||||
|
|
||||||
func process_autoshift_action():
|
func process_autoshift():
|
||||||
if move(movements[autoshift_action]):
|
var moved = current_piece.move(movements[autoshift_action])
|
||||||
if autoshift_action == "soft_drop":
|
if moved and (autoshift_action == "soft_drop"):
|
||||||
emit_signal("piece_dropped", 1)
|
$Stats.piece_dropped(1)
|
||||||
|
|
||||||
func hard_drop():
|
func hard_drop():
|
||||||
var score = 0
|
var score = 0
|
||||||
while move(movements["soft_drop"]):
|
while current_piece.move(movements["soft_drop"]):
|
||||||
score += 2
|
score += 2
|
||||||
emit_signal("piece_dropped", score)
|
$Stats.piece_dropped(score)
|
||||||
|
$LockDelay.stop()
|
||||||
lock()
|
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():
|
func _on_DropTimer_timeout():
|
||||||
move(movements["soft_drop"])
|
if not current_piece.move(movements["soft_drop"]):
|
||||||
|
if $LockDelay.is_stopped():
|
||||||
func _on_LockDelay_timeout():
|
lock()
|
||||||
if not move(movements["soft_drop"]):
|
|
||||||
lock()
|
|
||||||
|
|
||||||
func lock():
|
func lock():
|
||||||
$GridMap.lock(current_piece)
|
if $Matrix/GridMap.lock(current_piece):
|
||||||
emit_signal("piece_locked", $GridMap.clear_lines(), current_piece.t_spin)
|
var lines_cleared = $Matrix/GridMap.clear_lines()
|
||||||
new_piece()
|
$Stats.piece_locked(lines_cleared, current_piece.t_spin)
|
||||||
|
if lines_cleared or current_piece.t_spin:
|
||||||
|
$MidiPlayer.piece_locked(lines_cleared)
|
||||||
|
remove_child(current_piece)
|
||||||
|
new_piece()
|
||||||
|
else:
|
||||||
|
game_over()
|
||||||
|
|
||||||
func hold():
|
func hold():
|
||||||
if not current_piece_held:
|
if not current_piece_held:
|
||||||
@ -180,9 +149,9 @@ func hold():
|
|||||||
current_piece = held_piece
|
current_piece = held_piece
|
||||||
held_piece = swap
|
held_piece = swap
|
||||||
held_piece.emit_trail(false)
|
held_piece.emit_trail(false)
|
||||||
held_piece.translation = HOLD_POSITION
|
held_piece.translation = $Hold/Position3D.translation
|
||||||
if current_piece:
|
if current_piece:
|
||||||
current_piece.translation = START_POSITION
|
current_piece.translation = $Matrix/Position3D.translation
|
||||||
current_piece.emit_trail(true)
|
current_piece.emit_trail(true)
|
||||||
else:
|
else:
|
||||||
new_piece()
|
new_piece()
|
||||||
@ -196,50 +165,53 @@ func resume():
|
|||||||
$MidiPlayer.resume()
|
$MidiPlayer.resume()
|
||||||
$controls_ui.visible = false
|
$controls_ui.visible = false
|
||||||
$Stats.visible = true
|
$Stats.visible = true
|
||||||
$GridMap.visible = true
|
$Matrix.visible = true
|
||||||
$Backs.visible = true
|
$Matrix/GridMap.visible = true
|
||||||
|
$Hold.visible = true
|
||||||
|
$Next.visible = true
|
||||||
current_piece.visible = true
|
current_piece.visible = true
|
||||||
if held_piece:
|
if held_piece:
|
||||||
held_piece.visible = true
|
held_piece.visible = true
|
||||||
next_piece.visible = true
|
next_piece.visible = true
|
||||||
|
|
||||||
func pause(hide=true):
|
func pause(gui=null):
|
||||||
playing = false
|
playing = false
|
||||||
|
$MidiPlayer.stop()
|
||||||
|
$DropTimer.stop()
|
||||||
|
$LockDelay.stop()
|
||||||
|
$AutoShiftDelay.stop()
|
||||||
|
$AutoShiftTimer.stop()
|
||||||
|
$Stats/Clock.stop()
|
||||||
$Stats.time = OS.get_system_time_secs() - $Stats.time
|
$Stats.time = OS.get_system_time_secs() - $Stats.time
|
||||||
if hide:
|
if gui:
|
||||||
|
gui.visible = true
|
||||||
$Stats.visible = false
|
$Stats.visible = false
|
||||||
$GridMap.visible = false
|
$Matrix.visible = false
|
||||||
$Backs.visible = false
|
$Matrix/GridMap.visible = false
|
||||||
|
$Hold.visible = false
|
||||||
|
$Next.visible = false
|
||||||
current_piece.visible = false
|
current_piece.visible = false
|
||||||
if held_piece:
|
if held_piece:
|
||||||
held_piece.visible = false
|
held_piece.visible = false
|
||||||
next_piece.visible = false
|
next_piece.visible = false
|
||||||
$MidiPlayer.stop()
|
|
||||||
$DropTimer.stop()
|
|
||||||
$LockDelay.stop()
|
|
||||||
$Stats/Clock.stop()
|
|
||||||
|
|
||||||
func game_over():
|
func game_over():
|
||||||
|
pause()
|
||||||
|
current_piece.emit_trail(false)
|
||||||
$FlashText.print("GAME\nOVER")
|
$FlashText.print("GAME\nOVER")
|
||||||
pause(false)
|
|
||||||
$ReplayButton.visible = true
|
$ReplayButton.visible = true
|
||||||
|
|
||||||
func _on_ReplayButton_pressed():
|
func _on_ReplayButton_pressed():
|
||||||
pause()
|
|
||||||
$ReplayButton.visible = false
|
$ReplayButton.visible = false
|
||||||
$Start.visible = true
|
pause($Start)
|
||||||
|
remove_child(next_piece)
|
||||||
|
remove_child(current_piece)
|
||||||
|
if held_piece:
|
||||||
|
remove_child(held_piece)
|
||||||
|
held_piece = null
|
||||||
|
|
||||||
func _notification(what):
|
func _notification(what):
|
||||||
match what:
|
match what:
|
||||||
MainLoop.NOTIFICATION_WM_FOCUS_OUT:
|
MainLoop.NOTIFICATION_WM_FOCUS_OUT:
|
||||||
if playing:
|
if playing:
|
||||||
pause()
|
pause($controls_ui)
|
||||||
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()
|
|
||||||
|
148
source/Main.tscn
148
source/Main.tscn
@ -1,7 +1,7 @@
|
|||||||
[gd_scene load_steps=21 format=2]
|
[gd_scene load_steps=21 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://Main.gd" type="Script" id=1]
|
[ext_resource path="res://Main.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://night-sky-background-14391263141jp.jpg" type="Texture" 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,8 +10,8 @@
|
|||||||
[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]
|
||||||
|
|
||||||
@ -226,7 +226,7 @@ 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"]
|
||||||
@ -234,9 +234,9 @@ _sections_unfolded = [ "Extra Spacing", "Font", "Settings" ]
|
|||||||
environment = SubResource( 2 )
|
environment = SubResource( 2 )
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
[node name="Sprite3D" type="Sprite3D" parent="." index="0"]
|
[node name="Background" type="Sprite3D" parent="." index="0"]
|
||||||
|
|
||||||
transform = Transform( 19.2, 0, 0, 0, 12.8, 0, 0, 0, 1, 5, 10, -80 )
|
transform = Transform( 12.8, 0, 0, 0, 8.53, 0, 0, 0, 1, 5, 10, -32 )
|
||||||
layers = 1
|
layers = 1
|
||||||
material_override = null
|
material_override = null
|
||||||
cast_shadow = 1
|
cast_shadow = 1
|
||||||
@ -250,12 +250,12 @@ centered = true
|
|||||||
offset = Vector2( 0, 0 )
|
offset = Vector2( 0, 0 )
|
||||||
flip_h = false
|
flip_h = false
|
||||||
flip_v = false
|
flip_v = false
|
||||||
modulate = Color( 0.478431, 0.478431, 0.478431, 1 )
|
modulate = Color( 0.334808, 0.343253, 0.359375, 0 )
|
||||||
opacity = 0.0
|
opacity = 1.0
|
||||||
pixel_size = 0.01
|
pixel_size = 0.01
|
||||||
axis = 2
|
axis = 2
|
||||||
transparent = false
|
transparent = false
|
||||||
shaded = false
|
shaded = true
|
||||||
double_sided = false
|
double_sided = false
|
||||||
alpha_cut = 0
|
alpha_cut = 0
|
||||||
texture = ExtResource( 2 )
|
texture = ExtResource( 2 )
|
||||||
@ -264,7 +264,7 @@ hframes = 1
|
|||||||
frame = 0
|
frame = 0
|
||||||
region_enabled = false
|
region_enabled = false
|
||||||
region_rect = Rect2( 0, 0, 0, 0 )
|
region_rect = Rect2( 0, 0, 0, 0 )
|
||||||
_sections_unfolded = [ "Animation", "Flags", "Transform" ]
|
_sections_unfolded = [ "Animation", "Flags", "Geometry", "Transform" ]
|
||||||
|
|
||||||
[node name="Camera" type="Camera" parent="." index="1"]
|
[node name="Camera" type="Camera" parent="." index="1"]
|
||||||
|
|
||||||
@ -279,13 +279,13 @@ projection = 0
|
|||||||
current = true
|
current = true
|
||||||
fov = 70.0
|
fov = 70.0
|
||||||
size = 1.0
|
size = 1.0
|
||||||
near = 0.1
|
near = 0.05
|
||||||
far = 1.29056e+006
|
far = 500.0
|
||||||
_sections_unfolded = [ "Transform" ]
|
_sections_unfolded = [ "Transform" ]
|
||||||
|
|
||||||
[node name="DirectionalLight" type="DirectionalLight" parent="." index="2"]
|
[node name="DirectionalLight" type="DirectionalLight" parent="." index="2"]
|
||||||
|
|
||||||
transform = Transform( 0.332668, 0.771982, -0.541642, 0.579657, 0.285656, 0.763151, 0.743861, -0.567843, -0.352456, 5, 30, 0 )
|
transform = Transform( -0.241094, 0.489231, -0.838169, 0.896995, 0.442041, 0, 0.370504, -0.751834, -0.545411, 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
|
||||||
@ -311,8 +311,27 @@ 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="3"]
|
[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" ]
|
||||||
|
|
||||||
|
[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 )
|
||||||
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
|
||||||
@ -331,34 +350,16 @@ __meta__ = {
|
|||||||
"_editor_clip_": 1,
|
"_editor_clip_": 1,
|
||||||
"_editor_floor_": Vector3( 0, -1, 0 )
|
"_editor_floor_": Vector3( 0, -1, 0 )
|
||||||
}
|
}
|
||||||
NB_LINES = 20
|
|
||||||
NB_COLLUMNS = 10
|
|
||||||
|
|
||||||
[node name="Backs" type="Spatial" parent="." index="4"]
|
[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
|
||||||
@ -373,9 +374,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
|
||||||
@ -390,40 +397,45 @@ skeleton = NodePath("..")
|
|||||||
material/0 = null
|
material/0 = null
|
||||||
_sections_unfolded = [ "Transform" ]
|
_sections_unfolded = [ "Transform" ]
|
||||||
|
|
||||||
[node name="DropTimer" type="Timer" parent="." index="5"]
|
[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="6"]
|
[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="7"]
|
[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="8"]
|
[node name="AutoShiftTimer" type="Timer" parent="." index="9"]
|
||||||
|
|
||||||
process_mode = 1
|
process_mode = 1
|
||||||
wait_time = 0.03
|
wait_time = 0.02
|
||||||
one_shot = false
|
one_shot = false
|
||||||
autostart = false
|
autostart = false
|
||||||
|
|
||||||
[node name="MidiPlayer" parent="." index="9" instance=ExtResource( 5 )]
|
[node name="MidiPlayer" parent="." index="10" instance=ExtResource( 5 )]
|
||||||
|
|
||||||
editor/display_folded = true
|
editor/display_folded = true
|
||||||
script = ExtResource( 6 )
|
script = ExtResource( 6 )
|
||||||
file = "res://midi/Tetris - Song A.mid"
|
file = "res://midi/Tetris - Song A.mid"
|
||||||
volume_db = -12
|
volume_db = -24
|
||||||
loop = true
|
loop = true
|
||||||
loop_start = 1.81
|
loop_start = 1.81
|
||||||
soundfont = "res://midi/TimGM6mb.sf2"
|
soundfont = "res://midi/TimGM6mb.sf2"
|
||||||
@ -435,7 +447,7 @@ wait_time = 1.41
|
|||||||
one_shot = true
|
one_shot = true
|
||||||
autostart = false
|
autostart = false
|
||||||
|
|
||||||
[node name="FlashText" type="Control" parent="." index="10"]
|
[node name="FlashText" type="Control" parent="." index="11"]
|
||||||
|
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
anchor_top = 0.5
|
anchor_top = 0.5
|
||||||
@ -489,25 +501,35 @@ anims/Flash = SubResource( 7 )
|
|||||||
blend_times = [ ]
|
blend_times = [ ]
|
||||||
_sections_unfolded = [ "Playback Options" ]
|
_sections_unfolded = [ "Playback Options" ]
|
||||||
|
|
||||||
[node name="Stats" parent="." index="11" 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 = 20.0
|
||||||
|
margin_top = -260.0
|
||||||
|
margin_right = 130.0
|
||||||
|
margin_bottom = -50.0
|
||||||
|
|
||||||
|
[node name="controls_ui" parent="." index="13" instance=ExtResource( 10 )]
|
||||||
|
|
||||||
visible = false
|
visible = false
|
||||||
|
|
||||||
[node name="controls_ui" parent="." index="12" 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="13"]
|
|
||||||
|
|
||||||
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 = -335.0
|
||||||
margin_top = -60.0
|
margin_top = -55.0
|
||||||
margin_right = -27.0
|
margin_right = -165.0
|
||||||
margin_bottom = -26.0
|
margin_bottom = -15.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
|
||||||
@ -526,18 +548,8 @@ 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="14" instance=ExtResource( 12 )]
|
|
||||||
|
|
||||||
[connection signal="piece_dropped" from="." to="Stats" method="_on_Main_piece_dropped"]
|
|
||||||
|
|
||||||
[connection signal="piece_locked" from="." to="MidiPlayer" method="_on_Main_piece_locked"]
|
|
||||||
|
|
||||||
[connection signal="piece_locked" from="." to="Stats" 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"]
|
||||||
@ -548,10 +560,10 @@ _sections_unfolded = [ "Margin", "custom_colors", "custom_fonts" ]
|
|||||||
|
|
||||||
[connection signal="flash_text" from="Stats" to="FlashText" method="print"]
|
[connection signal="flash_text" from="Stats" to="FlashText" method="print"]
|
||||||
|
|
||||||
[connection signal="level_up" from="Stats" to="." method="_on_Stats_level_up"]
|
[connection signal="level_up" from="Stats" to="." method="new_level"]
|
||||||
|
|
||||||
|
[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"]
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ const LINE_CLEAR_CHANNELS = [2, 6]
|
|||||||
var muted_events = []
|
var muted_events = []
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
|
._ready()
|
||||||
mute_channels(LINE_CLEAR_CHANNELS)
|
mute_channels(LINE_CLEAR_CHANNELS)
|
||||||
|
|
||||||
func _init_channel( ):
|
func _init_channel( ):
|
||||||
@ -36,18 +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 _on_Main_piece_locked(lines, t_spin):
|
func piece_locked(lines):
|
||||||
if lines or t_spin:
|
if lines == Tetromino.NB_MINOES:
|
||||||
if lines == Tetromino.NB_MINOES:
|
for channel in LINE_CLEAR_CHANNELS:
|
||||||
for channel in LINE_CLEAR_CHANNELS:
|
channel_status[channel].vomume = 127
|
||||||
channel_status[channel].vomume = 127
|
$LineCLearTimer.wait_time = 0.86
|
||||||
$LineCLearTimer.wait_time = 0.86
|
else:
|
||||||
else:
|
for channel in LINE_CLEAR_CHANNELS:
|
||||||
for channel in LINE_CLEAR_CHANNELS:
|
channel_status[channel].vomume = 100
|
||||||
channel_status[channel].vomume = 100
|
$LineCLearTimer.wait_time = 0.43
|
||||||
$LineCLearTimer.wait_time = 0.43
|
unmute_channels(LINE_CLEAR_CHANNELS)
|
||||||
unmute_channels(LINE_CLEAR_CHANNELS)
|
$LineCLearTimer.start()
|
||||||
$LineCLearTimer.start()
|
|
||||||
|
|
||||||
func _on_LineCLearTimer_timeout():
|
func _on_LineCLearTimer_timeout():
|
||||||
mute_channels(LINE_CLEAR_CHANNELS)
|
mute_channels(LINE_CLEAR_CHANNELS)
|
@ -9,6 +9,7 @@ const SCORES = [
|
|||||||
]
|
]
|
||||||
const LINES_CLEARED_NAMES = ["", "SINGLE", "DOUBLE", "TRIPLE", "TETRIS"]
|
const LINES_CLEARED_NAMES = ["", "SINGLE", "DOUBLE", "TRIPLE", "TETRIS"]
|
||||||
const T_SPIN_NAMES = ["", "T-SPIN", "MINI T-SPIN"]
|
const T_SPIN_NAMES = ["", "T-SPIN", "MINI T-SPIN"]
|
||||||
|
const password = "TETRIS 3000"
|
||||||
|
|
||||||
var level
|
var level
|
||||||
var goal
|
var goal
|
||||||
@ -18,7 +19,20 @@ var time
|
|||||||
var combos
|
var combos
|
||||||
|
|
||||||
signal flash_text(text)
|
signal flash_text(text)
|
||||||
signal level_up
|
signal level_up(level)
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
load_user_data()
|
||||||
|
|
||||||
|
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):
|
func new_game(start_level):
|
||||||
level = start_level - 1
|
level = start_level - 1
|
||||||
@ -36,7 +50,7 @@ func new_level():
|
|||||||
$VBC/Level.text = str(level)
|
$VBC/Level.text = str(level)
|
||||||
$VBC/Goal.text = str(goal)
|
$VBC/Goal.text = str(goal)
|
||||||
emit_signal("flash_text", "Level\n%d"%level)
|
emit_signal("flash_text", "Level\n%d"%level)
|
||||||
emit_signal("level_up")
|
emit_signal("level_up", level)
|
||||||
|
|
||||||
func _on_Clock_timeout():
|
func _on_Clock_timeout():
|
||||||
show_time()
|
show_time()
|
||||||
@ -48,28 +62,28 @@ func show_time():
|
|||||||
var hours = int(time_elapsed/3600)
|
var hours = int(time_elapsed/3600)
|
||||||
$VBC/Time.text = str(hours) + ":%02d"%minutes + ":%02d"%seconds
|
$VBC/Time.text = str(hours) + ":%02d"%minutes + ":%02d"%seconds
|
||||||
|
|
||||||
func _on_Main_piece_dropped(ds):
|
func piece_dropped(ds):
|
||||||
score += ds
|
score += ds
|
||||||
$VBC/Score.text = str(score)
|
$VBC/Score.text = str(score)
|
||||||
|
|
||||||
func _on_Main_piece_locked(lines, t_spin):
|
func piece_locked(lines, t_spin):
|
||||||
var ds
|
var ds
|
||||||
if lines or t_spin:
|
if lines or t_spin:
|
||||||
var text = T_SPIN_NAMES[t_spin]
|
var text = T_SPIN_NAMES[t_spin]
|
||||||
if text:
|
if lines and t_spin:
|
||||||
text += " "
|
text += " "
|
||||||
text += LINES_CLEARED_NAMES[lines]
|
text += LINES_CLEARED_NAMES[lines]
|
||||||
emit_signal("flash_text", text)
|
emit_signal("flash_text", text)
|
||||||
ds = SCORES[lines][t_spin]
|
ds = SCORES[lines][t_spin]
|
||||||
goal -= ds
|
goal -= ds
|
||||||
$VBC/Goal.text = str(goal)
|
$VBC/Goal.text = str(goal)
|
||||||
ds *= 100
|
ds *= 100 * level
|
||||||
emit_signal("flash_text", str(ds))
|
emit_signal("flash_text", str(ds))
|
||||||
score += ds
|
score += ds
|
||||||
$VBC/Score.text = str(score)
|
$VBC/Score.text = str(score)
|
||||||
if score > high_score:
|
if score > high_score:
|
||||||
high_score = score
|
high_score = score
|
||||||
$VBC/HighScore.text = str(high_score)
|
$VBC/HighScore.text = str(high_score)
|
||||||
# Combos
|
# Combos
|
||||||
if lines:
|
if lines:
|
||||||
combos += 1
|
combos += 1
|
||||||
@ -86,3 +100,14 @@ func _on_Main_piece_locked(lines, t_spin):
|
|||||||
combos = -1
|
combos = -1
|
||||||
if goal <= 0:
|
if goal <= 0:
|
||||||
new_level()
|
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
|
||||||
|
@ -25,7 +25,7 @@ params_grow = false
|
|||||||
params_use_alpha_scissor = false
|
params_use_alpha_scissor = false
|
||||||
albedo_color = Color( 0.601563, 0.775878, 1, 0.486471 )
|
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
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
extends "Tetromino.gd"
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
|||||||
[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" index="0"]
|
[node name="TetroJ" type="Spatial" index="0"]
|
||||||
|
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
extends "Tetromino.gd"
|
|
||||||
|
|
@ -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,4 @@
|
|||||||
extends "Tetromino.gd"
|
extends "Tetromino.gd"
|
||||||
|
|
||||||
func rotate(direction):
|
func rotate(direction):
|
||||||
pass
|
return 0
|
@ -1,2 +0,0 @@
|
|||||||
extends "Tetromino.gd"
|
|
||||||
|
|
@ -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 )
|
||||||
|
@ -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,2 +0,0 @@
|
|||||||
extends "Tetromino.gd"
|
|
||||||
|
|
@ -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 )
|
||||||
|
@ -73,52 +73,53 @@ 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 t_spin = NO_T_SPIN
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
randomize()
|
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()
|
||||||
return true
|
return true
|
||||||
else:
|
return false
|
||||||
return false
|
|
||||||
|
|
||||||
func rotate(direction):
|
func rotate(direction):
|
||||||
var rotated_positions = rotated_positions(direction)
|
var t = get_translations()
|
||||||
|
var rotated_translations = [t[0]]
|
||||||
|
for i in range(1, NB_MINOES):
|
||||||
|
var v = t[i]
|
||||||
|
v -= t[0]
|
||||||
|
v = Vector3(-1*direction*v.y, direction*v.x, 0)
|
||||||
|
v += t[0]
|
||||||
|
rotated_translations.append(v)
|
||||||
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 -= direction
|
||||||
orientation %= NB_MINOES
|
orientation %= NB_MINOES
|
||||||
apply_positions(rotated_positions)
|
set_translations(rotated_translations)
|
||||||
translate(movements[i])
|
translate(movements[i])
|
||||||
|
lock_delay.start()
|
||||||
return i+1
|
return i+1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
BIN
source/aperture-vintage-472251-unsplash.jpg
Normal file
BIN
source/aperture-vintage-472251-unsplash.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 348 KiB |
@ -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
|
||||||
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 587 KiB |
@ -20,9 +20,7 @@ config/icon="res://icons/48.png"
|
|||||||
window/size/width=500
|
window/size/width=500
|
||||||
window/size/height=500
|
window/size/height=500
|
||||||
window/vsync/use_vsync=false
|
window/vsync/use_vsync=false
|
||||||
window/stretch/mode="2d"
|
|
||||||
window/stretch/aspect="expand"
|
window/stretch/aspect="expand"
|
||||||
window/stretch/shrink="1"
|
|
||||||
|
|
||||||
[gui]
|
[gui]
|
||||||
|
|
||||||
@ -52,3 +50,4 @@ toggle_fullscreen=[ Object(InputEventKey,"resource_local_to_scene":false,"resour
|
|||||||
[rendering]
|
[rendering]
|
||||||
|
|
||||||
environment/default_clear_color=Color( 0, 0, 0, 1 )
|
environment/default_clear_color=Color( 0, 0, 0, 1 )
|
||||||
|
quality/main_loop_type=""
|
||||||
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 380 KiB After Width: | Height: | Size: 398 KiB |
Reference in New Issue
Block a user