ChocolateBird/test/battle_sprites.gd

26 lines
928 B
GDScript3
Raw Normal View History

extends Control
2023-07-28 00:17:03 +09:30
var PC = load('res://PC.tscn')
var PCs = []
func _ready() -> void:
var strips = len(SpriteLoader.strip_textures) # * 4 / 5
#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)*17, (i/strip_divide)*32))
2023-07-28 00:17:03 +09:30
PCs[-1].material.set_shader_param('palette', SpriteLoader.character_battle_sprite_palette_textures[i])
PCs[-1].texture = SpriteLoader.strip_textures[i]
add_child(PCs[-1])
# PCs.append(PC.instance())
# PCs[-1].set_position(Vector2(0, 2*24*11))
# PCs[-1].material.set_shader_param('palette', SpriteLoader.character_battle_sprite_palette_textures[45])
# PCs[-1].texture = SpriteLoader.weapon_textures['Fist']
# add_child(PCs[-1])
func _on_OptionButton_item_selected(ID):
for pc in PCs:
pc.animation = ID