This commit is contained in:
JHDev2006
2025-10-18 12:52:24 +01:00
parent 4dce07b7c8
commit 502013992e
12 changed files with 33 additions and 29 deletions

View File

@@ -1,6 +1,6 @@
[gd_scene load_steps=8 format=3 uid="uid://bigssps82viks"] [gd_scene load_steps=8 format=3 uid="uid://bigssps82viks"]
[ext_resource type="Script" uid="uid://bcqr1v25ygedb" path="res://Scripts/Classes/LevelClass.gd" id="1_8pu80"] [ext_resource type="Script" uid="uid://c0kflqgd1w6sg" path="res://Scripts/Classes/CustomLevel.gd" id="1_8pu80"]
[ext_resource type="PackedScene" uid="uid://bksxgpygrdjl7" path="res://Scenes/Prefabs/LevelBG.tscn" id="2_f32q3"] [ext_resource type="PackedScene" uid="uid://bksxgpygrdjl7" path="res://Scenes/Prefabs/LevelBG.tscn" id="2_f32q3"]
[ext_resource type="Texture2D" uid="uid://cbha2l6hg1kfo" path="res://Assets/Sprites/UI/EditorGrid.png" id="3_e7vnc"] [ext_resource type="Texture2D" uid="uid://cbha2l6hg1kfo" path="res://Assets/Sprites/UI/EditorGrid.png" id="3_e7vnc"]
[ext_resource type="Texture2D" uid="uid://bxciugu0dg7e8" path="res://Assets/Sprites/Editor/ChunkDisplay.png" id="4_rhepb"] [ext_resource type="Texture2D" uid="uid://bxciugu0dg7e8" path="res://Assets/Sprites/Editor/ChunkDisplay.png" id="4_rhepb"]

View File

@@ -29,6 +29,7 @@ func load_level(level_file := {}) -> void:
func build_sublevel(level_idx := 0, level_file := {}) -> PackedScene: func build_sublevel(level_idx := 0, level_file := {}) -> PackedScene:
var level = BASE_LEVEL_SCENE.instantiate() var level = BASE_LEVEL_SCENE.instantiate()
level.sublevel_id = level_idx
sub_level_file = level_file["Levels"][level_idx] sub_level_file = level_file["Levels"][level_idx]
return pack_level_into_scene(build_level(level)) return pack_level_into_scene(build_level(level))
@@ -77,7 +78,7 @@ func add_entities(level: Node, chunk := "", chunk_id := 0, layer := 0) -> void:
if entity_map[entity_id][0] != "res://Scenes/Prefabs/Entities/Player.tscn": if entity_map[entity_id][0] != "res://Scenes/Prefabs/Entities/Player.tscn":
entity_node = load(entity_map[entity_id][0]).instantiate() entity_node = load(entity_map[entity_id][0]).instantiate()
else: else:
entity_node = get_node("EntityLayer1/Player") entity_node = level.get_node("EntityLayer1/Player")
if entity_node == null: if entity_node == null:
continue continue
var offset = entity_map[entity_id][1].split(",") var offset = entity_map[entity_id][1].split(",")
@@ -118,6 +119,7 @@ func apply_level_data(level: Level, data := "") -> void:
level.theme = Level.THEME_IDXS[values[0]] level.theme = Level.THEME_IDXS[values[0]]
Global.level_theme = level.theme Global.level_theme = level.theme
level.theme_time = ["Day", "Night"][values[1]] level.theme_time = ["Day", "Night"][values[1]]
level.music = load(LevelEditor.music_track_list[values[2]])
Global.theme_time = level.theme_time Global.theme_time = level.theme_time
level.campaign = ["SMB1", "SMBLL", "SMBS", "SMBANN"][values[3]] level.campaign = ["SMB1", "SMBLL", "SMBS", "SMBANN"][values[3]]
Global.current_campaign = level.campaign Global.current_campaign = level.campaign
@@ -132,20 +134,12 @@ func apply_bg_data(level: Node, data := "") -> void:
var id := 0 var id := 0
const BG_VALUES := ["primary_layer", "second_layer", "second_layer_offset", "time_of_day", "particles", "liquid_layer", "overlay_clouds"] const BG_VALUES := ["primary_layer", "second_layer", "second_layer_offset", "time_of_day", "particles", "liquid_layer", "overlay_clouds"]
var SELECTORS = [%PrimaryLayer, %SecondLayer, %SecondLayerOffset, %TimeOfDay, %Particles, %LiquidLayer, %OverlayClouds]
for i in split: for i in split:
var value := 0 var value := 0
if i.length() > 1: if i.length() > 1:
value = (decode_from_base64_2char(i)) value = (decode_from_base64_2char(i))
else: else:
value = (base64_charset.find(i)) value = (base64_charset.find(i))
if is_instance_valid($TileMenu):
if SELECTORS[id] is SpinBox:
SELECTORS[id].value = value
elif SELECTORS[id] is Button:
SELECTORS[id].set_pressed_no_signal(bool(value))
else:
SELECTORS[id].selected = value
level.get_node("LevelBG").set_value(value, BG_VALUES[id]) level.get_node("LevelBG").set_value(value, BG_VALUES[id])
id += 1 id += 1

