revamped key rebinding system
This commit is contained in:
@ -9,13 +9,15 @@ class_name LeapingController extends PathingController
|
||||
@export var norths: Sprite3D
|
||||
@export var souths: Sprite3D
|
||||
@export var box: CSGBox3D
|
||||
@export var tol: Label
|
||||
|
||||
var tolerance: float = 50.0
|
||||
var jumping: bool = false
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
tolerance = remap(character.health.current_health, 10, 50, character.health.max_health * 0.20, character.health.max_health)
|
||||
tolerance = remap(character.health.current_health, character.health.max_health * 0.20, character.health.max_health, 10, 50)
|
||||
tolerance = maxf(tolerance, 10)
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
@ -64,7 +66,7 @@ func _physics_process(delta: float) -> void:
|
||||
distance_remaining -= gain
|
||||
path_progress += gain
|
||||
leap(Vector3(0.0, 0.0, -4.0))
|
||||
#eastl.text = str(gain)
|
||||
eastl.text = str(gain)
|
||||
#easts.visible = true
|
||||
else:
|
||||
eastl.text = "cant"
|
||||
@ -83,7 +85,7 @@ func _physics_process(delta: float) -> void:
|
||||
distance_remaining -= gain
|
||||
path_progress += gain
|
||||
leap(Vector3(0.0, 0.0, 4.0))
|
||||
#westl.text = str(gain)
|
||||
westl.text = str(gain)
|
||||
#wests.visible = true
|
||||
else:
|
||||
westl.text = "cant"
|
||||
@ -102,7 +104,7 @@ func _physics_process(delta: float) -> void:
|
||||
distance_remaining -= gain
|
||||
path_progress += gain
|
||||
leap(Vector3(-4.0, 0.0, 0.0))
|
||||
#northl.text = str(gain)
|
||||
northl.text = str(gain)
|
||||
#norths.visible = true
|
||||
else:
|
||||
northl.text = "cant"
|
||||
@ -121,7 +123,7 @@ func _physics_process(delta: float) -> void:
|
||||
distance_remaining -= gain
|
||||
path_progress += gain
|
||||
leap(Vector3(4.0, 0.0, 0.0))
|
||||
#southl.text = str(gain)
|
||||
southl.text = str(gain)
|
||||
#souths.visible = true
|
||||
else:
|
||||
southl.text = "cant"
|
||||
@ -138,6 +140,6 @@ func finish_jump() -> void:
|
||||
func leap(to_point: Vector3) -> void:
|
||||
jumping = true
|
||||
var tween: Tween = create_tween()
|
||||
tween.tween_property(character, "global_position", character.global_position + (to_point / 2.0) + Vector3.UP, 1.0)
|
||||
tween.tween_property(character, "global_position", character.global_position + to_point, 1.0)
|
||||
tween.tween_property(character, "global_position", character.global_position + (to_point / 2.0) + Vector3.UP, 0.5)
|
||||
tween.tween_property(character, "global_position", character.global_position + to_point, 0.5)
|
||||
tween.tween_callback(finish_jump)
|
||||
|
@ -6,3 +6,4 @@ class_name HeroClass extends Resource
|
||||
@export var deck: Array[Card]
|
||||
@export var faction: Card.Faction
|
||||
@export var podium: PackedScene
|
||||
@export var card_item: PackedScene
|
||||
|
@ -1,176 +0,0 @@
|
||||
class_name PlayerKeymap extends Resource
|
||||
|
||||
const SAVE_PATH: String = "user://keymap.tres"
|
||||
|
||||
@export var title: String
|
||||
|
||||
@export_category("Primary Bindings")
|
||||
@export var move_forward: InputEvent
|
||||
@export var move_backward: InputEvent
|
||||
@export var move_left: InputEvent
|
||||
@export var move_right: InputEvent
|
||||
@export var jump: InputEvent
|
||||
@export var sprint: InputEvent
|
||||
@export var interact: InputEvent
|
||||
@export var open_text_chat: InputEvent
|
||||
@export var ready: InputEvent
|
||||
@export var pause: InputEvent
|
||||
@export var equip_card_in_gauntlet: InputEvent
|
||||
@export var view_map: InputEvent
|
||||
@export var fire1: InputEvent
|
||||
@export var fire2: InputEvent
|
||||
@export var select_next_card: InputEvent
|
||||
@export var select_prev_card: InputEvent
|
||||
|
||||
@export_category("Secondary Bindings")
|
||||
@export var secondary_move_forward: InputEvent
|
||||
@export var secondary_move_backward: InputEvent
|
||||
@export var secondary_move_left: InputEvent
|
||||
@export var secondary_move_right: InputEvent
|
||||
@export var secondary_jump: InputEvent
|
||||
@export var secondary_sprint: InputEvent
|
||||
@export var secondary_interact: InputEvent
|
||||
@export var secondary_open_text_chat: InputEvent
|
||||
@export var secondary_ready: InputEvent
|
||||
@export var secondary_pause: InputEvent
|
||||
@export var secondary_equip_card_in_gauntlet: InputEvent
|
||||
@export var secondary_view_map: InputEvent
|
||||
@export var secondary_fire1: InputEvent
|
||||
@export var secondary_fire2: InputEvent
|
||||
@export var secondary_select_next_card: InputEvent
|
||||
@export var secondary_select_prev_card: InputEvent
|
||||
|
||||
|
||||
func apply() -> void:
|
||||
replace_action_event("Move Forward", move_forward, secondary_move_forward)
|
||||
replace_action_event("Move Backward", move_backward, secondary_move_backward)
|
||||
replace_action_event("Move Left", move_left, secondary_move_left)
|
||||
replace_action_event("Move Right", move_right, secondary_move_right)
|
||||
replace_action_event("Jump", jump, secondary_jump)
|
||||
replace_action_event("Sprint", sprint, secondary_sprint)
|
||||
replace_action_event("Interact", interact, secondary_interact)
|
||||
replace_action_event("Open Text Chat", open_text_chat, secondary_open_text_chat)
|
||||
replace_action_event("Ready", ready, secondary_ready)
|
||||
replace_action_event("Pause", pause, secondary_pause)
|
||||
replace_action_event("Equip In Gauntlet", equip_card_in_gauntlet, secondary_equip_card_in_gauntlet)
|
||||
replace_action_event("View Map", view_map, secondary_view_map)
|
||||
replace_action_event("Primary Fire", fire1, secondary_fire1)
|
||||
replace_action_event("Secondary Fire", fire2, secondary_fire2)
|
||||
replace_action_event("Select Next Card", select_next_card, secondary_select_next_card)
|
||||
replace_action_event("Select Previous Card", select_prev_card, secondary_select_prev_card)
|
||||
|
||||
|
||||
func replace_action_event(action_string: String, event: InputEvent, secondary_event: InputEvent) -> void:
|
||||
InputMap.action_erase_events(action_string)
|
||||
if event:
|
||||
InputMap.action_add_event(action_string, event)
|
||||
if secondary_event:
|
||||
InputMap.action_add_event(action_string, secondary_event)
|
||||
|
||||
|
||||
func set_primary_action_event(action_string: String, event: InputEvent) -> void:
|
||||
var secondary_event: InputEvent
|
||||
if InputMap.action_get_events(action_string).size() > 1:
|
||||
secondary_event = InputMap.action_get_events(action_string)[1]
|
||||
replace_action_event(action_string, event, secondary_event)
|
||||
|
||||
|
||||
func set_secondary_action_event(action_string: String, event: InputEvent) -> void:
|
||||
var primary_event: InputEvent
|
||||
if InputMap.action_get_events(action_string).size() > 0:
|
||||
primary_event = InputMap.action_get_events(action_string)[0]
|
||||
replace_action_event(action_string, primary_event, event)
|
||||
|
||||
|
||||
func append_input_map() -> void:
|
||||
InputMap.action_add_event("Move Forward", move_forward)
|
||||
InputMap.action_add_event("Move Backward", move_backward)
|
||||
InputMap.action_add_event("Move Left", move_left)
|
||||
InputMap.action_add_event("Move Right", move_right)
|
||||
InputMap.action_add_event("Jump", jump)
|
||||
InputMap.action_add_event("Sprint", sprint)
|
||||
InputMap.action_add_event("Interact", interact)
|
||||
InputMap.action_add_event("Open Text Chat", open_text_chat)
|
||||
InputMap.action_add_event("Ready", ready)
|
||||
InputMap.action_add_event("Pause", pause)
|
||||
InputMap.action_add_event("Equip In Gauntlet", equip_card_in_gauntlet)
|
||||
InputMap.action_add_event("View Map", view_map)
|
||||
InputMap.action_add_event("Primary Fire", fire1)
|
||||
InputMap.action_add_event("Secondary Fire", fire2)
|
||||
InputMap.action_add_event("Select Next Card", select_next_card)
|
||||
InputMap.action_add_event("Select Previous Card", select_prev_card)
|
||||
|
||||
|
||||
func get_current_input_map() -> void:
|
||||
move_forward = InputMap.action_get_events("Move Forward")[0]
|
||||
if InputMap.action_get_events("Move Forward").size() > 1:
|
||||
secondary_move_forward = InputMap.action_get_events("Move Forward")[1]
|
||||
|
||||
move_backward = InputMap.action_get_events("Move Backward")[0]
|
||||
if InputMap.action_get_events("Move Backward").size() > 1:
|
||||
secondary_move_backward = InputMap.action_get_events("Move Backward")[1]
|
||||
|
||||
move_left = InputMap.action_get_events("Move Left")[0]
|
||||
if InputMap.action_get_events("Move Left").size() > 1:
|
||||
secondary_move_left = InputMap.action_get_events("Move Left")[1]
|
||||
|
||||
move_right = InputMap.action_get_events("Move Right")[0]
|
||||
if InputMap.action_get_events("Move Right").size() > 1:
|
||||
secondary_move_right = InputMap.action_get_events("Move Right")[1]
|
||||
|
||||
jump = InputMap.action_get_events("Jump")[0]
|
||||
if InputMap.action_get_events("Jump").size() > 1:
|
||||
secondary_jump = InputMap.action_get_events("Jump")[1]
|
||||
|
||||
sprint = InputMap.action_get_events("Sprint")[0]
|
||||
if InputMap.action_get_events("Sprint").size() > 1:
|
||||
secondary_sprint = InputMap.action_get_events("Sprint")[1]
|
||||
|
||||
interact = InputMap.action_get_events("Interact")[0]
|
||||
if InputMap.action_get_events("Interact").size() > 1:
|
||||
secondary_interact = InputMap.action_get_events("Interact")[1]
|
||||
|
||||
open_text_chat = InputMap.action_get_events("Open Text Chat")[0]
|
||||
if InputMap.action_get_events("Open Text Chat").size() > 1:
|
||||
secondary_open_text_chat = InputMap.action_get_events("Open Text Chat")[1]
|
||||
|
||||
ready = InputMap.action_get_events("Ready")[0]
|
||||
if InputMap.action_get_events("Ready").size() > 1:
|
||||
secondary_ready = InputMap.action_get_events("Ready")[1]
|
||||
|
||||
pause = InputMap.action_get_events("Pause")[0]
|
||||
if InputMap.action_get_events("Pause").size() > 1:
|
||||
secondary_pause = InputMap.action_get_events("Pause")[1]
|
||||
|
||||
equip_card_in_gauntlet = InputMap.action_get_events("Equip In Gauntlet")[0]
|
||||
if InputMap.action_get_events("Equip In Gauntlet").size() > 1:
|
||||
secondary_equip_card_in_gauntlet = InputMap.action_get_events("Equip In Gauntlet")[1]
|
||||
|
||||
view_map = InputMap.action_get_events("View Map")[0]
|
||||
if InputMap.action_get_events("View Map").size() > 1:
|
||||
secondary_view_map = InputMap.action_get_events("View Map")[1]
|
||||
|
||||
fire1 = InputMap.action_get_events("Primary Fire")[0]
|
||||
if InputMap.action_get_events("Primary Fire").size() > 1:
|
||||
secondary_fire1 = InputMap.action_get_events("Primary Fire")[1]
|
||||
|
||||
fire2 = InputMap.action_get_events("Secondary Fire")[0]
|
||||
if InputMap.action_get_events("Secondary Fire").size() > 1:
|
||||
secondary_fire2 = InputMap.action_get_events("Secondary Fire")[1]
|
||||
|
||||
select_next_card = InputMap.action_get_events("Select Next Card")[0]
|
||||
if InputMap.action_get_events("Select Next Card").size() > 1:
|
||||
secondary_select_next_card = InputMap.action_get_events("Select Next Card")[1]
|
||||
|
||||
select_prev_card = InputMap.action_get_events("Select Previous Card")[0]
|
||||
if InputMap.action_get_events("Select Previous Card").size() > 1:
|
||||
secondary_select_prev_card = InputMap.action_get_events("Select Previous Card")[1]
|
||||
|
||||
|
||||
func save_profile_to_disk() -> void:
|
||||
get_current_input_map()
|
||||
ResourceSaver.save(self, SAVE_PATH)
|
||||
static func load_profile_from_disk() -> PlayerKeymap:
|
||||
if ResourceLoader.exists(SAVE_PATH):
|
||||
return ResourceLoader.load(SAVE_PATH)
|
||||
return Data.keymaps[0]
|
@ -1 +0,0 @@
|
||||
uid://vkthiwr3vq4g
|
@ -1,6 +1,6 @@
|
||||
class_name SaveData extends RefCounted
|
||||
|
||||
const SAVE_PATH: String = "user://save1.txt"
|
||||
var save_slot: int = 0
|
||||
|
||||
#Game History
|
||||
var twenty_game_history: Array[bool] = []
|
||||
@ -52,7 +52,11 @@ func bought_mage_card() -> void:
|
||||
|
||||
|
||||
func save_to_disc() -> void:
|
||||
var save_file: FileAccess = FileAccess.open(SAVE_PATH, FileAccess.WRITE)
|
||||
var dir: DirAccess = DirAccess.open("user://")
|
||||
if !dir.dir_exists("saves"):
|
||||
dir.make_dir("saves")
|
||||
dir.change_dir("saves")
|
||||
var save_file: FileAccess = FileAccess.open("user://saves/slot" + str(save_slot), FileAccess.WRITE)
|
||||
var dict: Dictionary = {
|
||||
"wins" = wins,
|
||||
"losses" = losses,
|
||||
@ -66,15 +70,16 @@ func save_to_disc() -> void:
|
||||
save_file.store_line(json_string)
|
||||
|
||||
|
||||
static func load_profile_from_disk() -> SaveData:
|
||||
if FileAccess.file_exists(SAVE_PATH):
|
||||
var save_file: FileAccess = FileAccess.open(SAVE_PATH, FileAccess.READ)
|
||||
static func load_from_disk(slot: int) -> SaveData:
|
||||
if FileAccess.file_exists("user://saves/slot" + str(slot)):
|
||||
var save_file: FileAccess = FileAccess.open("user://saves/slot" + str(slot), FileAccess.READ)
|
||||
var json_string: String = save_file.get_line()
|
||||
var json: JSON = JSON.new()
|
||||
var parse_result: Error = json.parse(json_string)
|
||||
if parse_result == OK:
|
||||
var dict: Dictionary = json.data
|
||||
var stats: SaveData = SaveData.new()
|
||||
stats.save_slot = slot
|
||||
stats.wins = dict["wins"]
|
||||
stats.losses = dict["losses"]
|
||||
stats.twenty_game_history.append_array(dict["twenty_game_history"])
|
||||
|
@ -23,7 +23,6 @@ var recharge_speed: float = 0.0
|
||||
var recharge_acceleration: float = 2.0
|
||||
var recharge_max_speed: float = 25.0
|
||||
#var time_since_trigger: float = 0.0
|
||||
var prev_energy_int: int = 0.0
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
@ -47,12 +46,7 @@ func _process(delta: float) -> void:
|
||||
if current_energy >= max_energy:
|
||||
current_energy = max_energy
|
||||
recharging = false
|
||||
if stats.energy_type == Data.EnergyType.CONTINUOUS:
|
||||
energy_recharged.emit(recharge_speed * delta, stats.energy_type)
|
||||
if stats.energy_type == Data.EnergyType.DISCRETE and int(current_energy) > prev_energy_int:
|
||||
energy_recharged.emit(1, stats.energy_type)
|
||||
prev_energy_int = int(current_energy)
|
||||
#energy_changed.emit(current_energy)
|
||||
energy_recharged.emit(recharge_speed * delta, stats.energy_type)
|
||||
if time_since_firing < time_between_shots:
|
||||
time_since_firing += delta
|
||||
if trigger_held and stats.energy_type == Data.EnergyType.CONTINUOUS:
|
||||
@ -64,6 +58,7 @@ func _physics_process(delta: float) -> void:
|
||||
if trigger_held and current_energy >= energy_cost and time_since_firing >= time_between_shots:
|
||||
if stats.energy_type == Data.EnergyType.DISCRETE:
|
||||
current_energy -= 1
|
||||
current_energy = floorf(current_energy)
|
||||
energy_spent.emit(1, stats.energy_type)
|
||||
time_since_firing -= time_between_shots
|
||||
shoot()
|
||||
|
3
Scripts/bind_button.gd
Normal file
3
Scripts/bind_button.gd
Normal file
@ -0,0 +1,3 @@
|
||||
class_name BindButton extends Button
|
||||
|
||||
var trigger_event: InputEvent
|
1
Scripts/bind_button.gd.uid
Normal file
1
Scripts/bind_button.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://d135gvjs1ilsv
|
@ -3,15 +3,14 @@ extends Node
|
||||
var characters: Array[HeroClass]
|
||||
var cards: Array[Card]
|
||||
var enemies: Array[Enemy]
|
||||
var keymaps: Array[PlayerKeymap]
|
||||
#var keymaps: Array[PlayerKeymap]
|
||||
var mods: Dictionary[String, String]
|
||||
var graphics: PlayerGraphicsSettings
|
||||
var audio: PlayerAudioSettings
|
||||
var preferences: PlayerPreferences
|
||||
var player_profile: PlayerProfile
|
||||
var player_keymap: PlayerKeymap
|
||||
var player_controller_keymap: PlayerKeymap = preload("res://Resources/Keymaps/controller.tres")
|
||||
var save_data: SaveData
|
||||
var keymap_data: KeymapData
|
||||
|
||||
const DEFAULT_SERVER_PORT: int = 58008
|
||||
|
||||
@ -102,12 +101,6 @@ func _ready() -> void:
|
||||
mods[dict["display_name"]] = "res://Mods/" + file_name + "/" + dict["pck_path"]
|
||||
data_name = data_dir.get_next()
|
||||
file_name = mod_dir.get_next()
|
||||
|
||||
keymaps.append(preload("res://Resources/Keymaps/qwerty.tres"))
|
||||
keymaps.append(preload("res://Resources/Keymaps/azerty.tres"))
|
||||
keymaps.append(preload("res://Resources/Keymaps/dvorak.tres"))
|
||||
keymaps.append(preload("res://Resources/Keymaps/colemak.tres"))
|
||||
keymaps.append(preload("res://Resources/Keymaps/workman.tres"))
|
||||
|
||||
graphics = PlayerGraphicsSettings.load_profile_from_disk()
|
||||
graphics.apply_graphical_settings(get_viewport())
|
||||
@ -115,10 +108,9 @@ func _ready() -> void:
|
||||
audio.apply_audio_settings()
|
||||
player_profile = PlayerProfile.load_profile_from_disk()
|
||||
preferences = PlayerPreferences.load_profile_from_disk()
|
||||
player_keymap = PlayerKeymap.load_profile_from_disk()
|
||||
player_keymap.apply()
|
||||
player_controller_keymap.append_input_map()
|
||||
save_data = SaveData.load_profile_from_disk()
|
||||
save_data = SaveData.load_from_disk(0)
|
||||
keymap_data = KeymapData.load_from_disk()
|
||||
keymap_data.apply()
|
||||
|
||||
load_classes()
|
||||
load_cards("res://Cards")
|
||||
|
@ -182,7 +182,7 @@ func set_upcoming_wave() -> void:
|
||||
var spawn_power: int = WaveManager.calculate_spawn_power(wave + 1, connected_players_nodes.size())
|
||||
#var new_wave: Dictionary = WaveManager.generate_wave(spawn_power, level.enemy_pool)
|
||||
var new_wave: Wave = WaveManager.generate_wave(spawn_power, level.enemy_pool, level.enemy_spawns)
|
||||
temp_set_upcoming_wave(new_wave, floori(WaveManager.calculate_pot(wave + 1, connected_players_nodes.size()) / 20.0))
|
||||
temp_set_upcoming_wave(new_wave, WaveManager.calculate_pot(wave + 1, connected_players_nodes.size()))
|
||||
#networked_set_upcoming_wave.rpc(new_wave, 6 + floori(spawn_power / 70.0))
|
||||
|
||||
|
||||
|
@ -1,53 +1,111 @@
|
||||
class_name KeyIconMap
|
||||
|
||||
|
||||
static var playstation_keys: Dictionary = {
|
||||
"0" = "res://KennyControllerPrompts/Playstation/playstation_button_color_cross.png",
|
||||
"1" = "res://KennyControllerPrompts/Playstation/playstation_button_color_circle.png",
|
||||
"2" = "res://KennyControllerPrompts/Playstation/playstation_button_color_square.png",
|
||||
"3" = "res://KennyControllerPrompts/Playstation/playstation_button_color_triangle.png",
|
||||
"4" = "res://KennyControllerPrompts/Playstation/playstation5_button_create.png",
|
||||
"6" = "res://KennyControllerPrompts/Playstation/playstation5_button_options.png",
|
||||
"7" = "res://KennyControllerPrompts/Playstation/playstation_stick_side_l.png",
|
||||
"8" = "res://KennyControllerPrompts/Playstation/playstation_stick_side_r.png",
|
||||
"9" = "res://KennyControllerPrompts/Playstation/playstation_trigger_l1_alternative.png",
|
||||
"10" = "res://KennyControllerPrompts/Playstation/playstation_trigger_r1_alternative.png",
|
||||
"11" = "res://KennyControllerPrompts/Playstation/playstation_dpad_up.png",
|
||||
"12" = "res://KennyControllerPrompts/Playstation/playstation_dpad_down.png",
|
||||
"13" = "res://KennyControllerPrompts/Playstation/playstation_dpad_left.png",
|
||||
"14" = "res://KennyControllerPrompts/Playstation/playstation_dpad_right.png",
|
||||
"15" = "res://KennyControllerPrompts/Playstation/playstation5_button_mute.png",
|
||||
}
|
||||
|
||||
|
||||
static var xbox_series_keys: Dictionary = {
|
||||
"0" = "res://KennyControllerPrompts/Xbox/xbox_button_a_outline.png",
|
||||
"1" = "res://KennyControllerPrompts/Xbox/xbox_button_b_outline.png",
|
||||
"2" = "res://KennyControllerPrompts/Xbox/xbox_button_x_outline.png",
|
||||
"3" = "res://KennyControllerPrompts/Xbox/xbox_button_y_outline.png",
|
||||
"4" = "res://KennyControllerPrompts/Xbox/xbox_button_view_outline.png",
|
||||
"5" = "res://KennyControllerPrompts/Xbox/xbox_guide.png",
|
||||
"6" = "res://KennyControllerPrompts/Xbox/xbox_button_menu_outline.png",
|
||||
"7" = "res://KennyControllerPrompts/Xbox/xbox_stick_side_l.png",
|
||||
"8" = "res://KennyControllerPrompts/Xbox/xbox_stick_side_r.png",
|
||||
"9" = "res://KennyControllerPrompts/Xbox/xbox_lb_outline.png",
|
||||
"10" = "res://KennyControllerPrompts/Xbox/xbox_rb_outline.png",
|
||||
"11" = "res://KennyControllerPrompts/Xbox/xbox_dpad_up_outline.png",
|
||||
"12" = "res://KennyControllerPrompts/Xbox/xbox_dpad_down_outline.png",
|
||||
"13" = "res://KennyControllerPrompts/Xbox/xbox_dpad_left_outline.png",
|
||||
"14" = "res://KennyControllerPrompts/Xbox/xbox_dpad_right_outline.png",
|
||||
"15" = "res://KennyControllerPrompts/Xbox/xbox_button_share_outline.png",
|
||||
}
|
||||
|
||||
|
||||
static var xbox_360_keys: Dictionary = {
|
||||
"0" = "res://KennyControllerPrompts/Xbox/xbox_button_color_a.png",
|
||||
"1" = "res://KennyControllerPrompts/Xbox/xbox_button_color_b.png",
|
||||
"2" = "res://KennyControllerPrompts/Xbox/xbox_button_color_x.png",
|
||||
"3" = "res://KennyControllerPrompts/Xbox/xbox_button_color_y.png",
|
||||
"4" = "res://KennyControllerPrompts/Xbox/xbox_button_back.png",
|
||||
"5" = "res://KennyControllerPrompts/Xbox/xbox_guide_outline.png",
|
||||
"6" = "res://KennyControllerPrompts/Xbox/xbox_button_start.png",
|
||||
"7" = "res://KennyControllerPrompts/Xbox/xbox_stick_side_l.png",
|
||||
"8" = "res://KennyControllerPrompts/Xbox/xbox_stick_side_r.png",
|
||||
"9" = "res://KennyControllerPrompts/Xbox/xbox_lb.png",
|
||||
"10" = "res://KennyControllerPrompts/Xbox/xbox_rb.png",
|
||||
"11" = "res://KennyControllerPrompts/Xbox/xbox_dpad_round_up.png",
|
||||
"12" = "res://KennyControllerPrompts/Xbox/xbox_dpad_round_down.png",
|
||||
"13" = "res://KennyControllerPrompts/Xbox/xbox_dpad_round_left.png",
|
||||
"14" = "res://KennyControllerPrompts/Xbox/xbox_dpad_round_right.png",
|
||||
}
|
||||
|
||||
|
||||
static var keys: Dictionary = {
|
||||
"48" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/0_Key_Light.png",
|
||||
"49" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/1_Key_Light.png",
|
||||
"50" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/2_Key_Light.png",
|
||||
"51" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/3_Key_Light.png",
|
||||
"52" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/4_Key_Light.png",
|
||||
"53" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/5_Key_Light.png",
|
||||
"54" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/6_Key_Light.png",
|
||||
"55" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/7_Key_Light.png",
|
||||
"56" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/8_Key_Light.png",
|
||||
"57" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/9_Key_Light.png",
|
||||
"65" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/A_Key_Light.png",
|
||||
"66" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/B_Key_Light.png",
|
||||
"67" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/C_Key_Light.png",
|
||||
"68" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/D_Key_Light.png",
|
||||
"69" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/E_Key_Light.png",
|
||||
"70" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/F_Key_Light.png",
|
||||
"71" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/G_Key_Light.png",
|
||||
"72" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/H_Key_Light.png",
|
||||
"73" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/I_Key_Light.png",
|
||||
"74" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/J_Key_Light.png",
|
||||
"75" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/K_Key_Light.png",
|
||||
"76" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/L_Key_Light.png",
|
||||
"77" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/M_Key_Light.png",
|
||||
"78" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/N_Key_Light.png",
|
||||
"79" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/O_Key_Light.png",
|
||||
"80" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/P_Key_Light.png",
|
||||
"81" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Q_Key_Light.png",
|
||||
"82" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/R_Key_Light.png",
|
||||
"83" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/S_Key_Light.png",
|
||||
"84" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/T_Key_Light.png",
|
||||
"85" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/U_Key_Light.png",
|
||||
"86" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/V_Key_Light.png",
|
||||
"87" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/W_Key_Light.png",
|
||||
"88" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/X_Key_Light.png",
|
||||
"89" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Y_Key_Light.png",
|
||||
"90" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Z_Key_Light.png",
|
||||
"48" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/0_Key_Light.png",
|
||||
"49" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/1_Key_Light.png",
|
||||
"50" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/2_Key_Light.png",
|
||||
"51" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/3_Key_Light.png",
|
||||
"52" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/4_Key_Light.png",
|
||||
"53" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/5_Key_Light.png",
|
||||
"54" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/6_Key_Light.png",
|
||||
"55" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/7_Key_Light.png",
|
||||
"56" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/8_Key_Light.png",
|
||||
"57" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/9_Key_Light.png",
|
||||
"65" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/A_Key_Light.png",
|
||||
"66" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/B_Key_Light.png",
|
||||
"67" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/C_Key_Light.png",
|
||||
"68" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/D_Key_Light.png",
|
||||
"69" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/E_Key_Light.png",
|
||||
"70" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/F_Key_Light.png",
|
||||
"71" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/G_Key_Light.png",
|
||||
"72" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/H_Key_Light.png",
|
||||
"73" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/I_Key_Light.png",
|
||||
"74" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/J_Key_Light.png",
|
||||
"75" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/K_Key_Light.png",
|
||||
"76" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/L_Key_Light.png",
|
||||
"77" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/M_Key_Light.png",
|
||||
"78" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/N_Key_Light.png",
|
||||
"79" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/O_Key_Light.png",
|
||||
"80" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/P_Key_Light.png",
|
||||
"81" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Q_Key_Light.png",
|
||||
"82" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/R_Key_Light.png",
|
||||
"83" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/S_Key_Light.png",
|
||||
"84" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/T_Key_Light.png",
|
||||
"85" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/U_Key_Light.png",
|
||||
"86" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/V_Key_Light.png",
|
||||
"87" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/W_Key_Light.png",
|
||||
"88" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/X_Key_Light.png",
|
||||
"89" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Y_Key_Light.png",
|
||||
"90" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Z_Key_Light.png",
|
||||
"4194328" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Alt_Key_Light.png",
|
||||
"4194322" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Arrow_Down_Key_Light.png",
|
||||
"4194319" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Arrow_Left_Key_Light.png",
|
||||
"4194321" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Arrow_Right_Key_Light.png",
|
||||
"4194320" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Arrow_Up_Key_Light.png",
|
||||
"42" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Asterisk_Key_Light.png",
|
||||
"42" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Asterisk_Key_Light.png",
|
||||
"4194433" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Asterisk_Key_Light.png",
|
||||
"4194308" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Backspace_Alt_Key_Light.png",
|
||||
"91" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Bracket_Left_Key_Light.png",
|
||||
"93" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Bracket_Right_Key_Light.png",
|
||||
"91" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Bracket_Left_Key_Light.png",
|
||||
"93" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Bracket_Right_Key_Light.png",
|
||||
"4194329" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Caps_Lock_Key_Light.png",
|
||||
"4194327" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Command_Key_Light.png",
|
||||
"4194326" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Ctrl_Key_Light.png",
|
||||
@ -69,29 +127,31 @@ static var keys: Dictionary = {
|
||||
"4194343" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/F12_Key_Light.png",
|
||||
"4194317" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Home_Key_Light.png",
|
||||
"4194311" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Insert_Key_Light.png",
|
||||
"60" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Mark_Left_Key_Light.png",
|
||||
"62" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Mark_Right_Key_Light.png",
|
||||
"45" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Minus_Key_Light.png",
|
||||
"60" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Mark_Left_Key_Light.png",
|
||||
"62" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Mark_Right_Key_Light.png",
|
||||
"45" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Minus_Key_Light.png",
|
||||
"4194435" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Minus_Key_Light.png",
|
||||
"4194330" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Num_Lock_Key_Light.png",
|
||||
"4194324" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Page_Down_Key_Light.png",
|
||||
"4194323" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Page_Up_Key_Light.png",
|
||||
"43" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Plus_Key_Light.png",
|
||||
"43" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Plus_Key_Light.png",
|
||||
"4194437" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Plus_Key_Light.png",
|
||||
"4194314" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Print_Screen_Key_Light.png",
|
||||
"63" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Question_Key_Light.png",
|
||||
"34" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Quote_Key_Light.png",
|
||||
"59" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Semicolon_Key_Light.png",
|
||||
"63" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Question_Key_Light.png",
|
||||
"34" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Quote_Key_Light.png",
|
||||
"59" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Semicolon_Key_Light.png",
|
||||
"4194325" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Shift_Key_Light.png",
|
||||
"47" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Slash_Key_Light.png",
|
||||
"47" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Slash_Key_Light.png",
|
||||
"4194434" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Slash_Key_Light.png",
|
||||
"32" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Space_Key_Light.png",
|
||||
"32" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Space_Key_Light.png",
|
||||
"4194306" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Tab_Key_Light.png",
|
||||
"126" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Tilda_Key_Light.png",
|
||||
"126" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Tilda_Key_Light.png",
|
||||
}
|
||||
|
||||
static var mouse_buttons: Dictionary = {
|
||||
"1" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Mouse_Left_Key_Light.png",
|
||||
"3" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Mouse_Middle_Key_Light.png",
|
||||
"2" = "res://XeluController&KeyPrompts/Keyboard & Mouse/Light/Mouse_Right_Key_Light.png",
|
||||
"1" = "res://KennyControllerPrompts/Mouse/mouse_left.png",
|
||||
"3" = "res://KennyControllerPrompts/Mouse/mouse_scroll.png",
|
||||
"2" = "res://KennyControllerPrompts/Mouse/mouse_right.png",
|
||||
"4" = "res://KennyControllerPrompts/Mouse/mouse_scroll_up.png",
|
||||
"5" = "res://KennyControllerPrompts/Mouse/mouse_scroll_down.png",
|
||||
}
|
||||
|
@ -10,12 +10,12 @@ var listening_for_key: bool = false
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
for index: int in Data.keymaps.size():
|
||||
var map: PlayerKeymap = Data.keymaps[index]
|
||||
var button: Button = Button.new()
|
||||
button.text = map.title
|
||||
button.pressed.connect(set_keymap.bind(index))
|
||||
$HBoxContainer.add_child(button)
|
||||
#for index: int in Data.keymaps.size():
|
||||
# var map: PlayerKeymap = Data.keymaps[index]
|
||||
# var button: Button = Button.new()
|
||||
# button.text = map.title
|
||||
# button.pressed.connect(set_keymap.bind(index))
|
||||
# $HBoxContainer.add_child(button)
|
||||
load_keybind_labels()
|
||||
|
||||
|
||||
@ -34,34 +34,19 @@ func load_keybind_labels() -> void:
|
||||
var entry: KeybindEntry = keybind_entry_scene.instantiate() as KeybindEntry
|
||||
entry.set_action_name(action)
|
||||
if InputMap.action_get_events(action).size() > 0:
|
||||
entry.set_primary_bind(InputMap.action_get_events(action)[0])
|
||||
if InputMap.action_get_events(action).size() > 1:
|
||||
entry.set_secondary_bind(InputMap.action_get_events(action)[1])
|
||||
for event: InputEvent in InputMap.action_get_events(action):
|
||||
entry.add_bind_button(event)
|
||||
keybind_boxes.append(entry)
|
||||
entry.primary_bind_pressed.connect(_on_primary_keybind_button_pressed.bind(entry))
|
||||
entry.secondary_bind_pressed.connect(_on_secondary_keybind_button_pressed.bind(entry))
|
||||
entry.bind_button_pressed.connect(_on_keybind_button_pressed.bind(entry))
|
||||
$ScrollContainer/VBoxContainer.add_child(entry)
|
||||
|
||||
|
||||
func _on_primary_keybind_button_pressed(keybind_entry: KeybindEntry) -> void:
|
||||
selected_entry = keybind_entry
|
||||
var popup: Control = keybind_popup.instantiate()
|
||||
popup.event_detected.connect(change_primary_key)
|
||||
func _on_keybind_button_pressed(button: Button, keybind_entry: KeybindEntry) -> void:
|
||||
var popup: KeybindPopup = keybind_popup.instantiate()
|
||||
popup.event_detected.connect(keybind_entry.set_button_bind.bind(button))
|
||||
Game.UILayer.add_child(popup)
|
||||
|
||||
|
||||
func _on_secondary_keybind_button_pressed(keybind_entry: KeybindEntry) -> void:
|
||||
selected_entry = keybind_entry
|
||||
var popup: Control = keybind_popup.instantiate()
|
||||
popup.event_detected.connect(change_secondary_key)
|
||||
Game.UILayer.add_child(popup)
|
||||
|
||||
|
||||
func change_primary_key(event: InputEvent) -> void:
|
||||
Data.player_keymap.set_primary_action_event(selected_entry.action_string, event)
|
||||
selected_entry.set_primary_bind(event)
|
||||
|
||||
|
||||
func change_secondary_key(event: InputEvent) -> void:
|
||||
Data.player_keymap.set_secondary_action_event(selected_entry.action_string, event)
|
||||
selected_entry.set_secondary_bind(event)
|
||||
func save() -> void:
|
||||
for entry: KeybindEntry in keybind_boxes:
|
||||
Data.keymap_data.add_binding(entry.to_array())
|
||||
|
68
Scripts/keymap_data.gd
Normal file
68
Scripts/keymap_data.gd
Normal file
@ -0,0 +1,68 @@
|
||||
class_name KeymapData extends RefCounted
|
||||
|
||||
var title: String = "default"
|
||||
var map: Dictionary[String, Array]
|
||||
|
||||
|
||||
func add_binding(bind_array: Array) -> void:
|
||||
var x: int = bind_array.size() - 1
|
||||
var arr: Array
|
||||
for i: int in x:
|
||||
arr.append(bind_array[i + 1])
|
||||
map[bind_array[0][0]] = arr
|
||||
|
||||
|
||||
static func event_from_array(array: Array) -> InputEvent:
|
||||
if array.size() < 2:
|
||||
return null
|
||||
if array[0] == "InputEventKey":
|
||||
var event: InputEventKey = InputEventKey.new()
|
||||
event.physical_keycode = array[1]
|
||||
return event
|
||||
if array[0] == "InputEventMouseButton":
|
||||
var event: InputEventMouseButton = InputEventMouseButton.new()
|
||||
event.button_index = array[1]
|
||||
return event
|
||||
if array[0] == "InputEventJoypadButton":
|
||||
var event: InputEventJoypadButton = InputEventJoypadButton.new()
|
||||
event.button_index = array[1]
|
||||
return event
|
||||
return null
|
||||
|
||||
|
||||
func apply() -> void:
|
||||
for action_string: String in map.keys():
|
||||
InputMap.action_erase_events(action_string)
|
||||
for binding: Array in map[action_string]:
|
||||
var event: InputEvent = event_from_array(binding)
|
||||
if event:
|
||||
InputMap.action_add_event(action_string, event)
|
||||
|
||||
|
||||
func save_to_disc() -> void:
|
||||
var dir: DirAccess = DirAccess.open("user://")
|
||||
if !dir.dir_exists("keymaps"):
|
||||
dir.make_dir("keymaps")
|
||||
var save_file: FileAccess = FileAccess.open("user://keymaps/default", FileAccess.WRITE)
|
||||
var dict: Dictionary = {
|
||||
"title" = title,
|
||||
"map" = map,
|
||||
}
|
||||
var json_string: String = JSON.stringify(dict)
|
||||
save_file.store_line(json_string)
|
||||
|
||||
|
||||
static func load_from_disk() -> KeymapData:
|
||||
if FileAccess.file_exists("user://keymaps/default"):
|
||||
var save_file: FileAccess = FileAccess.open("user://keymaps/default", FileAccess.READ)
|
||||
var json_string: String = save_file.get_line()
|
||||
var json: JSON = JSON.new()
|
||||
var parse_result: Error = json.parse(json_string)
|
||||
if parse_result == OK:
|
||||
var dict: Dictionary = json.data
|
||||
var keymap: KeymapData = KeymapData.new()
|
||||
keymap.title = dict["title"]
|
||||
for key: String in dict["map"].keys():
|
||||
keymap.map[key] = dict["map"][key]
|
||||
return keymap
|
||||
return KeymapData.new()
|
1
Scripts/keymap_data.gd.uid
Normal file
1
Scripts/keymap_data.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://dui1k2e4q6cl
|
@ -12,13 +12,16 @@ func _on_cancel_pressed() -> void:
|
||||
func _on_confirm_pressed() -> void:
|
||||
gameplay.save()
|
||||
graphics.save()
|
||||
keybinds.save()
|
||||
Data.graphics.apply_graphical_settings(get_viewport())
|
||||
Data.graphics.save_profile_to_disk()
|
||||
Data.audio.apply_audio_settings()
|
||||
Data.audio.save_profile_to_disk()
|
||||
Data.preferences.save_profile_to_disk()
|
||||
Data.player_keymap.save_profile_to_disk()
|
||||
Data.player_controller_keymap.append_input_map()
|
||||
Data.keymap_data.apply()
|
||||
Data.keymap_data.save_to_disc()
|
||||
#Data.player_keymap.save_profile_to_disk()
|
||||
#Data.player_controller_keymap.append_input_map()
|
||||
queue_free()
|
||||
|
||||
|
||||
|
@ -1,41 +1,15 @@
|
||||
extends Node
|
||||
|
||||
|
||||
func calculate_spawn_power(wave_number: int, number_of_players: int) -> int:
|
||||
static func calculate_spawn_power(wave_number: int, number_of_players: int) -> int:
|
||||
return (20 * number_of_players) + (5 * wave_number)
|
||||
|
||||
|
||||
func calculate_pot(wave_number: int, number_of_players: int) -> int:
|
||||
return 20 + (50 * number_of_players) + (15 * wave_number)
|
||||
static func calculate_pot(wave_number: int, number_of_players: int) -> int:
|
||||
return ceili((2.5 * number_of_players) + (0.5 * wave_number))
|
||||
|
||||
|
||||
#func generate_wave(spawn_power: int, spawn_pool: Array[Enemy]) -> Dictionary:
|
||||
#var wave: Dictionary = {}
|
||||
##var sp_used = 0
|
||||
#var enemy_types: int = randi_range(1, 5)
|
||||
#var enemy_choices: Array[Enemy] = spawn_pool.duplicate()
|
||||
#var sp_allotment: int = floori(float(spawn_power) / float(enemy_types))
|
||||
#for x: int in enemy_types:
|
||||
#var choice: Enemy = enemy_choices.pick_random()
|
||||
#enemy_choices.erase(choice)
|
||||
#if floori(float(sp_allotment) / float(choice.spawn_power)) > 0:
|
||||
#wave[Data.enemies.find(choice)] = floori(float(sp_allotment) / float(choice.spawn_power))
|
||||
##sp_used += wave[Data.enemies.find(choice)] * choice.spawn_power
|
||||
##print("Generated wave with spawn power: " + str(sp_used) + "/" + str(spawn_power))
|
||||
#return wave
|
||||
|
||||
|
||||
#func generate_wave(spawn_power: int, spawn_pool: Array[Enemy], spawners: Array[EnemySpawner]) -> Wave:
|
||||
#var wave: Wave = Wave.new()
|
||||
#var new_card: EnemyCard = EnemyCard.new()
|
||||
#new_card.enemy = Data.enemies[6]
|
||||
#new_card.rarity = Data.Rarity.COMMON
|
||||
#wave.enemy_groups.append(new_card)
|
||||
#spawners[1].add_card(new_card)
|
||||
#return wave
|
||||
|
||||
|
||||
func generate_wave(spawn_power: int, spawn_pool: Array[Enemy], spawners: Array[EnemySpawner]) -> Wave:
|
||||
static func generate_wave(spawn_power: int, spawn_pool: Array[Enemy], spawners: Array[EnemySpawner]) -> Wave:
|
||||
var wave: Wave = Wave.new()
|
||||
|
||||
var points: int = spawn_power / 10.0
|
||||
|
Reference in New Issue
Block a user