Compare commits
No commits in common. "dfdc2d059f216133db837c3f931812c3a43a914b" and "f54f49704b4ccf5f839586f68f38778c9049b7cf" have entirely different histories.
dfdc2d059f
...
f54f49704b
|
|
@ -1,8 +1,7 @@
|
||||||
[gd_scene load_steps=4 format=2]
|
[gd_scene load_steps=3 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/actors/players/playerE/PlayerE.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://src/actors/players/playerE/PlayerE.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://src/levels/TestBox.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://src/levels/TestBox.tscn" type="PackedScene" id=2]
|
||||||
[ext_resource path="res://src/ui/HUD.tscn" type="PackedScene" id=3]
|
|
||||||
|
|
||||||
[node name="Main" type="Node2D"]
|
[node name="Main" type="Node2D"]
|
||||||
|
|
||||||
|
|
@ -13,5 +12,3 @@ __meta__ = {
|
||||||
|
|
||||||
[node name="PlayerE" parent="." instance=ExtResource( 1 )]
|
[node name="PlayerE" parent="." instance=ExtResource( 1 )]
|
||||||
position = Vector2( 112, 56 )
|
position = Vector2( 112, 56 )
|
||||||
|
|
||||||
[node name="UI_Layer" parent="." instance=ExtResource( 3 )]
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
|
||||||
|
|
||||||
[sub_resource type="DynamicFontData" id=1]
|
|
||||||
font_path = "res://assets/Fonts/QuinqueFive.ttf"
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
size = 5
|
|
||||||
font_data = SubResource( 1 )
|
|
||||||
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 174 B |
|
|
@ -1,35 +0,0 @@
|
||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="StreamTexture"
|
|
||||||
path="res://.import/Healthbar-Indicator.png-cbbde6797adcb3b0445dfd4f9ab1961a.stex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://assets/UI/Healthbar-Indicator.png"
|
|
||||||
dest_files=[ "res://.import/Healthbar-Indicator.png-cbbde6797adcb3b0445dfd4f9ab1961a.stex" ]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/hdr_mode=0
|
|
||||||
compress/bptc_ldr=0
|
|
||||||
compress/normal_map=0
|
|
||||||
flags/repeat=0
|
|
||||||
flags/filter=false
|
|
||||||
flags/mipmaps=false
|
|
||||||
flags/anisotropic=false
|
|
||||||
flags/srgb=2
|
|
||||||
process/fix_alpha_border=true
|
|
||||||
process/premult_alpha=false
|
|
||||||
process/HDR_as_SRGB=false
|
|
||||||
process/invert_color=false
|
|
||||||
process/normal_map_invert_y=false
|
|
||||||
stream=false
|
|
||||||
size_limit=0
|
|
||||||
detect_3d=true
|
|
||||||
svg/scale=1.0
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 172 B |
|
|
@ -1,35 +0,0 @@
|
||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="StreamTexture"
|
|
||||||
path="res://.import/Healthbar.png-838f5c013355fbdfe1abb6dec9197215.stex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://assets/UI/Healthbar.png"
|
|
||||||
dest_files=[ "res://.import/Healthbar.png-838f5c013355fbdfe1abb6dec9197215.stex" ]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/hdr_mode=0
|
|
||||||
compress/bptc_ldr=0
|
|
||||||
compress/normal_map=0
|
|
||||||
flags/repeat=0
|
|
||||||
flags/filter=false
|
|
||||||
flags/mipmaps=false
|
|
||||||
flags/anisotropic=false
|
|
||||||
flags/srgb=2
|
|
||||||
process/fix_alpha_border=true
|
|
||||||
process/premult_alpha=false
|
|
||||||
process/HDR_as_SRGB=false
|
|
||||||
process/invert_color=false
|
|
||||||
process/normal_map_invert_y=false
|
|
||||||
stream=false
|
|
||||||
size_limit=0
|
|
||||||
detect_3d=true
|
|
||||||
svg/scale=1.0
|
|
||||||
|
|
@ -49,6 +49,8 @@ func _process(delta):
|
||||||
# Not sure what should be called first here.
|
# Not sure what should be called first here.
|
||||||
if has_method('_state_process_' + current_state.name):
|
if has_method('_state_process_' + current_state.name):
|
||||||
call('_state_process_' + current_state.name)
|
call('_state_process_' + current_state.name)
|
||||||
|
#TODO: Not sure I want to do modifiers this way anymore
|
||||||
|
#process_state_modifier()
|
||||||
|
|
||||||
func _on_animation_finished():
|
func _on_animation_finished():
|
||||||
if frames.get_animation_loop(animation) == false:
|
if frames.get_animation_loop(animation) == false:
|
||||||
|
|
@ -216,6 +218,16 @@ func change_animation(enter_frame := 0, index := 0, suffix := ''):
|
||||||
# else:
|
# else:
|
||||||
# frame_signal_emitted = false
|
# frame_signal_emitted = false
|
||||||
|
|
||||||
|
#func set_previous_animation( old_state: StateAnimatedActor, new_state: StateAnimatedActor ) -> void:
|
||||||
|
# # added this to help prevent nul index crashes. (Usually because of signal based state changes.)
|
||||||
|
# if old_state.mod_animation_sequence:
|
||||||
|
# new_state.previous_animation_name = old_state.mod_animation_sequence[old_state.current_animation_sequence]
|
||||||
|
# new_state.previous_state_frame_number = old_state.animations.frame
|
||||||
|
# new_state.previous_state_name = old_state.name
|
||||||
|
# new_state.previous_speed_multiplier = old_state.speed_multiplier
|
||||||
|
# #animation_name :String, frame_number : int, animation_sequence :Array
|
||||||
|
# return
|
||||||
|
|
||||||
# Handle state change from subscribed state machine.
|
# Handle state change from subscribed state machine.
|
||||||
#From signal state_changed(old_state_name, new_state)
|
#From signal state_changed(old_state_name, new_state)
|
||||||
func _on_state_change(old_state_name:String, new_state :State):
|
func _on_state_change(old_state_name:String, new_state :State):
|
||||||
|
|
@ -233,6 +245,7 @@ func _on_state_change(old_state_name:String, new_state :State):
|
||||||
#print("It's an animated Actor state!")
|
#print("It's an animated Actor state!")
|
||||||
else:
|
else:
|
||||||
push_warning("Received non animated Actor state.")
|
push_warning("Received non animated Actor state.")
|
||||||
|
#current_state = new_state
|
||||||
|
|
||||||
func _on_modifiers_updated(_modifier_type :int, _modifier_action :int):
|
func _on_modifiers_updated(_modifier_type :int, _modifier_action :int):
|
||||||
##TODO: There's so many things I could maybe do here but lets target the
|
##TODO: There's so many things I could maybe do here but lets target the
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,9 @@ var acceleration = Vector2(0,0)
|
||||||
var physics_delta:float
|
var physics_delta:float
|
||||||
var process_delta:float
|
var process_delta:float
|
||||||
|
|
||||||
var modifier: StateModifierAnimatedActor
|
|
||||||
|
#Can't use floats here, switched to constants.
|
||||||
|
#enum directions {UP = -1, DOWN = 1, LEFT, RIGHT}
|
||||||
|
|
||||||
#Removing Probably not used
|
#Removing Probably not used
|
||||||
#var attack_function: FuncRef
|
#var attack_function: FuncRef
|
||||||
|
|
@ -42,17 +44,12 @@ const LEFT = -1.0
|
||||||
const RIGHT = 1.0
|
const RIGHT = 1.0
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
## FuncRef to request state machine change state
|
|
||||||
request_state_change = funcref(get_node(callable_state_machine), 'change_to_known_state')
|
request_state_change = funcref(get_node(callable_state_machine), 'change_to_known_state')
|
||||||
## Connect signal to get alerted of state change
|
|
||||||
get_node(callable_state_machine).connect("state_changed", self,"_on_state_change")
|
get_node(callable_state_machine).connect("state_changed", self,"_on_state_change")
|
||||||
## A reference to the current state machine state
|
|
||||||
current_state = get_node(callable_state_machine).current_state
|
current_state = get_node(callable_state_machine).current_state
|
||||||
## A reference to the state machine merged modifiers
|
|
||||||
modifier = get_node(callable_state_machine).merged_animation_state_modifiers
|
|
||||||
|
|
||||||
############
|
############
|
||||||
## These get called by the parent
|
# These get called by the parent
|
||||||
############
|
############
|
||||||
func process_physics(delta):
|
func process_physics(delta):
|
||||||
physics_delta = delta
|
physics_delta = delta
|
||||||
|
|
@ -82,9 +79,7 @@ func process_input(event: InputEvent):
|
||||||
|
|
||||||
############
|
############
|
||||||
|
|
||||||
############
|
# A Series of helper functions
|
||||||
## A Series of helper functions
|
|
||||||
############
|
|
||||||
func go_up():
|
func go_up():
|
||||||
desired_movement_vector.y = UP
|
desired_movement_vector.y = UP
|
||||||
func go_down():
|
func go_down():
|
||||||
|
|
@ -119,7 +114,6 @@ func wants_roll() -> bool:
|
||||||
|
|
||||||
func wants_climb() -> bool:
|
func wants_climb() -> bool:
|
||||||
return false
|
return false
|
||||||
############
|
|
||||||
|
|
||||||
func get_climb_shape_location() -> Vector2:
|
func get_climb_shape_location() -> Vector2:
|
||||||
return Vector2(-1,-1)
|
return Vector2(-1,-1)
|
||||||
|
|
@ -198,7 +192,8 @@ func move_actor_as_desired( x_move_direction_override: float = 0):
|
||||||
# if sign(move_direction) == 0:
|
# if sign(move_direction) == 0:
|
||||||
# move_direction = sign(mod_props.move_speed) * -1
|
# move_direction = sign(mod_props.move_speed) * -1
|
||||||
# #print("doing this? ")
|
# #print("doing this? ")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Determine the maximum move speed
|
# Determine the maximum move speed
|
||||||
var MAX_SPEED :float = 0
|
var MAX_SPEED :float = 0
|
||||||
|
|
@ -227,7 +222,7 @@ func move_actor_as_desired( x_move_direction_override: float = 0):
|
||||||
# Perhaps it would be better to trigger this on a difference in modifier but they usually go together.
|
# Perhaps it would be better to trigger this on a difference in modifier but they usually go together.
|
||||||
if abs(acceleration.x) != abs(_move_modifier_move_acceleration + _move_acceleration):
|
if abs(acceleration.x) != abs(_move_modifier_move_acceleration + _move_acceleration):
|
||||||
if move_direction:
|
if move_direction:
|
||||||
#print("Acceleration changed.", abs(acceleration.x), "-", (_move_modifier_move_acceleration + _move_acceleration))
|
print("Acceleration changed.", abs(acceleration.x), "-", (_move_modifier_move_acceleration + _move_acceleration))
|
||||||
acceleration.x = _move_modifier_move_acceleration + _move_acceleration
|
acceleration.x = _move_modifier_move_acceleration + _move_acceleration
|
||||||
|
|
||||||
# If we're no longer tryingg to move int the direction of our movement and momentum.
|
# If we're no longer tryingg to move int the direction of our movement and momentum.
|
||||||
|
|
@ -265,7 +260,7 @@ func move_actor_as_desired( x_move_direction_override: float = 0):
|
||||||
momentum.x = 0
|
momentum.x = 0
|
||||||
elif sign(_move_speed_modifier) == +1: # increased speed modifier
|
elif sign(_move_speed_modifier) == +1: # increased speed modifier
|
||||||
##TODO: in most cases this should only be applied once. need to find a way to warn against this.
|
##TODO: in most cases this should only be applied once. need to find a way to warn against this.
|
||||||
momentum.x = abs(_move_speed_modifier)
|
momentum.x = abs(current_state.move_speed_modifier)
|
||||||
print("momentum applied!")
|
print("momentum applied!")
|
||||||
|
|
||||||
# Reverse the accelerations if we carry over momentum but the modifier no longer applies.
|
# Reverse the accelerations if we carry over momentum but the modifier no longer applies.
|
||||||
|
|
@ -278,7 +273,6 @@ func move_actor_as_desired( x_move_direction_override: float = 0):
|
||||||
|
|
||||||
# We're going to adjust our move speed only to the modifier
|
# We're going to adjust our move speed only to the modifier
|
||||||
momentum.x += acceleration.x * delta
|
momentum.x += acceleration.x * delta
|
||||||
##TODO: Apparently I disabled jerk some time ago for some reason.
|
|
||||||
current_state.jerk += _jerk_factor * delta
|
current_state.jerk += _jerk_factor * delta
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -103,11 +103,6 @@ _global_script_classes=[ {
|
||||||
"class": "StateModifierAnimatedActor",
|
"class": "StateModifierAnimatedActor",
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://lib/classes/state_modifier_animation.gd"
|
"path": "res://lib/classes/state_modifier_animation.gd"
|
||||||
}, {
|
|
||||||
"base": "CanvasLayer",
|
|
||||||
"class": "UIComponent",
|
|
||||||
"language": "GDScript",
|
|
||||||
"path": "res://src/ui/HUD.gd"
|
|
||||||
} ]
|
} ]
|
||||||
_global_script_class_icons={
|
_global_script_class_icons={
|
||||||
"Actor": "",
|
"Actor": "",
|
||||||
|
|
@ -128,8 +123,7 @@ _global_script_class_icons={
|
||||||
"StateMachine": "",
|
"StateMachine": "",
|
||||||
"StateMachineAnimatedActor": "",
|
"StateMachineAnimatedActor": "",
|
||||||
"StateModifier": "",
|
"StateModifier": "",
|
||||||
"StateModifierAnimatedActor": "",
|
"StateModifierAnimatedActor": ""
|
||||||
"UIComponent": ""
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[application]
|
[application]
|
||||||
|
|
@ -220,23 +214,12 @@ move_right_1={
|
||||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null)
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
crouch_1={
|
|
||||||
"deadzone": 0.5,
|
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
jump_1={
|
jump_1={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":32,"unicode":0,"echo":false,"script":null)
|
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":32,"unicode":0,"echo":false,"script":null)
|
||||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
dash_1={
|
|
||||||
"deadzone": 0.5,
|
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":78,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
|
||||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":1,"pressure":0.0,"pressed":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
attack_1={
|
attack_1={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":77,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":77,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||||
|
|
@ -267,6 +250,12 @@ shoot_2={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [ ]
|
"events": [ ]
|
||||||
}
|
}
|
||||||
|
dash_1={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":78,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":1,"pressure":0.0,"pressed":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
[layer_names]
|
[layer_names]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,8 @@ func _ready():
|
||||||
# animation = 'idle-attack-sword'
|
# animation = 'idle-attack-sword'
|
||||||
|
|
||||||
func _on_state_change_fall():
|
func _on_state_change_fall():
|
||||||
change_animation(2)
|
change_animation()
|
||||||
|
frame = 2
|
||||||
stop()
|
stop()
|
||||||
|
|
||||||
func _on_state_exited_attack_sword():
|
func _on_state_exited_attack_sword():
|
||||||
|
|
|
||||||
|
|
@ -32,15 +32,6 @@ func wants_jump() -> bool:
|
||||||
_wants_jump = false
|
_wants_jump = false
|
||||||
return false
|
return false
|
||||||
|
|
||||||
var _wants_crouch :bool
|
|
||||||
func wants_crouch() -> bool:
|
|
||||||
if Input.is_action_pressed("crouch_" + str(player_number)):
|
|
||||||
_wants_crouch = true
|
|
||||||
return true
|
|
||||||
else:
|
|
||||||
_wants_crouch = false
|
|
||||||
return false
|
|
||||||
|
|
||||||
var _wants_shoot :bool
|
var _wants_shoot :bool
|
||||||
func wants_shoot() -> bool:
|
func wants_shoot() -> bool:
|
||||||
if Input.is_action_just_pressed("attack_" + str(player_number)):
|
if Input.is_action_just_pressed("attack_" + str(player_number)):
|
||||||
|
|
@ -97,7 +88,6 @@ func process_physics_input(delta):
|
||||||
physics_delta = delta
|
physics_delta = delta
|
||||||
get_movement_direction()
|
get_movement_direction()
|
||||||
wants_jump()
|
wants_jump()
|
||||||
wants_crouch()
|
|
||||||
wants_shoot()
|
wants_shoot()
|
||||||
wants_attack_secondary()
|
wants_attack_secondary()
|
||||||
wants_dash()
|
wants_dash()
|
||||||
|
|
@ -111,8 +101,6 @@ func _state_process_physics_idle():
|
||||||
if desired_movement_vector.y == UP:
|
if desired_movement_vector.y == UP:
|
||||||
request_state_change.call_func('jump')
|
request_state_change.call_func('jump')
|
||||||
|
|
||||||
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:
|
if desired_movement_vector.x != 0: # and velocity.x != 0:
|
||||||
request_state_change.call_func('move')
|
request_state_change.call_func('move')
|
||||||
|
|
@ -168,23 +156,6 @@ func _state_process_physics_land():
|
||||||
#return fall_state
|
#return fall_state
|
||||||
request_state_change.call_func('fall')
|
request_state_change.call_func('fall')
|
||||||
move_actor_as_desired()
|
move_actor_as_desired()
|
||||||
|
|
||||||
func _state_process_physics_hurt():
|
|
||||||
if current_state.state_timeout.time_left == 0:
|
|
||||||
request_state_change.call_func('idle')
|
|
||||||
|
|
||||||
# if !parent.is_on_floor():
|
|
||||||
# #return fall_state
|
|
||||||
# request_state_change.call_func('fall')
|
|
||||||
velocity.y += current_state.gravity * physics_delta
|
|
||||||
#parent.velocity = parent.move_and_slide(parent.velocity, Vector2(0, -1))
|
|
||||||
velocity.x = parent.transform.x.x * -1 * current_state.horizontal_speed
|
|
||||||
# if (parent.direction.x > 0):
|
|
||||||
# parent.velocity.x = 1 * move_speed
|
|
||||||
# else:
|
|
||||||
# parent.velocity.x = -1 * move_speed
|
|
||||||
velocity = parent.move_and_slide(velocity, Vector2(0, -1))
|
|
||||||
|
|
||||||
|
|
||||||
func _state_process_physics_fall():
|
func _state_process_physics_fall():
|
||||||
flip_sprite_to_movement_direction()
|
flip_sprite_to_movement_direction()
|
||||||
|
|
@ -224,38 +195,6 @@ func _state_process_physics_move():
|
||||||
|
|
||||||
move_actor_as_desired()
|
move_actor_as_desired()
|
||||||
|
|
||||||
func _state_process_physics_crouch():
|
|
||||||
# flip sprite in direction
|
|
||||||
flip_sprite_to_movement_direction()
|
|
||||||
|
|
||||||
if _wants_crouch != true:
|
|
||||||
request_state_change.call_func('idle')
|
|
||||||
|
|
||||||
if !parent.is_on_floor():
|
|
||||||
request_state_change.call_func('fall')
|
|
||||||
|
|
||||||
if _wants_crouch == true and desired_movement_vector.x != 0:
|
|
||||||
request_state_change.call_func('crouch_move')
|
|
||||||
elif desired_movement_vector.x != 0: # and velocity.x != 0:
|
|
||||||
request_state_change.call_func('move')
|
|
||||||
|
|
||||||
func _state_process_physics_crouch_move():
|
|
||||||
# flip sprite in direction
|
|
||||||
flip_sprite_to_movement_direction()
|
|
||||||
|
|
||||||
if _wants_crouch != true:
|
|
||||||
request_state_change.call_func('idle')
|
|
||||||
|
|
||||||
if !parent.is_on_floor():
|
|
||||||
request_state_change.call_func('fall')
|
|
||||||
|
|
||||||
if _wants_crouch == true and desired_movement_vector.x == 0:
|
|
||||||
request_state_change.call_func('crouch')
|
|
||||||
elif _wants_crouch != true and desired_movement_vector.x != 0:
|
|
||||||
request_state_change.call_func('move')
|
|
||||||
|
|
||||||
move_actor_as_desired()
|
|
||||||
|
|
||||||
#func _on_state_entered_idle():
|
#func _on_state_entered_idle():
|
||||||
# print("Movement State Idle State Entered!")
|
# print("Movement State Idle State Entered!")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,19 +8,9 @@ extends Actor
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
PlayerInfo.player_health = $Health_Component.health
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
#func _process(delta):
|
#func _process(delta):
|
||||||
# pass
|
# pass
|
||||||
func hit_Receiver(damage):
|
|
||||||
$Hurtbox_Component.set_hurtbox(false)
|
|
||||||
$Health_Component.take_damage(damage)
|
|
||||||
if $Health_Component.health > 0:
|
|
||||||
movement_state_machine.change_to_known_state('hurt')
|
|
||||||
PlayerInfo.player_health = $Health_Component.health
|
|
||||||
if PlayerInfo.player_health <= 0:
|
|
||||||
return
|
|
||||||
yield( get_tree().create_timer(2 + movement_state_machine.get_state_reference('hurt').timeout_seconds), "timeout")
|
|
||||||
$Hurtbox_Component.set_hurtbox(true)
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=22 format=2]
|
[gd_scene load_steps=16 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://lib/templates/Actor/ActorTemplate.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://lib/templates/Actor/ActorTemplate.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://assets/actors/players/playerE/PlayerE_SpriteFrames.tres" type="SpriteFrames" id=2]
|
[ext_resource path="res://assets/actors/players/playerE/PlayerE_SpriteFrames.tres" type="SpriteFrames" id=2]
|
||||||
|
|
@ -6,46 +6,37 @@
|
||||||
[ext_resource path="res://src/actors/players/playerE/states/idle.tres" type="Resource" id=4]
|
[ext_resource path="res://src/actors/players/playerE/states/idle.tres" type="Resource" id=4]
|
||||||
[ext_resource path="res://src/actors/players/playerE/PlayerE-AnimatedSprite_StateReceiver.gd" type="Script" id=5]
|
[ext_resource path="res://src/actors/players/playerE/PlayerE-AnimatedSprite_StateReceiver.gd" type="Script" id=5]
|
||||||
[ext_resource path="res://src/actors/players/playerE/PlayerE-Movement_StateReceiver.gd" type="Script" id=6]
|
[ext_resource path="res://src/actors/players/playerE/PlayerE-Movement_StateReceiver.gd" type="Script" id=6]
|
||||||
[ext_resource path="res://src/actors/players/playerE/states/move.tres" type="Resource" id=7]
|
[ext_resource path="res://lib/classes/state_animated_actor.gd" type="Script" id=7]
|
||||||
[ext_resource path="res://src/actors/players/playerE/states/jump.tres" type="Resource" id=8]
|
[ext_resource path="res://src/actors/players/playerE/states/jump.tres" type="Resource" id=8]
|
||||||
[ext_resource path="res://src/actors/players/playerE/states/fall.tres" type="Resource" id=9]
|
[ext_resource path="res://src/actors/players/playerE/states/fall.tres" type="Resource" id=9]
|
||||||
[ext_resource path="res://src/actors/players/playerE/states/attack_sword.tres" type="Resource" id=10]
|
[ext_resource path="res://src/actors/players/playerE/states/attack_sword.tres" type="Resource" id=10]
|
||||||
[ext_resource path="res://src/actors/players/playerE/states/attack_shoot.tres" type="Resource" id=11]
|
[ext_resource path="res://src/actors/players/playerE/states/attack_shoot.tres" type="Resource" id=11]
|
||||||
[ext_resource path="res://src/actors/players/playerE/states/land.tres" type="Resource" id=12]
|
[ext_resource path="res://src/actors/players/playerE/states/land.tres" type="Resource" id=12]
|
||||||
[ext_resource path="res://src/actors/players/playerE/states/roll.tres" type="Resource" id=13]
|
[ext_resource path="res://src/actors/players/playerE/states/roll.tres" type="Resource" id=13]
|
||||||
[ext_resource path="res://src/actors/players/playerE/states/crouch.tres" type="Resource" id=14]
|
|
||||||
[ext_resource path="res://src/actors/players/playerE/states/crouch_move.tres" type="Resource" id=15]
|
|
||||||
[ext_resource path="res://lib/components/Hurtbox_Component.tscn" type="PackedScene" id=16]
|
|
||||||
[ext_resource path="res://lib/components/Health_Component.tscn" type="PackedScene" id=17]
|
|
||||||
[ext_resource path="res://lib/classes/state_animated_actor.gd" type="Script" id=18]
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id=3]
|
[sub_resource type="Resource" id=3]
|
||||||
resource_local_to_scene = true
|
resource_name = "move"
|
||||||
resource_name = "hurt"
|
script = ExtResource( 7 )
|
||||||
script = ExtResource( 18 )
|
|
||||||
debug_state = false
|
debug_state = false
|
||||||
timeout_seconds = 2.0
|
timeout_seconds = 0.0
|
||||||
name = "hurt"
|
name = "move"
|
||||||
horizontal_speed = 20.0
|
horizontal_speed = 90.0
|
||||||
horizontal_acceleration = 0.0
|
horizontal_acceleration = 0.0
|
||||||
horizontal_speed_offset = 0.0
|
horizontal_speed_offset = 0.0
|
||||||
horizontal_speed_offset_acceleration = 0.0
|
horizontal_speed_offset_acceleration = 0.0
|
||||||
jerk_factor = 0.0
|
jerk_factor = 0.0
|
||||||
animation_sequence = [ "hurt" ]
|
animation_sequence = [ "run" ]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id=1]
|
[sub_resource type="RectangleShape2D" id=1]
|
||||||
extents = Vector2( 7, 14 )
|
extents = Vector2( 7, 14 )
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id=2]
|
|
||||||
extents = Vector2( 9, 15 )
|
|
||||||
|
|
||||||
[node name="PlayerE" instance=ExtResource( 1 )]
|
[node name="PlayerE" instance=ExtResource( 1 )]
|
||||||
script = ExtResource( 3 )
|
script = ExtResource( 3 )
|
||||||
actor_type = "Player"
|
actor_type = "Player"
|
||||||
|
|
||||||
[node name="Movement_StateMachine" parent="." index="0"]
|
[node name="Movement_StateMachine" parent="." index="0"]
|
||||||
starting_state_name = "idle"
|
starting_state_name = "idle"
|
||||||
states = [ ExtResource( 4 ), ExtResource( 9 ), ExtResource( 7 ), ExtResource( 8 ), ExtResource( 12 ), ExtResource( 11 ), ExtResource( 10 ), ExtResource( 13 ), ExtResource( 14 ), ExtResource( 15 ), SubResource( 3 ) ]
|
states = [ ExtResource( 4 ), ExtResource( 9 ), SubResource( 3 ), ExtResource( 8 ), ExtResource( 12 ), ExtResource( 11 ), ExtResource( 10 ), ExtResource( 13 ) ]
|
||||||
|
|
||||||
[node name="AnimatedSprite_StateReceiver" parent="." index="1"]
|
[node name="AnimatedSprite_StateReceiver" parent="." index="1"]
|
||||||
frames = ExtResource( 2 )
|
frames = ExtResource( 2 )
|
||||||
|
|
@ -70,16 +61,3 @@ script = ExtResource( 6 )
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="4"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="4"]
|
||||||
position = Vector2( 0, 2 )
|
position = Vector2( 0, 2 )
|
||||||
shape = SubResource( 1 )
|
shape = SubResource( 1 )
|
||||||
|
|
||||||
[node name="Health_Component" parent="." index="5" instance=ExtResource( 17 )]
|
|
||||||
max_health = 100
|
|
||||||
|
|
||||||
[node name="Hurtbox_Component" parent="." index="6" instance=ExtResource( 16 )]
|
|
||||||
collision_layer = 16
|
|
||||||
collision_mask = 128
|
|
||||||
hurtbox_entered_function = "hit_Receiver"
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hurtbox_Component" index="0"]
|
|
||||||
modulate = Color( 0, 0, 1, 1 )
|
|
||||||
position = Vector2( -1, 2 )
|
|
||||||
shape = SubResource( 2 )
|
|
||||||
|
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
[gd_resource type="Resource" load_steps=2 format=2]
|
|
||||||
|
|
||||||
[ext_resource path="res://lib/classes/state_animated_actor.gd" type="Script" id=1]
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
resource_local_to_scene = true
|
|
||||||
resource_name = "crouch"
|
|
||||||
script = ExtResource( 1 )
|
|
||||||
debug_state = false
|
|
||||||
timeout_seconds = 0.0
|
|
||||||
name = "crouch"
|
|
||||||
horizontal_speed = 1.36422e-12
|
|
||||||
horizontal_acceleration = 0.0
|
|
||||||
horizontal_speed_offset = 0.0
|
|
||||||
horizontal_speed_offset_acceleration = 0.0
|
|
||||||
jerk_factor = 0.0
|
|
||||||
animation_sequence = [ "idle-crouch" ]
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
[gd_resource type="Resource" load_steps=2 format=2]
|
|
||||||
|
|
||||||
[ext_resource path="res://lib/classes/state_animated_actor.gd" type="Script" id=1]
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
resource_local_to_scene = true
|
|
||||||
resource_name = "crouch_move"
|
|
||||||
script = ExtResource( 1 )
|
|
||||||
debug_state = false
|
|
||||||
timeout_seconds = 0.0
|
|
||||||
name = "crouch_move"
|
|
||||||
horizontal_speed = 60.0
|
|
||||||
horizontal_acceleration = 0.0
|
|
||||||
horizontal_speed_offset = 0.0
|
|
||||||
horizontal_speed_offset_acceleration = 0.0
|
|
||||||
jerk_factor = 0.0
|
|
||||||
animation_sequence = [ "run_crouch" ]
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
[gd_resource type="Resource" load_steps=2 format=2]
|
|
||||||
|
|
||||||
[ext_resource path="res://lib/classes/state_animated_actor.gd" type="Script" id=1]
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
resource_local_to_scene = true
|
|
||||||
resource_name = "move"
|
|
||||||
script = ExtResource( 1 )
|
|
||||||
debug_state = false
|
|
||||||
timeout_seconds = 0.0
|
|
||||||
name = "move"
|
|
||||||
horizontal_speed = 90.0
|
|
||||||
horizontal_acceleration = 0.0
|
|
||||||
horizontal_speed_offset = 0.0
|
|
||||||
horizontal_speed_offset_acceleration = 0.0
|
|
||||||
jerk_factor = 0.0
|
|
||||||
animation_sequence = [ "run" ]
|
|
||||||
|
|
@ -9,9 +9,9 @@ script = ExtResource( 1 )
|
||||||
debug_state = false
|
debug_state = false
|
||||||
timeout_seconds = 0.0
|
timeout_seconds = 0.0
|
||||||
name = "roll"
|
name = "roll"
|
||||||
horizontal_speed = 10.0
|
horizontal_speed = 60.0
|
||||||
horizontal_acceleration = 1.36422e-12
|
horizontal_acceleration = 0.0
|
||||||
horizontal_speed_offset = 150.0
|
horizontal_speed_offset = 0.0
|
||||||
horizontal_speed_offset_acceleration = -150.0
|
horizontal_speed_offset_acceleration = 0.0
|
||||||
jerk_factor = 0.0
|
jerk_factor = 0.0
|
||||||
animation_sequence = [ "roll" ]
|
animation_sequence = [ "roll" ]
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,7 @@
|
||||||
[gd_scene load_steps=5 format=2]
|
[gd_scene load_steps=3 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/templates/level_templates/LevelTemplate.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://src/templates/level_templates/LevelTemplate.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://assets/levels/LegacyFantasy-High_Forest/tileset.tres" type="TileSet" id=2]
|
[ext_resource path="res://assets/levels/LegacyFantasy-High_Forest/tileset.tres" type="TileSet" id=2]
|
||||||
[ext_resource path="res://lib/components/Hitbox_Component.tscn" type="PackedScene" id=3]
|
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id=1]
|
|
||||||
radius = 5.09902
|
|
||||||
|
|
||||||
[node name="TestBox" instance=ExtResource( 1 )]
|
[node name="TestBox" instance=ExtResource( 1 )]
|
||||||
|
|
||||||
|
|
@ -18,18 +14,3 @@ tile_set = ExtResource( 2 )
|
||||||
collision_layer = 0
|
collision_layer = 0
|
||||||
collision_mask = 0
|
collision_mask = 0
|
||||||
tile_data = PoolIntArray( 524288, 0, 2, 524307, 0, 3 )
|
tile_data = PoolIntArray( 524288, 0, 2, 524307, 0, 3 )
|
||||||
|
|
||||||
[node name="Hitbox_Component" parent="." index="4" instance=ExtResource( 3 )]
|
|
||||||
damage_amount = 10
|
|
||||||
|
|
||||||
[node name="ColorRect" type="ColorRect" parent="Hitbox_Component" index="0"]
|
|
||||||
margin_left = 263.0
|
|
||||||
margin_top = 115.0
|
|
||||||
margin_right = 273.0
|
|
||||||
margin_bottom = 124.0
|
|
||||||
color = Color( 1, 0, 0, 1 )
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox_Component" index="1"]
|
|
||||||
modulate = Color( 1, 0, 0, 1 )
|
|
||||||
position = Vector2( 268, 119 )
|
|
||||||
shape = SubResource( 1 )
|
|
||||||
|
|
|
||||||
|
|
@ -1,60 +0,0 @@
|
||||||
class_name UIComponent
|
|
||||||
extends CanvasLayer
|
|
||||||
|
|
||||||
|
|
||||||
# Declare member variables here. Examples:
|
|
||||||
# var a = 2
|
|
||||||
# var b = "text"
|
|
||||||
|
|
||||||
onready var DialogContainer = $PanelContainer
|
|
||||||
|
|
||||||
onready var DialogContainerPortrait = $PanelContainer/HSplitContainer/TextureRect
|
|
||||||
|
|
||||||
onready var DialogContainerText = $PanelContainer/HSplitContainer/Label
|
|
||||||
|
|
||||||
onready var DialogIndicator = $PanelContainer/Polygon2D
|
|
||||||
|
|
||||||
onready var HUD = $HealthBar
|
|
||||||
|
|
||||||
var current_pane
|
|
||||||
|
|
||||||
var tween
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready():
|
|
||||||
# How to change to a differant portrait picture.
|
|
||||||
#DialogContainerPortrait.texture = UiManager.dialog_portrait
|
|
||||||
#DialogContainerText.text = UiManager.dialog_text
|
|
||||||
UiManager.current_pane = UiManager.UI_PANES.HUD
|
|
||||||
#DialogContainer.visible = false
|
|
||||||
tween = get_tree().create_tween().set_loops()
|
|
||||||
tween.tween_property(DialogIndicator, "modulate", Color.darkgray, 1)
|
|
||||||
tween.tween_property(DialogIndicator, "modulate", Color.white , 1)
|
|
||||||
##tween.tween_property(DialogIndicator, "modulate", Color.RED, 1)
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
func _process(delta):
|
|
||||||
$Debug.text = UiManager.debug_text
|
|
||||||
if (UiManager.current_pane != current_pane):
|
|
||||||
print("UI Switch detected")
|
|
||||||
current_pane = UiManager.current_pane
|
|
||||||
DialogContainer.visible = false
|
|
||||||
HUD.visible = false
|
|
||||||
match current_pane:
|
|
||||||
UiManager.UI_PANES.HUD:
|
|
||||||
print("Enable HUD")
|
|
||||||
HUD.visible = true
|
|
||||||
UiManager.UI_PANES.DIALOG:
|
|
||||||
print("Enable Dialog")
|
|
||||||
DialogContainerPortrait.texture = UiManager.dialog_portrait
|
|
||||||
DialogContainerText.text = UiManager.dialog_text
|
|
||||||
DialogContainer.visible = true
|
|
||||||
#get_tree().paused = true
|
|
||||||
_: # Implicitly off
|
|
||||||
print("UI Turned off")
|
|
||||||
|
|
||||||
|
|
||||||
func _unhandled_input(event):
|
|
||||||
if current_pane == UiManager.UI_PANES.DIALOG and Input.is_action_just_pressed("ui_accept"):
|
|
||||||
UiManager.current_pane = UiManager.UI_PANES.HUD
|
|
||||||
#get_tree().paused = false
|
|
||||||
|
|
@ -1,73 +0,0 @@
|
||||||
[gd_scene load_steps=7 format=2]
|
|
||||||
|
|
||||||
[ext_resource path="res://icon.png" type="Texture" id=1]
|
|
||||||
[ext_resource path="res://assets/Fonts/QuinqueFive.tres" type="DynamicFont" id=2]
|
|
||||||
[ext_resource path="res://src/ui/HUD.gd" type="Script" id=3]
|
|
||||||
[ext_resource path="res://assets/UI/Healthbar.png" type="Texture" id=4]
|
|
||||||
[ext_resource path="res://src/ui/HealthBar.gd" type="Script" id=5]
|
|
||||||
[ext_resource path="res://assets/UI/Healthbar-Indicator.png" type="Texture" id=6]
|
|
||||||
|
|
||||||
[node name="HUD" type="CanvasLayer"]
|
|
||||||
pause_mode = 2
|
|
||||||
layer = 2
|
|
||||||
script = ExtResource( 3 )
|
|
||||||
|
|
||||||
[node name="PanelContainer" type="PanelContainer" parent="."]
|
|
||||||
visible = false
|
|
||||||
margin_left = 2.0
|
|
||||||
margin_top = 2.0
|
|
||||||
margin_right = 318.0
|
|
||||||
margin_bottom = 80.0
|
|
||||||
|
|
||||||
[node name="HSplitContainer" type="HSplitContainer" parent="PanelContainer"]
|
|
||||||
margin_left = 7.0
|
|
||||||
margin_top = 7.0
|
|
||||||
margin_right = 309.0
|
|
||||||
margin_bottom = 71.0
|
|
||||||
size_flags_vertical = 0
|
|
||||||
split_offset = 1
|
|
||||||
|
|
||||||
[node name="TextureRect" type="TextureRect" parent="PanelContainer/HSplitContainer"]
|
|
||||||
margin_right = 65.0
|
|
||||||
margin_bottom = 64.0
|
|
||||||
grow_vertical = 2
|
|
||||||
size_flags_vertical = 5
|
|
||||||
texture = ExtResource( 1 )
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="PanelContainer/HSplitContainer"]
|
|
||||||
margin_left = 77.0
|
|
||||||
margin_right = 302.0
|
|
||||||
margin_bottom = 64.0
|
|
||||||
size_flags_vertical = 1
|
|
||||||
size_flags_stretch_ratio = 5.0
|
|
||||||
custom_fonts/font = ExtResource( 2 )
|
|
||||||
text = "In a world where danger lurks in your plumbing. One thing decides to do another thing and we all determine it wasn't worth it. Hello World"
|
|
||||||
autowrap = true
|
|
||||||
|
|
||||||
[node name="Polygon2D" type="Polygon2D" parent="PanelContainer"]
|
|
||||||
position = Vector2( 75, 16.5 )
|
|
||||||
scale = Vector2( 0.769547, 0.833333 )
|
|
||||||
color = Color( 0.533333, 0.533333, 0.533333, 1 )
|
|
||||||
polygon = PoolVector2Array( 294, 63, 300.177, 63, 307, 63, 300.503, 69 )
|
|
||||||
|
|
||||||
[node name="HealthBar" type="TextureProgress" parent="."]
|
|
||||||
margin_left = 2.0
|
|
||||||
margin_top = 2.0
|
|
||||||
margin_right = 104.0
|
|
||||||
margin_bottom = 14.0
|
|
||||||
value = 50.0
|
|
||||||
texture_under = ExtResource( 4 )
|
|
||||||
texture_progress = ExtResource( 6 )
|
|
||||||
texture_progress_offset = Vector2( 1, 1 )
|
|
||||||
script = ExtResource( 5 )
|
|
||||||
|
|
||||||
[node name="Debug" type="Label" parent="."]
|
|
||||||
anchor_left = 1.0
|
|
||||||
anchor_right = 1.0
|
|
||||||
margin_left = -192.0
|
|
||||||
margin_top = 3.0
|
|
||||||
margin_right = -3.0
|
|
||||||
margin_bottom = 17.0
|
|
||||||
custom_fonts/font = ExtResource( 2 )
|
|
||||||
text = "Foo"
|
|
||||||
align = 2
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
extends TextureProgress
|
|
||||||
|
|
||||||
|
|
||||||
# Declare member variables here. Examples:
|
|
||||||
# var a = 2
|
|
||||||
# var b = "text"
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready():
|
|
||||||
pass # Replace with function body.
|
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
func _process(delta):
|
|
||||||
value = PlayerInfo.player_health
|
|
||||||
Loading…
Reference in New Issue
Block a user