implement texture switching and adding thank-you prompt #2
|
|
@ -2,6 +2,7 @@ extends Draggable
|
||||||
class_name Card
|
class_name Card
|
||||||
|
|
||||||
var card_id : StringName
|
var card_id : StringName
|
||||||
|
var from_youth: bool
|
||||||
|
|
||||||
enum burned {
|
enum burned {
|
||||||
NOT,
|
NOT,
|
||||||
|
|
@ -141,6 +142,8 @@ func init(card_name: String = "card", own_id:StringName = "-1") -> void:
|
||||||
push_error("Illegal card!", card_name, own_id)
|
push_error("Illegal card!", card_name, own_id)
|
||||||
card_id = own_id
|
card_id = own_id
|
||||||
name = card_name
|
name = card_name
|
||||||
|
# first digit of the card id is 0-3 for youth cards.
|
||||||
|
from_youth = (card_id as String)[0] as int < 4
|
||||||
|
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
|
|
@ -154,6 +157,14 @@ func _ready():
|
||||||
|
|
||||||
func _on_text_updated():
|
func _on_text_updated():
|
||||||
if is_node_ready() and name != "c_void" and name != "3.c_void":
|
if is_node_ready() and name != "c_void" and name != "3.c_void":
|
||||||
|
if from_youth:
|
||||||
|
if State.current_room == State.rooms.YOUTH or State.onready_room == State.rooms.YOUTH:
|
||||||
|
background_sprite.animation = "youth"
|
||||||
|
else:
|
||||||
|
background_sprite.animation = "aged"
|
||||||
|
else:
|
||||||
|
background_sprite.animation = "adult"
|
||||||
|
|
||||||
var curr_frame := text.hash() % background_sprite.sprite_frames.get_frame_count(background_sprite.animation)
|
var curr_frame := text.hash() % background_sprite.sprite_frames.get_frame_count(background_sprite.animation)
|
||||||
background_sprite.frame = curr_frame
|
background_sprite.frame = curr_frame
|
||||||
|
|
||||||
|
|
@ -168,7 +179,11 @@ func _on_text_updated():
|
||||||
|
|
||||||
wiggle_pos = float(text.hash() % 100)
|
wiggle_pos = float(text.hash() % 100)
|
||||||
|
|
||||||
|
# the adult cards are more straight.
|
||||||
|
if from_youth:
|
||||||
label.rotation = deg_to_rad(transfor_arr[curr_frame].get_rotation())
|
label.rotation = deg_to_rad(transfor_arr[curr_frame].get_rotation())
|
||||||
|
else:
|
||||||
|
label.rotation = 0.0
|
||||||
#label.position = transfor_arr[curr_frame].origin
|
#label.position = transfor_arr[curr_frame].origin
|
||||||
|
|
||||||
burn_progress = burn_progress
|
burn_progress = burn_progress
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
extends Draggable
|
extends Draggable
|
||||||
class_name StickyNote
|
class_name StickyNote
|
||||||
|
|
||||||
var sticky_id
|
var sticky_id: StringName
|
||||||
var parent_id : StringName
|
var parent_id: StringName
|
||||||
|
var from_youth: bool
|
||||||
|
|
||||||
var sibling: StickyNote
|
var sibling: StickyNote
|
||||||
var shift_tween: Tween
|
var shift_tween: Tween
|
||||||
|
|
@ -70,6 +71,9 @@ func init(sticky_name: String = "sticky_note", card_id: StringName = "-1") -> vo
|
||||||
parent_id = StringName(card_id.rsplit(".", false, 1)[0])
|
parent_id = StringName(card_id.rsplit(".", false, 1)[0])
|
||||||
sticky_id = card_id
|
sticky_id = card_id
|
||||||
|
|
||||||
|
# first digit of the card id is 0-3 for youth cards.
|
||||||
|
from_youth = (card_id as String)[0] as int < 4
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
super._ready()
|
super._ready()
|
||||||
label = $Content/Label
|
label = $Content/Label
|
||||||
|
|
@ -81,6 +85,15 @@ func _ready() -> void:
|
||||||
|
|
||||||
func _on_text_updated():
|
func _on_text_updated():
|
||||||
label.text = text
|
label.text = text
|
||||||
|
|
||||||
|
if from_youth:
|
||||||
|
if State.current_room == State.rooms.YOUTH or State.onready_room == State.rooms.YOUTH:
|
||||||
|
background_sprite.animation = "youth"
|
||||||
|
else:
|
||||||
|
background_sprite.animation = "aged"
|
||||||
|
else:
|
||||||
|
background_sprite.animation = "adult"
|
||||||
|
|
||||||
background_sprite.frame = text.hash() % background_sprite.sprite_frames.get_frame_count(background_sprite.animation)
|
background_sprite.frame = text.hash() % background_sprite.sprite_frames.get_frame_count(background_sprite.animation)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue