2023-07-25 14:21:10 +09:30
|
|
|
extends Node2D
|
|
|
|
|
|
|
|
var PC = load('PC.tscn')
|
|
|
|
var PCs = []
|
|
|
|
var sfx_buttons = []
|
|
|
|
|
|
|
|
func _ready():
|
|
|
|
Engine.set_target_fps(60)
|
2023-07-25 16:33:45 +09:30
|
|
|
var strips = len(SpriteLoader.strip_textures) # * 4 / 5
|
2023-07-25 14:21:10 +09:30
|
|
|
#var strip_divide = strips * 2 / 5
|
|
|
|
var strip_divide = strips * 1 / 5
|
|
|
|
for i in strips:
|
|
|
|
PCs.append(PC.instance())
|
|
|
|
#PCs[-1].set_position(Vector2((i%strip_divide)*16, (i/strip_divide)*24*11))
|
|
|
|
PCs[-1].set_position(Vector2((i%strip_divide)*24, (i/strip_divide)*32))
|
2023-07-25 16:33:45 +09:30
|
|
|
PCs[-1].material.set_shader_param('palette', SpriteLoader.character_battle_sprite_palette_textures[i])
|
|
|
|
PCs[-1].texture = SpriteLoader.strip_textures[i]
|
2023-07-25 14:21:10 +09:30
|
|
|
|
|
|
|
add_child(PCs[-1])
|
|
|
|
# PCs.append(PC.instance())
|
|
|
|
# PCs[-1].set_position(Vector2(0, 2*24*11))
|
2023-07-25 16:33:45 +09:30
|
|
|
# PCs[-1].material.set_shader_param('palette', SpriteLoader.character_battle_sprite_palette_textures[45])
|
|
|
|
# PCs[-1].texture = SpriteLoader.weapon_textures['Fist']
|
2023-07-25 14:21:10 +09:30
|
|
|
# add_child(PCs[-1])
|
2023-07-26 21:52:54 +09:30
|
|
|
_create_sfx_buttons()
|
2023-07-25 14:21:10 +09:30
|
|
|
|
2023-07-26 21:52:54 +09:30
|
|
|
|
|
|
|
func _create_sfx_buttons():
|
|
|
|
var disable_btn := !SoundLoader.has_loaded_audio_samples
|
|
|
|
if disable_btn:
|
|
|
|
SoundLoader.connect('audio_samples_loaded', self, '_enable_sfx_buttons')
|
2023-07-25 14:21:10 +09:30
|
|
|
for i in SoundLoader.INST_NUM:
|
|
|
|
var btn = Button.new()
|
|
|
|
btn.text = 'Play #%02X' % i
|
|
|
|
btn.align = Button.ALIGN_CENTER
|
2023-07-25 16:33:45 +09:30
|
|
|
btn.set_position(Vector2((i%8)*36, 200 + (i/8)*12))
|
2023-07-25 14:21:10 +09:30
|
|
|
btn.set_scale(Vector2(0.5, 0.5))
|
|
|
|
add_child(btn)
|
|
|
|
btn.connect('pressed', SoundLoader, 'play_sample', [i])
|
|
|
|
sfx_buttons.append(btn)
|
2023-07-26 21:52:54 +09:30
|
|
|
btn.disabled = disable_btn
|
2023-07-25 14:21:10 +09:30
|
|
|
for i in SoundLoader.SFX_NUM:
|
|
|
|
var btn = Button.new()
|
|
|
|
btn.text = 'SFX #%02X' % i
|
|
|
|
btn.align = Button.ALIGN_CENTER
|
2023-07-25 16:33:45 +09:30
|
|
|
btn.set_position(Vector2((i%8)*36, 264 + (i/8)*12))
|
2023-07-25 14:21:10 +09:30
|
|
|
btn.set_scale(Vector2(0.5, 0.5))
|
|
|
|
add_child(btn)
|
|
|
|
btn.connect('pressed', SoundLoader, 'play_sfx', [i])
|
|
|
|
sfx_buttons.append(btn)
|
2023-07-26 21:52:54 +09:30
|
|
|
btn.disabled = disable_btn
|
2023-07-25 14:21:10 +09:30
|
|
|
|
2023-07-26 21:52:54 +09:30
|
|
|
func _enable_sfx_buttons():
|
|
|
|
for btn in sfx_buttons:
|
|
|
|
btn.disabled = false
|
2023-07-25 14:21:10 +09:30
|
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
|
|
#func _process(delta):
|
|
|
|
# update()
|
|
|
|
# pass
|
|
|
|
|
|
|
|
|
|
|
|
func _on_OptionButton_item_selected(ID):
|
|
|
|
for pc in PCs:
|
|
|
|
pc.animation = ID
|