View File

@@ -152,6 +152,7 @@ disabled = true
[node name="CameraRightLimit" type="Node2D" parent="."] [node name="CameraRightLimit" type="Node2D" parent="."]
position = Vector2(128, -80) position = Vector2(128, -80)
script = ExtResource("4_griru") script = ExtResource("4_griru")
set_on_load = false
metadata/_custom_type_script = "uid://bdq0373j5n5o0" metadata/_custom_type_script = "uid://bdq0373j5n5o0"
[node name="CollisionShape2D" type="CollisionShape2D" parent="CameraRightLimit"] [node name="CollisionShape2D" type="CollisionShape2D" parent="CameraRightLimit"]

View File

@@ -1 +1,4 @@
extends Node class_name CustomLevel
extends Level
var sublevel_id := 0

View File

@@ -32,7 +32,7 @@ var selected_tile_index := 0
var can_move_cam := true var can_move_cam := true
var music_track_list: Array[String] = [ "res://Assets/Audio/BGM/Silence.json","res://Assets/Audio/BGM/Athletic.json", "res://Assets/Audio/BGM/Autumn.json", "res://Assets/Audio/BGM/Beach.json", "res://Assets/Audio/BGM/Bonus.json", "res://Assets/Audio/BGM/Bowser.json", "res://Assets/Audio/BGM/FinalBowser.json", "res://Assets/Audio/BGM/Castle.json", "res://Assets/Audio/BGM/CoinHeaven.json", "res://Assets/Audio/BGM/Desert.json", "res://Assets/Audio/BGM/Garden.json", "res://Assets/Audio/BGM/GhostHouse.json", "res://Assets/Audio/BGM/Jungle.json", "res://Assets/Audio/BGM/Mountain.json", "res://Assets/Audio/BGM/Overworld.json", "res://Assets/Audio/BGM/Pipeland.json", "res://Assets/Audio/BGM/BooRace.json", "res://Assets/Audio/BGM/Sky.json", "res://Assets/Audio/BGM/Snow.json", "res://Assets/Audio/BGM/Space.json", "res://Assets/Audio/BGM/Underground.json", "res://Assets/Audio/BGM/Underwater.json", "res://Assets/Audio/BGM/Volcano.json", "res://Assets/Audio/BGM/Airship.json"] static var music_track_list: Array[String] = [ "res://Assets/Audio/BGM/Silence.json","res://Assets/Audio/BGM/Athletic.json", "res://Assets/Audio/BGM/Autumn.json", "res://Assets/Audio/BGM/Beach.json", "res://Assets/Audio/BGM/Bonus.json", "res://Assets/Audio/BGM/Bowser.json", "res://Assets/Audio/BGM/FinalBowser.json", "res://Assets/Audio/BGM/Castle.json", "res://Assets/Audio/BGM/CoinHeaven.json", "res://Assets/Audio/BGM/Desert.json", "res://Assets/Audio/BGM/Garden.json", "res://Assets/Audio/BGM/GhostHouse.json", "res://Assets/Audio/BGM/Jungle.json", "res://Assets/Audio/BGM/Mountain.json", "res://Assets/Audio/BGM/Overworld.json", "res://Assets/Audio/BGM/Pipeland.json", "res://Assets/Audio/BGM/BooRace.json", "res://Assets/Audio/BGM/Sky.json", "res://Assets/Audio/BGM/Snow.json", "res://Assets/Audio/BGM/Space.json", "res://Assets/Audio/BGM/Underground.json", "res://Assets/Audio/BGM/Underwater.json", "res://Assets/Audio/BGM/Volcano.json", "res://Assets/Audio/BGM/Airship.json"]
var music_track_names: Array[String] = ["BGM_NONE", "BGM_ATHLETIC", "BGM_AUTUMN", "BGM_BEACH", "BGM_BONUS", "BGM_BOWSER", "BGM_FINALBOWSER", "BGM_CASTLE", "BGM_COINHEAVEN", "BGM_DESERT", "BGM_GARDEN", "BGM_GHOSTHOUSE", "BGM_JUNGLE", "BGM_MOUNTAIN", "BGM_OVERWORLD", "BGM_PIPELAND", "BGM_RACE", "BGM_SKY", "BGM_SNOW", "BGM_SPACE", "BGM_UNDERGROUND", "BGM_UNDERWATER", "BGM_VOLCANO", "BGM_AIRSHIP"] var music_track_names: Array[String] = ["BGM_NONE", "BGM_ATHLETIC", "BGM_AUTUMN", "BGM_BEACH", "BGM_BONUS", "BGM_BOWSER", "BGM_FINALBOWSER", "BGM_CASTLE", "BGM_COINHEAVEN", "BGM_DESERT", "BGM_GARDEN", "BGM_GHOSTHOUSE", "BGM_JUNGLE", "BGM_MOUNTAIN", "BGM_OVERWORLD", "BGM_PIPELAND", "BGM_RACE", "BGM_SKY", "BGM_SNOW", "BGM_SPACE", "BGM_UNDERGROUND", "BGM_UNDERWATER", "BGM_VOLCANO", "BGM_AIRSHIP"]

