46 lines
1.7 KiB
GDScript3
46 lines
1.7 KiB
GDScript3
|
|
class_name EvilCoco
|
||
|
|
extends SpineSprite
|
||
|
|
|
||
|
|
@export var time_scale: float = 1.0
|
||
|
|
@onready var animation_state: SpineAnimationState = get_animation_state()
|
||
|
|
@onready var crosshair_bone: SpineBoneNode = $CrosshairBone
|
||
|
|
var bounceS = GDRx.on_input_as_observable(self)\
|
||
|
|
.filter(func(event): return event is InputEventMouseButton)\
|
||
|
|
.subscribe(start_bounce)\
|
||
|
|
.dispose_with(self)
|
||
|
|
var crosshairS = GDRx.on_process_as_observable(self)\
|
||
|
|
.debounce(1)\
|
||
|
|
.subscribe(crosshair)\
|
||
|
|
.dispose_with(self)
|
||
|
|
|
||
|
|
func _ready() -> void:
|
||
|
|
animation_state.set_animation("idle", true)
|
||
|
|
animation_state.set_time_scale(time_scale)
|
||
|
|
Globals.evil_coco = self
|
||
|
|
#Input.set_custom_mouse_cursor(load("res://assets/bitmaps/icon.png"))
|
||
|
|
|
||
|
|
func crosshair(_delta):
|
||
|
|
crosshair_bone.global_position = get_viewport().get_mouse_position()
|
||
|
|
|
||
|
|
func start_bounce(event: InputEvent) -> void:
|
||
|
|
#if OS.get_name() == "HTML5":
|
||
|
|
#OS.shell_open("https://example.com")
|
||
|
|
#var e: InputEventMouseButton = event
|
||
|
|
animation_state.set_animation("animation", true)
|
||
|
|
bounceS.dispose()
|
||
|
|
|
||
|
|
func set_skin(skin_choice: Globals.SkinChoices) -> void:
|
||
|
|
#var a = Globals.SkinChoices.find_key(skin_choice)
|
||
|
|
var slot: SpineSlot = self.get_skeleton().find_slot("glasses")
|
||
|
|
var attch: SpineAttachment = self.get_skeleton().get_attachment_by_slot_name("glasses", "nv_device")
|
||
|
|
slot.set_attachment(attch)
|
||
|
|
#var slots: Array = self.get_skeleton().get_slots()
|
||
|
|
#var skin = self.new_skin("default")
|
||
|
|
##for slot: SpineSlot in slots:
|
||
|
|
##print(slot.get_sequence_index(), " ", slot.get_attachment_state())
|
||
|
|
##var skin: SpineSkin = self.get_skeleton().get_skin()
|
||
|
|
#for key in Globals.current_choices:
|
||
|
|
#var a = skin.find_attachments_for_slot(key)
|
||
|
|
#print(a)
|
||
|
|
#print(skin.find_names_for_slot(slot.get_sequence_index()))
|