diff --git a/lib/classes/animated_sprite_state_receiver.gd b/lib/classes/animated_sprite_state_receiver.gd index 7c8680f..6216db2 100644 --- a/lib/classes/animated_sprite_state_receiver.gd +++ b/lib/classes/animated_sprite_state_receiver.gd @@ -62,13 +62,13 @@ func _on_animation_finished(): if animation_index >= current_state.animation_sequence.size(): #print("Stop!!!!!") current_state.animation_finished = true - # TODO: Allow a way to stop animation even if in a looped sequence + ##TODO: Allow a way to stop animation even if in a looped sequence # If called, this will attempt to make the most appropriate animation change # would likely be triggered from an animation sequence finishing or a # modifier being applied/removed outside of enter/exit transitions. func change_animation(enter_frame := 0, index := 0, suffix := ''): - ## TODO: + ##TODO: # Need to find a way to attempt to keep and transfer the Index or frame if modifier: #print("hey you got one! -> ", modifier.animation_name) @@ -90,7 +90,7 @@ func change_animation(enter_frame := 0, index := 0, suffix := ''): current_animation_sequence = animation_index if modifier: - #TODO: Apply the animation starting frame + ##TODO: Apply the animation starting frame #modifier.animation_starting_frame match modifier.modifier_type: modifier.TYPE.ANIMATION_SUFFIX: @@ -157,7 +157,7 @@ func change_animation(enter_frame := 0, index := 0, suffix := ''): play(mod_animation_sequence[animation_index] + '-' + animation_suffix) else: play(mod_animation_sequence[animation_index]) - #TODO: maybe check current animatio has this frame + ##TODO: maybe check current animation has this frame if enter_frame != 0: print ("alternate starting frame:", enter_frame) frame = enter_frame @@ -197,7 +197,7 @@ func change_animation(enter_frame := 0, index := 0, suffix := ''): stop() #animation_finished = true elif mod_animation_sequence.size() > animation_index and current_animation_sequence != animation_index: - #TODO: why was I doing this + ##TODO: why was I doing this before? Firgure out why? # if animation_index >= mod_animation_sequence.size(): # animation_index = 0 ##TODO: Add a safety check here. @@ -209,7 +209,7 @@ func change_animation(enter_frame := 0, index := 0, suffix := ''): ##TODO: Could probably add some more checks here. # Singal based frame call. - #TODO: reimplement this later. + ##TODO: reimplement frame subscriptions like this later. # if emitter_frame_subscriptions.has(animations.frame): # if emitter_frame_subscriptions[animations.frame] == animations.animation: # if frame_signal_emitted == false: @@ -225,7 +225,9 @@ func _on_state_change(old_state_name:String, new_state :State): #print ("1? got the state change signal ", new_state.name) # set current state to new_state previous_state_name = old_state_name - #TODO: Confirm that this is a reference to the state in the + ##TODO: Confirm theres no need to keep resetting the state + ## because it is always a reference to the state machine's current_state. + ## this has been working fine but could cause issues if I assume otherwise. ###### State machine if new_state is StateAnimatedActor: #Testing this. Update: It works current_state = new_state diff --git a/lib/classes/collision_shape2D_state_receiver.gd b/lib/classes/collision_shape2D_state_receiver.gd index f364a8d..cbc1ae6 100644 --- a/lib/classes/collision_shape2D_state_receiver.gd +++ b/lib/classes/collision_shape2D_state_receiver.gd @@ -33,7 +33,8 @@ func _ready(): parent = get_parent() default_shape = shape.duplicate() - ##TODO: Are transforms primitives? Do they get passed by value? + ##DONE: Are transforms primitives? Do they get passed by value? + ## Transforms are passed by value. default_transform = transform diff --git a/lib/classes/movement_state_receiver.gd b/lib/classes/movement_state_receiver.gd index 1007a69..420dda3 100644 --- a/lib/classes/movement_state_receiver.gd +++ b/lib/classes/movement_state_receiver.gd @@ -125,9 +125,6 @@ func get_climb_shape_location() -> Vector2: return Vector2(-1,-1) func _on_state_change(old_state_name:String, new_state :State): - #print ("got the state change signal (MC) ", new_state.name) - # set current state to new_state - #TODO: Confirm that this is a reference to the state in the ###### State machine if new_state is StateAnimatedActor: #Testing this. Update: It works current_state = new_state diff --git a/lib/classes/state.gd b/lib/classes/state.gd index ff769f9..5b1cf92 100644 --- a/lib/classes/state.gd +++ b/lib/classes/state.gd @@ -35,7 +35,7 @@ func setup(): state_timeout.autostart = false #add_child(state_timeout) #get_tree().get_root().add_child(state_timeout) - #TODO: Need to figure out how to add this to tree + ##DONE: Need to figure out how to add this to tree #modifier = StateModifier.new() #Hopefully this passes by reference. diff --git a/lib/classes/state_animated_actor.gd b/lib/classes/state_animated_actor.gd index dc6ca42..122338a 100644 --- a/lib/classes/state_animated_actor.gd +++ b/lib/classes/state_animated_actor.gd @@ -3,14 +3,12 @@ extends State ## Animation and movement state class ## ## A state intended to control the movement and animation -## functions of a KinimaticBody2D node. Initialized with a -## player, movement node, and kinematicbody2d -## I think if we also had modifier states that transfered along with the enter and entrance of nodes, that would be helpful. +## functions of a KinimaticBody2D node. ## ## @WIP # Movement Speed in Pixels Per Second -# The b +# The base movement speed and accelleration export var horizontal_speed: float = 60 export var horizontal_acceleration: float = 0 ## Movement Speed Offsets (Positive or Negative) @@ -19,9 +17,9 @@ export var horizontal_speed_offset: float = 0 export var horizontal_speed_offset_acceleration: float = 0 export var jerk_factor: float = 0 +## Default state gravity is the project's gravity var gravity: int = ProjectSettings.get_setting("physics/2d/default_gravity") -#var adjusted_move_speed: float var jerk: float ## Variables intended to allow state receivers to communicate @@ -43,16 +41,3 @@ func enter() -> void: return -#func transfer_modifiers(exiting_state_modifier : StateModifier): -# if modifier == null: # We have no existing modifier applied. -# match exiting_state_modifier.modifier_type: -# exiting_state_modifier.TYPE.ANIMATION_SUFFIX: -# if debug_state: -# print("Transferring Animation Suffix") -# modifier = exiting_state_modifier -# exiting_state_modifier.TYPE.EXIT_ANIMATION: -# if debug_state: -# print("Exit Animation: well this was useless.") -# else: -# print("Insert modifier merge function here...") - diff --git a/lib/classes/state_machine.gd b/lib/classes/state_machine.gd index c7c5928..17095dc 100644 --- a/lib/classes/state_machine.gd +++ b/lib/classes/state_machine.gd @@ -1,12 +1,7 @@ class_name StateMachine extends Node -#export (NodePath) var starting_state export var debug_state_machine: bool = false -# I guess I would declare a number of states here -#export (Reference) var states # Doesn't work -#var starting_state: State - signal state_changed(old_state_name, new_state) signal modifiers_updated(modifier_type, modifier_eventid) @@ -19,10 +14,6 @@ export var starting_state_name = 'default' export(Array,Resource) var states var states_index :Dictionary -# Initialize the state machine by giving each child state a reference to the -# parent object it belongs to and enter the default starting_state. -#func _init() -> void: -# print ("init state machine.") func _ready(): if debug_state_machine: @@ -102,7 +93,7 @@ func change_to_known_state(new_state_name: String) -> void: rpc("puppet_change_to_known_state", new_state_name) #func check_parent_before_state_change(new_state_name: String) -> bool: -# ##TODO: Make this a verifiable funcref or something +# ##CANCELLED: Make this a verifiable funcref or something # if get_parent().has_method("check_state_change"): # var _check_result = get_parent().check_state_change(new_state_name) # if _check_result: diff --git a/lib/classes/state_modifier_animation.gd b/lib/classes/state_modifier_animation.gd index 381b567..8130eae 100644 --- a/lib/classes/state_modifier_animation.gd +++ b/lib/classes/state_modifier_animation.gd @@ -38,7 +38,7 @@ func copy_StateModifierAnimatedActor(_copy_state: StateModifierAnimatedActor): _copy_state.animation_starting_frame = animation_starting_frame _copy_state.animation_speed = animation_speed - #TODO: finish these + ##TODO: finish these _copy_state.horizontal_speed = horizontal_speed _copy_state.horizontal_acceleration = horizontal_acceleration diff --git a/lib/components/Hitbox_Component.gd b/lib/components/Hitbox_Component.gd index 9a50b28..124e6b2 100644 --- a/lib/components/Hitbox_Component.gd +++ b/lib/components/Hitbox_Component.gd @@ -6,7 +6,7 @@ func set_hitbox(enabled: bool): for child in get_children(): if child is CollisionShape2D: child.set_deferred("disabled", !enabled) - ## TODO: This breaks now I guess because I moved the process functions out to parent class + ##TODO: This breaks now I guess because I moved the process functions out to parent class #player_hurtbox.set_deferred("disabled", !enabled) #WTF Apparently this is how to do it diff --git a/lib/templates/Actor/states/fall.gd b/lib/templates/Actor/states/fall.gd deleted file mode 100644 index b6750ad..0000000 --- a/lib/templates/Actor/states/fall.gd +++ /dev/null @@ -1,19 +0,0 @@ -extends StateAnimatedActor - -export (NodePath) var idle_node - -onready var idle_state: State = get_node(idle_node) - -func process_physics(delta: float) -> State: - #parent.velocity.y += gravity * delta - move_component.velocity.y += gravity * delta - - move_component.velocity.x = move_component.desired_movement_vector.x * move_speed - move_component.velocity = parent.move_and_slide(move_component.velocity, Vector2(0, -1)) - - if move_component.get_movement_direction() != 0.0: - parent.transform.x.x = move_component.get_movement_direction() - - if parent.is_on_floor(): - return idle_state - return null diff --git a/lib/templates/Actor/states/idle.gd b/lib/templates/Actor/states/idle.gd deleted file mode 100644 index ae16522..0000000 --- a/lib/templates/Actor/states/idle.gd +++ /dev/null @@ -1,28 +0,0 @@ -extends StateAnimatedActor - -# Do states need to have references to the states they want to transition -# to? I suppose if on exit/entrance we needed to do something - -func enter() -> void: - #.enter() -# parent.set_hurtbox(true) - move_component.velocity.x = 0 - print ("this doesn't work does it? ") -# if debug_state: -# print(owner.name, " Move Component: ", move_component.desired_movement_vector.x) - -func process_physics(delta: float) -> String: - return '' -# parent.velocity.y += gravity * delta -# #parent.velocity = parent.move_and_slide(parent.velocity, Vector2(0, -1)) -# parent.velocity.x = move_component.desired_movement_vector.x * move_speed -# parent.velocity = parent.move_and_slide(parent.velocity, Vector2(0, -1)) - - move_actor_as_desired(delta) - - if move_component.velocity.x != 0.0: - return 'move' - - if !parent.is_on_floor(): - return 'fall' - return '' diff --git a/lib/templates/Actor/states/idle.tres b/lib/templates/Actor/states/idle.tres deleted file mode 100644 index 0014cb2..0000000 --- a/lib/templates/Actor/states/idle.tres +++ /dev/null @@ -1,17 +0,0 @@ -[gd_resource type="Resource" load_steps=2 format=2] - -[ext_resource path="res://lib/templates/Actor/states/idle.gd" type="Script" id=1] - -[resource] -resource_local_to_scene = true -script = ExtResource( 1 ) -debug_state = false -timeout_seconds = 0.0 -move_speed = 60.0 -move_acceleration = 20.0 -move_speed_modifier = 0.0 -move_modifier_move_acceleration = 0.0 -jerk_factor = 0.0 -animation_sequence = [ "idle" ] -emitter_frame_subscriptions = { -} diff --git a/lib/templates/Actor/states/move.gd b/lib/templates/Actor/states/move.gd deleted file mode 100644 index f93dab5..0000000 --- a/lib/templates/Actor/states/move.gd +++ /dev/null @@ -1,21 +0,0 @@ -extends StateAnimatedActor - -export (NodePath) var fall_node -export (NodePath) var idle_node - -onready var fall_state: State = get_node(fall_node) -onready var idle_state: State = get_node(idle_node) - -func process_physics(delta: float) -> State: - - move_actor_as_desired(delta) - - if move_component.velocity.x == 0.0: - return idle_state - - #Flip the character before tha actual move maybe. - parent.transform.x.x = move_component.get_movement_direction() - - if !parent.is_on_floor(): - return fall_state - return null diff --git a/src/actors/players/playerE/PlayerE-Movement_StateReceiver.gd b/src/actors/players/playerE/PlayerE-Movement_StateReceiver.gd index 10e4772..d07e581 100644 --- a/src/actors/players/playerE/PlayerE-Movement_StateReceiver.gd +++ b/src/actors/players/playerE/PlayerE-Movement_StateReceiver.gd @@ -15,7 +15,7 @@ func _ready(): var state_name :String state_name = 'jump' state_ref = get_node(callable_state_machine).get_state_reference(state_name) - #TODO Should probably assert here or something. + ##TODO Should probably assert here or something. state_ref.connect("state_entered", self, "_on_state_entered_" + state_name) parent_request_state_change = funcref(get_node(callable_state_machine), 'check_parent_before_state_change') @@ -101,7 +101,7 @@ func wants_climb() -> bool: _wants_climb = false return false -#TODO: This is probably not a good way to do this. +##DONE: This is probably not a good way to do this. # we want to check input once and make decisions based on # velocity and desired movement. #func _state_process_physics_input_idle(): @@ -137,7 +137,7 @@ func _state_process_physics_idle(): if _wants_crouch == true: request_state_change.call_func('crouch') - #TODO: May need that 'bump' logic to make velocity work. + ##TODO: May need that 'bump' logic to make velocity work. if desired_movement_vector.x != 0: # and velocity.x != 0: request_state_change.call_func('move') @@ -431,7 +431,7 @@ func _state_process_physics_crouch_move(): func _on_state_entered_jump(): print ("how many times do I get called?") - #TODO: Make this a state variable + ##TODO: Make this a state export variable # I used to call it 'jump_force' like an idiot. velocity.y = -200 diff --git a/src/actors/players/playerE/PlayerE.gd b/src/actors/players/playerE/PlayerE.gd index a1af052..ee404eb 100644 --- a/src/actors/players/playerE/PlayerE.gd +++ b/src/actors/players/playerE/PlayerE.gd @@ -131,7 +131,7 @@ func enough_stamina_for(_state_name :String) -> bool: -##TODO: We need to find a way to 'use' the item. +##DONE: We need to find a way to 'use' the item. func use_primary_item() -> String: if player_inventory.primary_selection != null: # Have to make sure we even have a second var _item_name :String = player_inventory.primary_selection.name @@ -143,7 +143,7 @@ func use_primary_item() -> String: player_inventory.remove_from_inventory(player_inventory.primary_selection) return state_to_item_map[_item_name] else: - ## TODO: maybe some sort of 'fail' animation state + ##TODO: maybe some sort of 'fail' animation state #print("Nope: ", state_stamina_cost[state_name], "<=", stamina_component.stamina) return '' ## you can't use this ## use item even if no stamina usage needed for it.