View File

@@ -29,6 +29,8 @@ func _ready() -> void:
await get_tree().physics_frame await get_tree().physics_frame
if locked: if locked:
check_if_unlocked(false) check_if_unlocked(false)
if exiting_door_id != -1:
run_door_check()
func _physics_process(_delta: float) -> void: func _physics_process(_delta: float) -> void:
for i in $PlayerDetection.get_overlapping_areas(): for i in $PlayerDetection.get_overlapping_areas():
@@ -110,7 +112,7 @@ func player_enter(player: Player) -> void:
LevelEditor.play_door_transition = true LevelEditor.play_door_transition = true
AudioManager.play_sfx("door_open", global_position) AudioManager.play_sfx("door_open", global_position)
await get_tree().create_timer(0.5, false).timeout await get_tree().create_timer(0.5, false).timeout
if Global.level_editor.sub_level_id == sublevel_id: if Global.current_level.sublevel_id == sublevel_id:
Global.do_fake_transition() Global.do_fake_transition()
if Global.fade_transition: if Global.fade_transition:
await get_tree().create_timer(0.25, false).timeout await get_tree().create_timer(0.25, false).timeout
@@ -119,7 +121,7 @@ func player_enter(player: Player) -> void:
i.run_door_check() i.run_door_check()
else: else:
same_scene_exiting_door = null same_scene_exiting_door = null
Global.level_editor.transition_to_sublevel(sublevel_id) Global.transition_to_scene(NewLevelBuilder.sub_levels[sublevel_id])
can_enter = true can_enter = true
func freeze_player(player: Player) -> void: func freeze_player(player: Player) -> void:

View File

@@ -229,7 +229,7 @@ func _ready() -> void:
handle_power_up_states(0) handle_power_up_states(0)
set_power_state_frame() set_power_state_frame()
handle_invincible_palette() handle_invincible_palette()
if Global.level_editor == null: if [Global.GameMode.LEVEL_EDITOR, Global.GameMode.CUSTOM_LEVEL].has(Global.current_game_mode):
recenter_camera() recenter_camera()
func apply_character_physics() -> void: func apply_character_physics() -> void:

View File

@@ -3,10 +3,12 @@ extends Node2D
@export var reset_on_delete := true @export var reset_on_delete := true
@export var lock_camera := false @export var lock_camera := false
@export var set_on_load := true
func _enter_tree() -> void: func _enter_tree() -> void:
add_to_group("CameraLimits") add_to_group("CameraLimits")
Player.camera_right_limit = int(global_position.x) if set_on_load or is_node_ready():
Player.camera_right_limit = int(global_position.x)
func _exit_tree() -> void: func _exit_tree() -> void:
if reset_on_delete: if reset_on_delete:

View File

@@ -58,8 +58,10 @@ func on_area_entered(area: Area2D) -> void:
old_state = LevelPersistance.active_nodes.duplicate(true) old_state = LevelPersistance.active_nodes.duplicate(true)
unlocked_doors = Door.unlocked_doors.duplicate() unlocked_doors = Door.unlocked_doors.duplicate()
Level.start_level_path = Global.current_level.scene_file_path Level.start_level_path = Global.current_level.scene_file_path
if Global.current_game_mode == Global.GameMode.LEVEL_EDITOR or Global.current_game_mode == Global.GameMode.CUSTOM_LEVEL: if Global.current_game_mode == Global.GameMode.LEVEL_EDITOR:
sublevel_id = Global.level_editor.sub_level_id sublevel_id = Global.level_editor.sub_level_id
elif Global.current_game_mode == Global.GameMode.CUSTOM_LEVEL:
sublevel_id = Global.current_level.sublevel_id
if Settings.file.difficulty.checkpoint_style == 2 and has_meta("is_flag"): if Settings.file.difficulty.checkpoint_style == 2 and has_meta("is_flag"):
if player.power_state.state_name == "Small": if player.power_state.state_name == "Small":
player.get_power_up("Big") player.get_power_up("Big")

View File

@@ -1,16 +1,8 @@
extends Node2D extends Node2D
func _enter_tree() -> void:
hide()
func _process(delta: float) -> void:
hide()
func _physics_process(delta: float) -> void:
hide()
func _ready() -> void: func _ready() -> void:
hide() update()
func update() -> void: func update() -> void:
visible = !LevelEditor.playing_level and Global.current_game_mode == Global.GameMode.LEVEL_EDITOR visible = !LevelEditor.playing_level and Global.current_game_mode == Global.GameMode.LEVEL_EDITOR

View File

@@ -100,8 +100,17 @@ func _ready() -> void:
$Timer.start() $Timer.start()
else: else:
if NewLevelBuilder.sub_levels == [null, null, null, null, null]: if NewLevelBuilder.sub_levels == [null, null, null, null, null]:
Global.clear_saved_values()
Global.reset_values()
wait_for_build_completion()
NewLevelBuilder.load_level(LevelEditor.level_file) NewLevelBuilder.load_level(LevelEditor.level_file)
transition() else:
await get_tree().create_timer(0.1, false).timeout
can_transition = true
func wait_for_build_completion() -> void:
await NewLevelBuilder.level_building_complete
can_transition = true
func handle_challenge_mode_transition() -> void: func handle_challenge_mode_transition() -> void:
$BG/Control/LivesCount.hide() $BG/Control/LivesCount.hide()
@@ -132,7 +141,6 @@ func transition() -> void:
elif Global.current_game_mode != Global.GameMode.CUSTOM_LEVEL: elif Global.current_game_mode != Global.GameMode.CUSTOM_LEVEL:
Global.transition_to_scene(level_to_transition_to) Global.transition_to_scene(level_to_transition_to)
else: else:
await get_tree().create_timer(0.25, false).timeout
Global.transition_to_scene(NewLevelBuilder.sub_levels[Checkpoint.sublevel_id]) Global.transition_to_scene(NewLevelBuilder.sub_levels[Checkpoint.sublevel_id])
func show_best_time() -> void: func show_best_time() -> void:

View File

@@ -30,6 +30,7 @@ use_discord=true
ModLoaderStore="*res://addons/mod_loader/mod_loader_store.gd" ModLoaderStore="*res://addons/mod_loader/mod_loader_store.gd"
ModLoader="*res://addons/mod_loader/mod_loader.gd" ModLoader="*res://addons/mod_loader/mod_loader.gd"
NewLevelBuilder="*res://Scenes/Prefabs/Autoload/NewLevelBuilder.gd"
Global="*res://Scenes/Prefabs/Global.tscn" Global="*res://Scenes/Prefabs/Global.tscn"
Settings="*res://Scenes/Prefabs/Autoload/Settings.tscn" Settings="*res://Scenes/Prefabs/Autoload/Settings.tscn"
SaveManager="*res://Scripts/Classes/Singletons/SaveManager.gd" SaveManager="*res://Scripts/Classes/Singletons/SaveManager.gd"
@@ -38,7 +39,6 @@ AudioManager="*res://Scenes/Prefabs/Autoload/AudioManager.tscn"
BetterTerrain="*res://addons/better-terrain/BetterTerrain.gd" BetterTerrain="*res://addons/better-terrain/BetterTerrain.gd"
GameBanana="*res://Scripts/Classes/Singletons/GameBananaManager.gd" GameBanana="*res://Scripts/Classes/Singletons/GameBananaManager.gd"
SpeedrunHandler="*res://Scripts/Classes/Singletons/SpeedrunHandler.gd" SpeedrunHandler="*res://Scripts/Classes/Singletons/SpeedrunHandler.gd"
NewLevelBuilder="*res://Scenes/Prefabs/Autoload/NewLevelBuilder.gd"
[debug] [debug]