diff --git a/src/Camera2D.gd b/src/Camera2D.gd index cf29142..9c1f659 100644 --- a/src/Camera2D.gd +++ b/src/Camera2D.gd @@ -4,6 +4,7 @@ extends Camera2D # Declare member variables here. Examples: # var a = 2 # var b = "text" +export var debug_component :bool = false var game_size := Vector2(320,180) onready var window_scale :float = (OS.window_size / game_size).x @@ -66,12 +67,12 @@ func _process(delta): #global_position = actual_cam_pos.round() - - UiManager.debug_text = ("SP: " + str(cam_subpixel_pos.snapped(Vector2(0.01,0.01))) + - "\nCP: " + str (global_position.snapped(Vector2(0.1,0.1))) + - "\nTP: " + str(tracking_pos) + - "\nDT: " + str(distance_to) - ) + if debug_component: + UiManager.debug_text = ("SP: " + str(cam_subpixel_pos.snapped(Vector2(0.01,0.01))) + + "\nCP: " + str (global_position.snapped(Vector2(0.1,0.1))) + + "\nTP: " + str(tracking_pos) + + "\nDT: " + str(distance_to) + ) ## The original Algo diff --git a/src/Main.gd b/src/Main.gd index 93a35ed..b314c30 100644 --- a/src/Main.gd +++ b/src/Main.gd @@ -5,6 +5,7 @@ extends Node2D # var a = 2 # var b = "text" export var starting_level: PackedScene +export var debug_singletons :bool = false # Called when the node enters the scene tree for the first time. diff --git a/src/actors/players/playerD/Player.gd b/src/actors/players/playerD/Player.gd deleted file mode 100644 index 5157bc4..0000000 --- a/src/actors/players/playerD/Player.gd +++ /dev/null @@ -1,75 +0,0 @@ -extends Actor - -export var player_number: int = 1 - -onready var player_hurtbox = $Hurtbox_Component/CollisionShape2D - -# Removing gun for now -#onready var gun = $Gun - - -func _ready() -> void: - PlayerInfo.player_health = $Health_Component.health - - # Disabled for testing - #global_position = LevelInfo.player_start_position.transform.origin - movement_component.player_number = player_number - - -var portrait = preload("res://assets/MManPortrait.png") - - -func hit_Receiver(damage): - $Hurtbox_Component.set_hurtbox(false) - $Health_Component.take_damage(damage) - if $Health_Component.health > 0: - movement_state_machine.change_state($movement_state_machine/hurt) - PlayerInfo.player_health = $Health_Component.health - if PlayerInfo.player_health <= 0: - return - yield( get_tree().create_timer(2 + $movement_state_machine/hurt.timeout_seconds), "timeout") - $Hurtbox_Component.set_hurtbox(true) - -func receive_modifier(incomming_modifier :StateModifier, is_adding_modifier_operation: bool): - #var mod :StateModifier - if is_adding_modifier_operation: - print("Player Received modifier:", incomming_modifier.name) - if movement_state_machine.current_state is StateAnimatedActor: - movement_state_machine.current_state.physics_modifier = incomming_modifier - else: - print("Player Removed modifier:", incomming_modifier.name) - if movement_state_machine.current_state is StateAnimatedActor: - movement_state_machine.current_state.physics_modifier = null - -func touch_the_thing(the_thing: Interactable) -> bool: - print("You see! a THING...", the_thing.name) - if the_thing is HealthPickup: - # Do some healthy stuff. - the_thing.trigger_interaction() - return false - return true - -func _on_attack_do_attack(): - var is_shooting = false - print("Direction: ", transform.x.x) - # Gun removed for now - #is_shooting = gun.shoot(int(transform.x.x)) - - - -func _on_Health_Component_health_depleted(): - $Hurtbox_Component.set_hurtbox(false) - movement_state_machine.change_state($movement_state_machine/die) - yield( get_tree().create_timer(10), "timeout") - #queue_free() - -func _on_roll_frame_reached(state_name, animation_name, frame_number): - print("I'm invincible!!!") - $Hurtbox_Component.set_hurtbox(false) - -func _on_roll_state_exited(): - print("Nevermind. I'm vulnerable.") - $Hurtbox_Component.set_hurtbox(true) - -func _on_die_state_entered(): - pass # Replace with function body. diff --git a/src/actors/players/playerD/Player.tscn b/src/actors/players/playerD/Player.tscn deleted file mode 100644 index 2aef7cf..0000000 --- a/src/actors/players/playerD/Player.tscn +++ /dev/null @@ -1,597 +0,0 @@ -[gd_scene load_steps=116 format=2] - -[ext_resource path="res://lib/parent_scenes/actor.tscn" type="PackedScene" id=1] -[ext_resource path="res://src/actors/players/playerD/movement_component.gd" type="Script" id=2] -[ext_resource path="res://src/actors/players/playerD/Player.gd" type="Script" id=3] -[ext_resource path="res://lib/components/Health_Component.tscn" type="PackedScene" id=7] -[ext_resource path="res://lib/components/Modifier_Receiver.tscn" type="PackedScene" id=9] -[ext_resource path="res://lib/templates/Interactable/Interactable_Receiver.gd" type="Script" id=16] - -[sub_resource type="RectangleShape2D" id=197] -extents = Vector2( 13, 18.5 ) - -[sub_resource type="StreamTexture" id=90] -load_path = "res://.import/Mega.png-398a010e8e27ac84fe3335706e03da1e.stex" - -[sub_resource type="AtlasTexture" id=91] -atlas = SubResource( 90 ) -region = Rect2( 1680, 960, 240, 160 ) - -[sub_resource type="AtlasTexture" id=92] -atlas = SubResource( 90 ) -region = Rect2( 1920, 960, 240, 160 ) - -[sub_resource type="AtlasTexture" id=93] -atlas = SubResource( 90 ) -region = Rect2( 2160, 960, 240, 160 ) - -[sub_resource type="AtlasTexture" id=94] -atlas = SubResource( 90 ) -region = Rect2( 2400, 960, 240, 160 ) - -[sub_resource type="AtlasTexture" id=95] -atlas = SubResource( 90 ) -region = Rect2( 0, 1120, 240, 160 ) - -[sub_resource type="AtlasTexture" id=96] -atlas = SubResource( 90 ) -region = Rect2( 240, 1120, 240, 160 ) - -[sub_resource type="AtlasTexture" id=97] -atlas = SubResource( 90 ) -region = Rect2( 1440, 960, 240, 160 ) - -[sub_resource type="AtlasTexture" id=98] -atlas = SubResource( 90 ) -region = Rect2( 480, 1120, 240, 160 ) - -[sub_resource type="AtlasTexture" id=99] -atlas = SubResource( 90 ) -region = Rect2( 480, 160, 240, 160 ) - -[sub_resource type="AtlasTexture" id=100] -atlas = SubResource( 90 ) -region = Rect2( 720, 160, 240, 160 ) - -[sub_resource type="AtlasTexture" id=101] -atlas = SubResource( 90 ) -region = Rect2( 960, 160, 240, 160 ) - -[sub_resource type="AtlasTexture" id=102] -atlas = SubResource( 90 ) -region = Rect2( 1200, 160, 240, 160 ) - -[sub_resource type="AtlasTexture" id=103] -atlas = SubResource( 90 ) -region = Rect2( 1440, 160, 240, 160 ) - -[sub_resource type="AtlasTexture" id=104] -atlas = SubResource( 90 ) -region = Rect2( 240, 1440, 240, 160 ) - -[sub_resource type="AtlasTexture" id=105] -atlas = SubResource( 90 ) -region = Rect2( 480, 1440, 240, 160 ) - -[sub_resource type="AtlasTexture" id=106] -atlas = SubResource( 90 ) -region = Rect2( 720, 1440, 240, 160 ) - -[sub_resource type="AtlasTexture" id=107] -atlas = SubResource( 90 ) -region = Rect2( 960, 1440, 240, 160 ) - -[sub_resource type="AtlasTexture" id=108] -atlas = SubResource( 90 ) -region = Rect2( 1200, 1440, 240, 160 ) - -[sub_resource type="AtlasTexture" id=109] -atlas = SubResource( 90 ) -region = Rect2( 1440, 1440, 240, 160 ) - -[sub_resource type="AtlasTexture" id=110] -atlas = SubResource( 90 ) -region = Rect2( 1680, 1440, 240, 160 ) - -[sub_resource type="AtlasTexture" id=111] -atlas = SubResource( 90 ) -region = Rect2( 1920, 1440, 240, 160 ) - -[sub_resource type="AtlasTexture" id=112] -atlas = SubResource( 90 ) -region = Rect2( 2160, 1440, 240, 160 ) - -[sub_resource type="AtlasTexture" id=113] -atlas = SubResource( 90 ) -region = Rect2( 2400, 1440, 240, 160 ) - -[sub_resource type="AtlasTexture" id=114] -atlas = SubResource( 90 ) -region = Rect2( 0, 1600, 240, 160 ) - -[sub_resource type="AtlasTexture" id=115] -atlas = SubResource( 90 ) -region = Rect2( 960, 960, 240, 160 ) - -[sub_resource type="AtlasTexture" id=116] -atlas = SubResource( 90 ) -region = Rect2( 1200, 960, 240, 160 ) - -[sub_resource type="AtlasTexture" id=117] -atlas = SubResource( 90 ) -region = Rect2( 1200, 0, 240, 160 ) - -[sub_resource type="AtlasTexture" id=118] -atlas = SubResource( 90 ) -region = Rect2( 0, 0, 240, 160 ) - -[sub_resource type="AtlasTexture" id=119] -atlas = SubResource( 90 ) -region = Rect2( 1440, 0, 240, 160 ) - -[sub_resource type="AtlasTexture" id=120] -atlas = SubResource( 90 ) -region = Rect2( 1680, 0, 240, 160 ) - -[sub_resource type="AtlasTexture" id=121] -atlas = SubResource( 90 ) -region = Rect2( 1920, 0, 240, 160 ) - -[sub_resource type="AtlasTexture" id=122] -atlas = SubResource( 90 ) -region = Rect2( 2160, 0, 240, 160 ) - -[sub_resource type="AtlasTexture" id=123] -atlas = SubResource( 90 ) -region = Rect2( 240, 1600, 240, 160 ) - -[sub_resource type="AtlasTexture" id=124] -atlas = SubResource( 90 ) -region = Rect2( 480, 1600, 240, 160 ) - -[sub_resource type="AtlasTexture" id=125] -atlas = SubResource( 90 ) -region = Rect2( 720, 1600, 240, 160 ) - -[sub_resource type="AtlasTexture" id=126] -atlas = SubResource( 90 ) -region = Rect2( 240, 160, 240, 160 ) - -[sub_resource type="AtlasTexture" id=127] -atlas = SubResource( 90 ) -region = Rect2( 1680, 160, 240, 160 ) - -[sub_resource type="AtlasTexture" id=128] -atlas = SubResource( 90 ) -region = Rect2( 1920, 160, 240, 160 ) - -[sub_resource type="AtlasTexture" id=129] -atlas = SubResource( 90 ) -region = Rect2( 2160, 160, 240, 160 ) - -[sub_resource type="AtlasTexture" id=130] -atlas = SubResource( 90 ) -region = Rect2( 2400, 160, 240, 160 ) - -[sub_resource type="AtlasTexture" id=131] -atlas = SubResource( 90 ) -region = Rect2( 0, 320, 240, 160 ) - -[sub_resource type="AtlasTexture" id=132] -atlas = SubResource( 90 ) -region = Rect2( 240, 320, 240, 160 ) - -[sub_resource type="AtlasTexture" id=133] -atlas = SubResource( 90 ) -region = Rect2( 480, 320, 240, 160 ) - -[sub_resource type="AtlasTexture" id=134] -atlas = SubResource( 90 ) -region = Rect2( 720, 320, 240, 160 ) - -[sub_resource type="AtlasTexture" id=135] -atlas = SubResource( 90 ) -region = Rect2( 960, 320, 240, 160 ) - -[sub_resource type="AtlasTexture" id=136] -atlas = SubResource( 90 ) -region = Rect2( 1200, 320, 240, 160 ) - -[sub_resource type="AtlasTexture" id=137] -atlas = SubResource( 90 ) -region = Rect2( 1680, 640, 240, 160 ) - -[sub_resource type="AtlasTexture" id=138] -atlas = SubResource( 90 ) -region = Rect2( 1920, 640, 240, 160 ) - -[sub_resource type="AtlasTexture" id=139] -atlas = SubResource( 90 ) -region = Rect2( 2160, 640, 240, 160 ) - -[sub_resource type="AtlasTexture" id=140] -atlas = SubResource( 90 ) -region = Rect2( 2400, 640, 240, 160 ) - -[sub_resource type="AtlasTexture" id=141] -atlas = SubResource( 90 ) -region = Rect2( 0, 800, 240, 160 ) - -[sub_resource type="AtlasTexture" id=142] -atlas = SubResource( 90 ) -region = Rect2( 240, 800, 240, 160 ) - -[sub_resource type="AtlasTexture" id=143] -atlas = SubResource( 90 ) -region = Rect2( 480, 800, 240, 160 ) - -[sub_resource type="AtlasTexture" id=144] -atlas = SubResource( 90 ) -region = Rect2( 720, 800, 240, 160 ) - -[sub_resource type="AtlasTexture" id=145] -atlas = SubResource( 90 ) -region = Rect2( 960, 800, 240, 160 ) - -[sub_resource type="AtlasTexture" id=146] -atlas = SubResource( 90 ) -region = Rect2( 1200, 800, 240, 160 ) - -[sub_resource type="AtlasTexture" id=147] -atlas = SubResource( 90 ) -region = Rect2( 1440, 800, 240, 160 ) - -[sub_resource type="AtlasTexture" id=148] -atlas = SubResource( 90 ) -region = Rect2( 1920, 320, 240, 160 ) - -[sub_resource type="AtlasTexture" id=149] -atlas = SubResource( 90 ) -region = Rect2( 2160, 320, 240, 160 ) - -[sub_resource type="AtlasTexture" id=150] -atlas = SubResource( 90 ) -region = Rect2( 2400, 320, 240, 160 ) - -[sub_resource type="AtlasTexture" id=151] -atlas = SubResource( 90 ) -region = Rect2( 0, 480, 240, 160 ) - -[sub_resource type="AtlasTexture" id=152] -atlas = SubResource( 90 ) -region = Rect2( 240, 480, 240, 160 ) - -[sub_resource type="AtlasTexture" id=153] -atlas = SubResource( 90 ) -region = Rect2( 480, 480, 240, 160 ) - -[sub_resource type="AtlasTexture" id=154] -atlas = SubResource( 90 ) -region = Rect2( 720, 480, 240, 160 ) - -[sub_resource type="AtlasTexture" id=155] -atlas = SubResource( 90 ) -region = Rect2( 960, 480, 240, 160 ) - -[sub_resource type="AtlasTexture" id=156] -atlas = SubResource( 90 ) -region = Rect2( 1200, 480, 240, 160 ) - -[sub_resource type="AtlasTexture" id=157] -atlas = SubResource( 90 ) -region = Rect2( 1440, 480, 240, 160 ) - -[sub_resource type="AtlasTexture" id=158] -atlas = SubResource( 90 ) -region = Rect2( 1920, 480, 240, 160 ) - -[sub_resource type="AtlasTexture" id=159] -atlas = SubResource( 90 ) -region = Rect2( 2160, 480, 240, 160 ) - -[sub_resource type="AtlasTexture" id=160] -atlas = SubResource( 90 ) -region = Rect2( 2400, 480, 240, 160 ) - -[sub_resource type="AtlasTexture" id=161] -atlas = SubResource( 90 ) -region = Rect2( 0, 640, 240, 160 ) - -[sub_resource type="AtlasTexture" id=162] -atlas = SubResource( 90 ) -region = Rect2( 240, 640, 240, 160 ) - -[sub_resource type="AtlasTexture" id=163] -atlas = SubResource( 90 ) -region = Rect2( 480, 640, 240, 160 ) - -[sub_resource type="AtlasTexture" id=164] -atlas = SubResource( 90 ) -region = Rect2( 720, 640, 240, 160 ) - -[sub_resource type="AtlasTexture" id=165] -atlas = SubResource( 90 ) -region = Rect2( 960, 640, 240, 160 ) - -[sub_resource type="AtlasTexture" id=166] -atlas = SubResource( 90 ) -region = Rect2( 1200, 640, 240, 160 ) - -[sub_resource type="AtlasTexture" id=167] -atlas = SubResource( 90 ) -region = Rect2( 1440, 640, 240, 160 ) - -[sub_resource type="AtlasTexture" id=168] -atlas = SubResource( 90 ) -region = Rect2( 2400, 0, 240, 160 ) - -[sub_resource type="AtlasTexture" id=169] -atlas = SubResource( 90 ) -region = Rect2( 0, 160, 240, 160 ) - -[sub_resource type="AtlasTexture" id=170] -atlas = SubResource( 90 ) -region = Rect2( 720, 1120, 240, 160 ) - -[sub_resource type="AtlasTexture" id=171] -atlas = SubResource( 90 ) -region = Rect2( 960, 1120, 240, 160 ) - -[sub_resource type="AtlasTexture" id=172] -atlas = SubResource( 90 ) -region = Rect2( 1200, 1120, 240, 160 ) - -[sub_resource type="AtlasTexture" id=173] -atlas = SubResource( 90 ) -region = Rect2( 1440, 1120, 240, 160 ) - -[sub_resource type="AtlasTexture" id=174] -atlas = SubResource( 90 ) -region = Rect2( 1680, 1120, 240, 160 ) - -[sub_resource type="AtlasTexture" id=175] -atlas = SubResource( 90 ) -region = Rect2( 1920, 1120, 240, 160 ) - -[sub_resource type="AtlasTexture" id=176] -atlas = SubResource( 90 ) -region = Rect2( 2160, 1120, 240, 160 ) - -[sub_resource type="AtlasTexture" id=177] -atlas = SubResource( 90 ) -region = Rect2( 2400, 1120, 240, 160 ) - -[sub_resource type="AtlasTexture" id=178] -atlas = SubResource( 90 ) -region = Rect2( 0, 1280, 240, 160 ) - -[sub_resource type="AtlasTexture" id=179] -atlas = SubResource( 90 ) -region = Rect2( 240, 1280, 240, 160 ) - -[sub_resource type="AtlasTexture" id=180] -atlas = SubResource( 90 ) -region = Rect2( 480, 1280, 240, 160 ) - -[sub_resource type="AtlasTexture" id=181] -atlas = SubResource( 90 ) -region = Rect2( 720, 1280, 240, 160 ) - -[sub_resource type="AtlasTexture" id=182] -atlas = SubResource( 90 ) -region = Rect2( 960, 1280, 240, 160 ) - -[sub_resource type="AtlasTexture" id=183] -atlas = SubResource( 90 ) -region = Rect2( 1200, 1280, 240, 160 ) - -[sub_resource type="AtlasTexture" id=184] -atlas = SubResource( 90 ) -region = Rect2( 1440, 1280, 240, 160 ) - -[sub_resource type="AtlasTexture" id=185] -atlas = SubResource( 90 ) -region = Rect2( 1680, 1280, 240, 160 ) - -[sub_resource type="AtlasTexture" id=186] -atlas = SubResource( 90 ) -region = Rect2( 1920, 1280, 240, 160 ) - -[sub_resource type="AtlasTexture" id=187] -atlas = SubResource( 90 ) -region = Rect2( 2160, 1280, 240, 160 ) - -[sub_resource type="AtlasTexture" id=188] -atlas = SubResource( 90 ) -region = Rect2( 2400, 1280, 240, 160 ) - -[sub_resource type="AtlasTexture" id=189] -atlas = SubResource( 90 ) -region = Rect2( 0, 1440, 240, 160 ) - -[sub_resource type="AtlasTexture" id=190] -atlas = SubResource( 90 ) -region = Rect2( 240, 0, 240, 160 ) - -[sub_resource type="AtlasTexture" id=191] -atlas = SubResource( 90 ) -region = Rect2( 480, 0, 240, 160 ) - -[sub_resource type="AtlasTexture" id=192] -atlas = SubResource( 90 ) -region = Rect2( 720, 0, 240, 160 ) - -[sub_resource type="AtlasTexture" id=193] -atlas = SubResource( 90 ) -region = Rect2( 960, 0, 240, 160 ) - -[sub_resource type="AtlasTexture" id=194] -atlas = SubResource( 90 ) -region = Rect2( 1680, 320, 240, 160 ) - -[sub_resource type="AtlasTexture" id=195] -atlas = SubResource( 90 ) -region = Rect2( 1680, 480, 240, 160 ) - -[sub_resource type="SpriteFrames" id=196] -animations = [ { -"frames": [ SubResource( 91 ), SubResource( 92 ), SubResource( 93 ), SubResource( 94 ), SubResource( 95 ), SubResource( 96 ) ], -"loop": true, -"name": "climb", -"speed": 10.0 -}, { -"frames": [ SubResource( 97 ) ], -"loop": false, -"name": "climb_step", -"speed": 10.0 -}, { -"frames": [ SubResource( 98 ) ], -"loop": false, -"name": "climb_upstep", -"speed": 10.0 -}, { -"frames": [ SubResource( 99 ), SubResource( 99 ), SubResource( 99 ), SubResource( 100 ), SubResource( 101 ), SubResource( 102 ), SubResource( 103 ), SubResource( 103 ), SubResource( 103 ) ], -"loop": false, -"name": "dash", -"speed": 10.0 -}, { -"frames": [ SubResource( 104 ), SubResource( 105 ), SubResource( 106 ), SubResource( 107 ), SubResource( 108 ), SubResource( 109 ), SubResource( 110 ), SubResource( 111 ), SubResource( 112 ), SubResource( 113 ), SubResource( 112 ), SubResource( 114 ) ], -"loop": false, -"name": "die", -"speed": 10.0 -}, { -"frames": [ SubResource( 115 ), SubResource( 116 ) ], -"loop": true, -"name": "hurt", -"speed": 4.0 -}, { -"frames": [ SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 118 ), SubResource( 119 ), SubResource( 120 ), SubResource( 121 ), SubResource( 122 ) ], -"loop": true, -"name": "idle", -"speed": 10.0 -}, { -"frames": [ SubResource( 123 ), SubResource( 124 ), SubResource( 125 ) ], -"loop": true, -"name": "idle_shield", -"speed": 10.0 -}, { -"frames": [ SubResource( 126 ) ], -"loop": true, -"name": "idle_shoot", -"speed": 10.0 -}, { -"frames": [ SubResource( 127 ), SubResource( 128 ), SubResource( 129 ), SubResource( 130 ), SubResource( 128 ), SubResource( 131 ), SubResource( 132 ), SubResource( 133 ) ], -"loop": false, -"name": "jump", -"speed": 10.0 -}, { -"frames": [ SubResource( 134 ), SubResource( 134 ), SubResource( 134 ), SubResource( 134 ), SubResource( 134 ), SubResource( 134 ), SubResource( 135 ), SubResource( 136 ) ], -"loop": false, -"name": "jump_shoot", -"speed": 10.0 -}, { -"frames": [ SubResource( 137 ), SubResource( 138 ), SubResource( 139 ), SubResource( 140 ), SubResource( 141 ), SubResource( 142 ), SubResource( 143 ), SubResource( 144 ), SubResource( 145 ), SubResource( 146 ), SubResource( 147 ) ], -"loop": false, -"name": "roll", -"speed": 10.0 -}, { -"frames": [ SubResource( 148 ), SubResource( 149 ), SubResource( 150 ), SubResource( 151 ), SubResource( 152 ), SubResource( 153 ), SubResource( 154 ), SubResource( 155 ), SubResource( 156 ), SubResource( 157 ) ], -"loop": true, -"name": "run", -"speed": 10.0 -}, { -"frames": [ SubResource( 158 ), SubResource( 159 ), SubResource( 160 ), SubResource( 161 ), SubResource( 162 ), SubResource( 163 ), SubResource( 164 ), SubResource( 165 ), SubResource( 166 ), SubResource( 167 ) ], -"loop": true, -"name": "run_shoot", -"speed": 10.0 -}, { -"frames": [ SubResource( 168 ), SubResource( 169 ), SubResource( 126 ) ], -"loop": false, -"name": "shoot", -"speed": 10.0 -}, { -"frames": [ SubResource( 170 ), SubResource( 171 ), SubResource( 172 ), SubResource( 172 ), SubResource( 173 ), SubResource( 174 ), SubResource( 175 ), SubResource( 176 ), SubResource( 176 ), SubResource( 177 ), SubResource( 178 ), SubResource( 179 ), SubResource( 180 ), SubResource( 181 ), SubResource( 182 ), SubResource( 183 ), SubResource( 184 ), SubResource( 185 ), SubResource( 186 ), SubResource( 187 ), SubResource( 188 ), SubResource( 189 ) ], -"loop": true, -"name": "slash", -"speed": 10.0 -}, { -"frames": [ SubResource( 118 ), SubResource( 190 ), SubResource( 191 ), SubResource( 192 ), SubResource( 193 ) ], -"loop": false, -"name": "stand", -"speed": 10.0 -}, { -"frames": [ SubResource( 194 ) ], -"loop": false, -"name": "step", -"speed": 10.0 -}, { -"frames": [ SubResource( 195 ) ], -"loop": false, -"name": "step_shoot", -"speed": 10.0 -} ] - -[sub_resource type="RectangleShape2D" id=89] -extents = Vector2( 12, 16 ) - -[node name="Player" instance=ExtResource( 1 )] -script = ExtResource( 3 ) -actor_type = "Player" -player_number = 1 - -[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="0"] -position = Vector2( 0, -3.5 ) -shape = SubResource( 197 ) - -[node name="AnimatedSprite" parent="." index="1"] -position = Vector2( -1, -51 ) -frames = SubResource( 196 ) -animation = "idle_shoot" -__meta__ = { -"_aseprite_wizard_config_": { -"layer": "", -"o_ex_p": "_+", -"o_folder": "res://assets", -"o_name": "", -"only_visible": true, -"op_exp": false, -"slice": "", -"source": "D:/Sync/Assets/Library/Mega.ase" -} -} - -[node name="movement_component" parent="." index="2"] -script = ExtResource( 2 ) -player_number = 1 -interactable_node = NodePath("../Interactable_Receiver") - -[node name="Hurtbox_Component" parent="." index="4"] -collision_layer = 16 -collision_mask = 128 -hurtbox_entered_function = "hit_Receiver" - -[node name="CollisionShape2D" parent="Hurtbox_Component" index="0"] -position = Vector2( 0, -2 ) -shape = SubResource( 89 ) - -[node name="Health_Component" parent="." index="6" instance=ExtResource( 7 )] -max_health = 100 - -[node name="Interactable_Receiver" type="Node2D" parent="." index="7"] -script = ExtResource( 16 ) -interactable_parent_callback = "touch_the_thing" - -[node name="Modifier_Receiver" parent="." index="8" instance=ExtResource( 9 )] -modifier_parent_callback = "receive_modifier" -debug_receiver = true - -[node name="Ladder_Detection" type="RayCast2D" parent="." index="9"] -modulate = Color( 0.247059, 0.92549, 0.0313726, 1 ) -position = Vector2( 0, 5 ) -enabled = true -cast_to = Vector2( 0, 15 ) -collision_mask = 1024 -collide_with_areas = true -collide_with_bodies = false - -[connection signal="health_depleted" from="Health_Component" to="." method="_on_Health_Component_health_depleted"] diff --git a/src/actors/players/playerD/movement_component.gd b/src/actors/players/playerD/movement_component.gd deleted file mode 100644 index 613acc5..0000000 --- a/src/actors/players/playerD/movement_component.gd +++ /dev/null @@ -1,140 +0,0 @@ -extends MovementComponent - -## Constants available to you -# UP = -1.0 -# DOWN = 1.0 -# LEFT = -1.0 -# RIGHT = 1.0 - -# Avalable functions to call -# A Series of helper functions -# go_up(): -# go_down(): -# go_left(): -# go_right(): -# stop(): - - -export var player_number: int = 1 - -export (NodePath) var interactable_node - -onready var interactable_receiver_node: Interactable_Receiver = get_node(interactable_node) -onready var ladder_detection:RayCast2D = $"../Ladder_Detection" - -var ladder_collision: RayCast2D - -func _ready(): - ladder_collision = ladder_detection - # Guess there isn't a hit from inside in 3.5 - # Remember to make raycast as tall as needed for the player - #ladder_collision.hit_from_inside = true - -func process_physics(delta): - PlayerInfo.player_position = owner.global_position - -func process_input(event: InputEvent): - var interactables = interactable_receiver_node.interactable_function_callables - for interactable in interactables: # Iterate through the interactable collection - if interactable is Interactable: # Make sure we didn't push something dumb in there. - if (Input.is_action_pressed("ui_up")): # We pressed up? - interactable.trigger_interaction() - get_movement_direction() - - -# Return the desired direction of movement for the character -# in the range [-1, 1], where positive values indicate a desire -# to move to the right and negative values to the left. -func get_movement_direction() -> float: - #return Input.get_axis('move_left', 'move_right') - desired_movement_vector.x = Input.get_axis("move_left_" + str(player_number), "move_right_" + str(player_number)) - return Input.get_axis("move_left_" + str(player_number), "move_right_" + str(player_number)) - -# Return a boolean indicating if the character wants to jump -func wants_jump() -> bool: - - if Input.is_action_just_pressed("jump_" + str(player_number)): - desired_movement_vector.y = 1 - return true - else: - return false - -# Return a boolean indicating if the character wants to jump -func wants_shoot() -> bool: - if Input.is_action_just_pressed("shoot_" + str(player_number)): - return true - else: - return false - -func wants_dash() -> bool: - if Input.is_action_just_pressed("dash_" + str(player_number)): - return true - else: - return false - -func wants_roll() -> bool: - if Input.is_action_just_pressed("dash_" + str(player_number)) and Input.is_action_pressed("ui_up"): - return true - else: - return false - -func wants_climb() -> bool: - if ladder_detection.is_colliding() and Input.is_action_pressed("ui_up"): - #print("betcha wanna climb though!") - return true - else: - return false - -func get_climb_shape_location() -> Vector2: - if ladder_detection.is_colliding(): - var point: Vector2 = ladder_collision.get_collision_point() - var shape_id = ladder_collision.get_collider_shape() - var object = ladder_collision.get_collider() - - # This works but doesn't get the shapes location. -# if object is Area2D: -# print("You got an area bro!" , object.global_position) - - - # This appears to get the shapes location! - var area = Physics2DServer.area_get_transform(object) - var areashape = Physics2DServer.area_get_shape_transform(object, shape_id) - - - var y_dir = Input.get_axis("ui_up" , "ui_down") -#var target = get_collider() # A CollisionObject2D. -#var shape_id = get_collider_shape() # The shape index in the collider. -#var owner_id = target.shape_find_owner(shape_id) # The owner ID in the collider. -#var shape = target.shape_owner_get_owner(owner_id) - - #UiManager.debug_text = str(round(point.x)) + ' ' + str(round(point.y)) #( "Mod(" + str(sign(_move_speed_modifier)) + ") Dir(" + str(move_direction) + ") Vel(" + str(sign(current_x_velocity)) + ") Mov(" + str(sign(move_component.desired_movement_vector.x)) + - - return Vector2(areashape.origin.x, y_dir) - else: - return Vector2(-1,-1) - -## Other needed variables -# desired_movement_vector: Vector2 - Used to store desired movement depending on the state -# current_movement_state:String - The name of the current State - -# Since animactor state machine can actually view properties from this type -# I'm thinking about moving the velocity tracker in here instead of player. -# velocity: Vector2 - Current velocity, you can change this at will but state may modify it - -# Declare any other member variables here. Examples: -# var a = 2 -# var b = "text" - - -# Called every frame. 'delta' is the elapsed time since the previous frame. -# you do not normally need to define this for Actor -#func process(delta): -# pass - -# For Enemy and NPC Actors: -# should be called on the frame process. - -# For Player Actors: -# Should be called on the input process - - diff --git a/src/actors/players/playerD/states/attack.gd b/src/actors/players/playerD/states/attack.gd deleted file mode 100644 index cfbff07..0000000 --- a/src/actors/players/playerD/states/attack.gd +++ /dev/null @@ -1,140 +0,0 @@ -extends StateAnimatedActor - -export (NodePath) var jump_node -export (NodePath) var idle_node -export (NodePath) var fall_node -export (NodePath) var move_node -export (NodePath) var draw_weapon_node - -onready var jump_state: StateAnimatedActor = get_node(jump_node) -onready var idle_state: StateAnimatedActor = get_node(idle_node) -onready var fall_state: StateAnimatedActor = get_node(fall_node) -onready var move_state: StateAnimatedActor = get_node(move_node) -#onready var weapon_state_modifier: StateModifier = get_node(draw_weapon_node) - - -var can_fire = true -signal do_attack() - -var draw_weapon_modifier: StateModifier - -func _ready(): - state_timeout.connect("timeout", self, "disable_cooldown") - draw_weapon_modifier = StateModifier.new() - var mod_timer :Timer = draw_weapon_modifier.ready( "draw_weapon", "_shoot" , draw_weapon_modifier.TYPE.ANIMATION_SUFFIX, 2.0) - add_child(mod_timer) - - -func disable_cooldown(): - if debug_state: - print("Attack state cooldown timeout. Can attack again.") - state_ready = true - -func enter() -> void: - if modifier: - if modifier.get_instance_id() == draw_weapon_modifier.get_instance_id(): - #print ("They the same cannot apply modifier: ", draw_weapon_modifier.get_instance_id()) - modifier = null - .enter() - ##TODO: Turn this to clear only the animation modifiers. -# modifier_stack_ref.clear() -# mod_animation_sequence.clear() -# #mod_animation_sequence = animation_sequence.duplicate(true) -# mod_animation_sequence.append_array(animation_sequence) -# # Reset animation suffix in case there isn't one -# animation_suffix = '_shoot' -# animation_index = 0 -# current_animation_sequence = 0 -# #var enter_animation = '' -# var enter_frame = 0 -# -# if debug_state: -# print(parent.name, " entering State: ", self.name) -# move_component.current_movement_state = self.name -# emit_signal("state_entered") - - can_fire = true -# if modifier_stack_ref.has($"../draw_weapon") == false: -# $"../draw_weapon".enter() -# modifier_stack_ref.push_front($"../draw_weapon") - if debug_state: - print("Previous State Info: ", previous_animation_name, " ", - previous_state_frame_number, " ", previous_state_name) - match previous_animation_name: - "idle": - #animations.play("idle_shoot") - if debug_state: - print("no need to change idle animation") - "run": - animations.play("run_shoot") - animations.frame = previous_state_frame_number - "jump": - animations.play("jump_shoot") - animations.frame = previous_state_frame_number - if debug_state: - print("Starting Animation: jump_shoot at frame ", animations.animation , animations.frame) - _: - print("Warning!: Attack state encountered unhandled prev animation: ", previous_animation_name) - - # An example where the modifier is left to alert on a timeout - #mod_timer.connect("timeout", draw_weapon_modifier, "_on_Timer_timeout") - # An example where the current node subscribes - #mod_timer.connect("timeout", self, "_on_Timer_timeout") - - state_timeout.start() - draw_weapon_modifier.state_timeout.start() - state_ready = false - animation_finished = false - -func _on_Timer_timeout(): - print("Modifier Timeout from attack! Forcing animation recall") - #animations.stop() - -func process_frame(delta: float) -> State: - if animation_finished: - draw_weapon_modifier.state_timeout.start() - modifier = draw_weapon_modifier - return idle_state -# if animations.frame == 2: -# animations.stop() -# if state_timeout.time_left == 0 and animations.animation == "shoot": -# return idle_state - return null - - -func process_physics(delta: float) -> State: - - if can_fire: # trying to do this in the physics because irrecular behavior - emit_signal("do_attack") - can_fire = false - - if move_component.wants_jump() and parent.is_on_floor(): - draw_weapon_modifier.state_timeout.start() - jump_state.modifier = draw_weapon_modifier - return jump_state - - move_actor_as_desired(delta) - -# if previous_state_name == "move" and move_component.velocity.x == 0.0: -# return idle_state - - if move_component.velocity.x != 0.0: - draw_weapon_modifier.state_timeout.start() - move_state.modifier = draw_weapon_modifier - #draw_weapon_modifier.transfer_owner(move_state) - return move_state - - if move_component.get_movement_direction() != 0.0: - parent.transform.x.x = move_component.get_movement_direction() - -# if move_component.velocity.x != 0.0: -# return move_state - - if !parent.is_on_floor(): - draw_weapon_modifier.state_timeout.start() - fall_state.modifier = draw_weapon_modifier - return fall_state - - - return null - diff --git a/src/actors/players/playerD/states/climb.gd b/src/actors/players/playerD/states/climb.gd deleted file mode 100644 index ef1aa33..0000000 --- a/src/actors/players/playerD/states/climb.gd +++ /dev/null @@ -1,51 +0,0 @@ -extends StateAnimatedActor - -export (NodePath) var idle_node - -onready var idle_state: StateAnimatedActor = get_node(idle_node) -#onready var landing_mod: StateModifier = get_node(landing_node) - -var climbing_modifier: StateModifier - -func _ready(): - climbing_modifier= StateModifier.new() - #add_child(modifier) - #modifier.init_ref() -# climbing_modifier.ready( "landing", "jump" , climbing_modifier.TYPE.EXIT_ANIMATION) -# climbing_modifier.starting_frame = 6 - #print("ready! MOD") - - -func enter() -> void: - .enter() - animations.frame = 5 - -func process_physics(delta: float) -> State: - - # First allow horizontal movement. - #move_actor_as_desired(delta) - # Make wure we still want to climb - var ladder_location = move_component.get_climb_shape_location() - if ladder_location != Vector2(-1,-1): - UiManager.debug_text = str(ladder_location) + '\n' + str(ladder_location - parent.global_position) #+ '\n' + str(parent.global_position.distance_to(ladder_location)) - # An attempt to snap to the ladder location - if parent.global_position.x != round(ladder_location.x): - parent.global_translate(Vector2(round((ladder_location.x - parent.global_position.x)),(ladder_location.y * move_speed) * delta)) - if ladder_location.y != 0: - animations.play() - else: - # Make sure we hopped the step index - if animation_index > 0: - animations.stop() - else: - return idle_state - #parent.move_local_x() - #Flip the character before tha actual move maybe. - if move_component.get_movement_direction() != 0.0: - parent.transform.x.x = move_component.get_movement_direction() - -# if parent.is_on_floor(): -# #modifier.reference() -# idle_state.modifier = climbing_modifier -# return idle_state - return null diff --git a/src/actors/players/playerD/states/dash.gd b/src/actors/players/playerD/states/dash.gd deleted file mode 100644 index ed56282..0000000 --- a/src/actors/players/playerD/states/dash.gd +++ /dev/null @@ -1,78 +0,0 @@ -extends StateAnimatedActor - -export (NodePath) var fall_node -export (NodePath) var idle_node -export (NodePath) var attack_node -export (NodePath) var jump_node - -onready var jump_state: State = get_node(jump_node) -onready var fall_state: State = get_node(fall_node) -onready var idle_state: State = get_node(idle_node) -onready var attack_state: State = get_node(attack_node) - -#var speed_decay_rate := 1.0 - -func process_physics(delta: float) -> State: - -# if move_component.wants_shoot(): -# return attack_state - - if move_component.wants_jump(): - return jump_state - - # Move the last direction we were facing. - move_actor_as_desired(delta, parent.transform.x.x) -# # Assuming adjusted_move_speed is set to the mood speed modifier on state entry -# # Move speed is the base speed plus the modifier minus the decay adjusted for time -# jerk += jerk_factor * delta -# adjusted_move_speed += move_modifier_move_acceleration * delta -# var new_move_speed = move_speed + (move_acceleration * delta) + adjusted_move_speed + jerk -# -# # A really crappy normalization to prevent modifying past the base move speed. -# if move_speed_modifier > 0 and new_move_speed < move_speed: # positive modifier -# #print("nope1") -# new_move_speed = move_speed -# elif move_speed_modifier < 0 and new_move_speed > move_speed: # negative modifier -# #print("nope2") -# new_move_speed = move_speed -# else: -# UiManager.debug_text = str(round(adjusted_move_speed)) + "," + str(round(new_move_speed)) + "," + str(round(jerk)) -# #print(adjusted_move_speed, ",", new_move_speed, ",", jerk) -# -# #print(new_move_speed, " ", adjusted_move_speed) -# -# move_component.velocity.y += gravity * delta -# #parent.velocity = parent.move_and_slide(parent.velocity, Vector2(0, -1)) -# #print(speed_multiplier) -# move_component.velocity.x = parent.transform.x.x * new_move_speed -# move_component.velocity = parent.move_and_slide(move_component.velocity, Vector2(0, -1)) - - ## Trying a whole new model -# var new_move_speed = move_speed * speed_multiplier -# if speed_multiplier > 1.0: -# print("PPS: ", new_move_speed * delta) -# speed_multiplier -= delta * (speed_decay_rate * speed_multiplier) -# #speed_decay_rate += delta * speed_decay_rate -# -# elif speed_multiplier < 1.0: -# speed_multiplier += delta * (speed_decay_rate * speed_multiplier) -# #speed_decay_rate += delta * speed_decay_rate -# -# # Deadzone -# if speed_multiplier < 1.1 and speed_multiplier > 0.9: -# speed_multiplier = 1.0 -# -# move_component.velocity.y += gravity * delta -# #parent.velocity = parent.move_and_slide(parent.velocity, Vector2(0, -1)) -# #print(speed_multiplier) -# move_component.velocity.x = parent.transform.x.x * new_move_speed -# move_component.velocity = parent.move_and_slide(move_component.velocity, Vector2(0, -1)) - - - if move_component.velocity.x == 0.0 or animations.playing == false: - if !parent.is_on_floor(): - return fall_state - else: - return idle_state - - return null diff --git a/src/actors/players/playerD/states/die.gd b/src/actors/players/playerD/states/die.gd deleted file mode 100644 index 6ce3602..0000000 --- a/src/actors/players/playerD/states/die.gd +++ /dev/null @@ -1,12 +0,0 @@ -extends StateAnimatedActor - -func enter() -> void: -# modifier_stack_ref.clear() - .enter() - move_component.velocity.x = 0 - - -func process_physics(_delta: float) -> State: - #Dead Dead dead. - #move_actor_as_desired(_delta) - return null diff --git a/src/actors/players/playerD/states/fall.gd b/src/actors/players/playerD/states/fall.gd deleted file mode 100644 index 78f2ed3..0000000 --- a/src/actors/players/playerD/states/fall.gd +++ /dev/null @@ -1,50 +0,0 @@ -extends StateAnimatedActor - -export (NodePath) var idle_node -export (NodePath) var landing_node - -onready var idle_state: StateAnimatedActor = get_node(idle_node) -#onready var landing_mod: StateModifier = get_node(landing_node) - -var landing_modifier: StateModifier - -func _ready(): - landing_modifier= StateModifier.new() - #add_child(modifier) - #modifier.init_ref() - landing_modifier.ready( "landing", "jump" , landing_modifier.TYPE.EXIT_ANIMATION) - landing_modifier.starting_frame = 6 - #print("ready! MOD") - - -func enter() -> void: -# var landing_mod_index = modifier_stack_ref.rfind(landing_mod) -# if landing_mod_index != -1: -# #print("You're Supposed to be dead!?: ", landing_mod_index) -# modifier_stack_ref.remove(landing_mod_index) - .enter() - # Jump to fall frame - animations.frame = 5 - animations.stop() - -func process_physics(delta: float) -> State: - - # First allow horizontal movement. - move_actor_as_desired(delta) - - #Flip the character before tha actual move maybe. - if move_component.get_movement_direction() != 0.0: - parent.transform.x.x = move_component.get_movement_direction() - - if parent.is_on_floor(): - #modifier.reference() - idle_state.modifier = landing_modifier - return idle_state - return null - -#func exit() -> void: -# .exit() -## push_animation_state_modifier(landing_mod) -## $"../landing".enter() -## modifier_stack_ref.push_front($"../landing") -# return diff --git a/src/actors/players/playerD/states/hurt.gd b/src/actors/players/playerD/states/hurt.gd deleted file mode 100644 index c044e78..0000000 --- a/src/actors/players/playerD/states/hurt.gd +++ /dev/null @@ -1,57 +0,0 @@ -extends StateAnimatedActor - -export (NodePath) var idle_node - -onready var idle_state: State = get_node(idle_node) - -var flash_color = Color.yellow - -var store_modifier: StateModifier - -func enter() -> void: - if modifier: - if debug_state: - print(name, " skipping modifier and holding for next state.") - store_modifier = modifier - modifier = null -# modifier_stack_ref.clear() - .enter() - move_component.velocity.x = 0 - #parent.set_hurtbox(false) - #TODO: Error check if timer was actually instanced - state_timeout.start() - -func exit() -> void: - modifier = store_modifier - .exit() - animations.modulate = Color.white - -func process_input(_event: InputEvent) -> State: -# move_component.wants_jump() - move_component.get_movement_direction() - - return null - - -func process_frame(delta: float) -> State: - - # Apply a little effect when damage taken. - #UiManager.debug_text = str(abs(sin((ceil(state_timeout.time_left) - state_timeout.time_left)/.5))) - animations.modulate = flash_color.linear_interpolate(Color.white, abs(sin((ceil(state_timeout.time_left) - state_timeout.time_left)/.5))) - - if state_timeout.time_left == 0: - return idle_state - return null - - -func process_physics(delta: float) -> State: - move_component.velocity.y += gravity * delta - #parent.velocity = parent.move_and_slide(parent.velocity, Vector2(0, -1)) - move_component.velocity.x = parent.transform.x.x * move_speed -# if (parent.direction.x > 0): -# parent.velocity.x = 1 * move_speed -# else: -# parent.velocity.x = -1 * move_speed - move_component.velocity = parent.move_and_slide(move_component.velocity, Vector2(0, -1)) - - return null diff --git a/src/actors/players/playerD/states/idle.gd b/src/actors/players/playerD/states/idle.gd deleted file mode 100644 index 76bc192..0000000 --- a/src/actors/players/playerD/states/idle.gd +++ /dev/null @@ -1,52 +0,0 @@ -extends StateAnimatedActor - -export (NodePath) var fall_node -export (NodePath) var move_node -export (NodePath) var jump_node -export (NodePath) var attack_node -export (NodePath) var dash_node -export (NodePath) var roll_node -export (NodePath) var climb_node - -onready var fall_state: State = get_node(fall_node) -onready var move_state: State = get_node(move_node) -onready var jump_state: State = get_node(jump_node) -onready var attack_state: State = get_node(attack_node) -onready var dash_state: State = get_node(dash_node) -onready var roll_state: State = get_node(roll_node) -onready var climb_state: State = get_node(climb_node) - -func enter() -> void: - .enter() -# parent.set_hurtbox(true) - #move_component.velocity.x = 0 - #move_component.momentum.x *= -1 - if debug_state: - print(owner.name, " Move Component: ", move_component.desired_movement_vector.x) - -func process_physics(delta: float) -> State: - - if move_component.wants_jump() and parent.is_on_floor(): - return jump_state - - # We need to offer roll before dash because the inputs are the same - if move_component.wants_roll() and parent.is_on_floor(): - return roll_state - - if move_component.wants_dash() and parent.is_on_floor(): - return dash_state - - if move_component.wants_climb(): - return climb_state - - if move_component.wants_shoot(): - return attack_state - - move_actor_as_desired(delta) - - if move_component.desired_movement_vector.x != 0 and move_component.velocity.x != 0: - return move_state - - if !parent.is_on_floor(): - return fall_state - return null diff --git a/src/actors/players/playerD/states/jump.gd b/src/actors/players/playerD/states/jump.gd deleted file mode 100644 index 2012508..0000000 --- a/src/actors/players/playerD/states/jump.gd +++ /dev/null @@ -1,45 +0,0 @@ -extends StateAnimatedActor - - -export (NodePath) var idle_node -export (NodePath) var fall_node -export (NodePath) var attack_node -export (NodePath) var landing_node - -onready var idle_state: State = get_node(idle_node) -onready var fall_state: State = get_node(fall_node) -onready var attack_state: State = get_node(attack_node) -#onready var landing_mod: StateModifier = get_node(landing_node) - -export var jump_force: float = 200.0 - -func enter() -> void: -# var landing_mod_index = modifier_stack_ref.rfind(landing_mod) -# if landing_mod_index != -1: -# #print("You're Supposed to be dead!?: ", landing_mod_index) -# modifier_stack_ref.remove(landing_mod_index) -# if modifier_stack_ref.has(landing_mod): -# print("Jump from Landing Mod at: ", modifier_stack_ref.rfind(landing_mod)) - .enter() - # Apply initial jump velocity on state enter - move_component.velocity.y = -jump_force - -func process_physics(delta: float) -> State: - - if move_component.velocity.y > 0: - return fall_state - - if move_component.wants_shoot(): - return attack_state - - # First allow horizontal movement. - move_actor_as_desired(delta) - - #Flip the character before tha actual move maybe. - 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/src/actors/players/playerD/states/move.gd b/src/actors/players/playerD/states/move.gd deleted file mode 100644 index 1eee763..0000000 --- a/src/actors/players/playerD/states/move.gd +++ /dev/null @@ -1,34 +0,0 @@ -extends StateAnimatedActor - -export (NodePath) var fall_node -export (NodePath) var idle_node -export (NodePath) var jump_node -export (NodePath) var attack_node - -onready var fall_state: State = get_node(fall_node) -onready var idle_state: State = get_node(idle_node) -onready var jump_state: State = get_node(jump_node) -onready var attack_state: State = get_node(attack_node) - -func process_physics(delta: float) -> State: - if move_component.wants_jump() and parent.is_on_floor(): - return jump_state - - if move_component.wants_shoot(): - return attack_state - - move_actor_as_desired(delta) - -# if move_component.velocity.x == 0.0: -# return idle_state - - #Flip the character before tha actual move maybe. - if move_component.get_movement_direction() != 0.0: - parent.transform.x.x = move_component.get_movement_direction() - - if move_component.desired_movement_vector.x == 0: - return idle_state - - if !parent.is_on_floor(): - return fall_state - return null diff --git a/src/actors/players/playerD/states/roll.gd b/src/actors/players/playerD/states/roll.gd deleted file mode 100644 index 0a83708..0000000 --- a/src/actors/players/playerD/states/roll.gd +++ /dev/null @@ -1,46 +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) - -var speed_decay_rate := 1.0 - -func enter(): - #remove_animation_state_modifiers() - .enter() - - -func process_physics(delta: float) -> State: - -# if move_component.wants_shoot(): -# return attack_state - - if speed_multiplier > 1.0: - #print(speed_multiplier,", ", delta) - speed_multiplier -= delta * speed_decay_rate - speed_decay_rate += delta - elif speed_multiplier < 1.0: - speed_multiplier += delta * speed_decay_rate - speed_decay_rate += delta - - # Deadzone - if speed_multiplier < 1.1 and speed_multiplier > 0.9: - speed_multiplier = 1.0 - - move_component.velocity.y += gravity * delta - #parent.velocity = parent.move_and_slide(parent.velocity, Vector2(0, -1)) - #print(speed_multiplier) - move_component.velocity.x = parent.transform.x.x * move_speed * speed_multiplier - move_component.velocity = parent.move_and_slide(move_component.velocity, Vector2(0, -1)) - - if animations.frame >= 10: - #print("WTF - ", animations.frame, " ,", move_component.velocity.x) - if !parent.is_on_floor(): - return fall_state - else: - return idle_state - - return null diff --git a/src/actors/players/playerE/PlayerE-Movement_StateReceiver.gd b/src/actors/players/playerE/PlayerE-Movement_StateReceiver.gd index 529c619..1561393 100644 --- a/src/actors/players/playerE/PlayerE-Movement_StateReceiver.gd +++ b/src/actors/players/playerE/PlayerE-Movement_StateReceiver.gd @@ -275,7 +275,8 @@ func _state_process_physics_fall(): if $"../LedgeDetector".is_colliding() and !$"../WallDetector".is_colliding(): #print("it touched me!") - UiManager.debug_text = (str($"../LedgeDetector".get_collision_point())) + if debug_component: + UiManager.debug_text = (str($"../LedgeDetector".get_collision_point())) request_state_change.call_func('ledge_grab') if parent.is_on_floor(): @@ -286,7 +287,6 @@ func _state_process_physics_fall(): move_actor_as_desired() func _state_process_physics_jump(): - #UiManager.debug_text = (str(velocity)) flip_sprite_to_movement_direction() @@ -356,7 +356,8 @@ func _state_process_physics_climb(): request_state_change.call_func('fall') func _state_process_physics_ledge_grab(): - UiManager.debug_text = (str(velocity)) + if debug_component: + UiManager.debug_text = (str(velocity)) $"../LedgeDetector".set_enabled(false) if _wants_jump: @@ -366,11 +367,11 @@ func _state_process_physics_ledge_grab(): request_state_change.call_func('fall') func _state_process_physics_ledge_climb(): -# UiManager.debug_text = (str(velocity)) # $"../LedgeDetector".set_enabled(false) - UiManager.debug_text = (str(parent.is_on_floor()) + - str(parent.is_on_wall()) + ")\nV:" + str(velocity)) + if debug_component: + UiManager.debug_text = (str(parent.is_on_floor()) + + str(parent.is_on_wall()) + ")\nV:" + str(velocity)) if current_state.animation_finished == true: request_state_change.call_func('land')