Compare commits

...

5 Commits

Author SHA1 Message Date
93559496b0 Add a bunch of animations 2025-03-19 22:41:13 -07:00
471b1ee3db Fixes on Receiver. Add landing frames. 2025-03-19 22:19:51 -07:00
ae24288db3 Troubleshooting falling. 2025-03-18 19:58:39 -07:00
6b1efd27e3 Clean up 2025-03-18 19:26:54 -07:00
d9d5860d63 Almost jumping. 2025-03-18 14:55:42 -07:00
25 changed files with 649 additions and 75 deletions

View File

@ -1,4 +1,4 @@
[gd_resource type="SpriteFrames" load_steps=27 format=2]
[gd_resource type="SpriteFrames" load_steps=79 format=2]
[sub_resource type="StreamTexture" id=1]
load_path = "res://.import/idle.png-dac221ba43c70fde9cf788217116f029.stex"
@ -7,6 +7,33 @@ load_path = "res://.import/idle.png-dac221ba43c70fde9cf788217116f029.stex"
atlas = SubResource( 1 )
region = Rect2( 0, 0, 48, 48 )
[sub_resource type="StreamTexture" id=27]
load_path = "res://.import/flip.png-9fe7948b7ca939b51b6b682ffd8dd717.stex"
[sub_resource type="AtlasTexture" id=28]
atlas = SubResource( 27 )
region = Rect2( 0, 0, 48, 48 )
[sub_resource type="AtlasTexture" id=29]
atlas = SubResource( 27 )
region = Rect2( 48, 0, 48, 48 )
[sub_resource type="AtlasTexture" id=30]
atlas = SubResource( 27 )
region = Rect2( 96, 0, 48, 48 )
[sub_resource type="AtlasTexture" id=31]
atlas = SubResource( 27 )
region = Rect2( 0, 48, 48, 48 )
[sub_resource type="AtlasTexture" id=32]
atlas = SubResource( 27 )
region = Rect2( 48, 48, 48, 48 )
[sub_resource type="AtlasTexture" id=33]
atlas = SubResource( 27 )
region = Rect2( 96, 48, 48, 48 )
[sub_resource type="AtlasTexture" id=3]
atlas = SubResource( 1 )
region = Rect2( 48, 0, 48, 48 )
@ -27,6 +54,21 @@ region = Rect2( 48, 48, 48, 48 )
atlas = SubResource( 1 )
region = Rect2( 96, 48, 48, 48 )
[sub_resource type="StreamTexture" id=34]
load_path = "res://.import/idle-crouch.png-8f1595d55411ac4e1fef2bb6cf7e5b5c.stex"
[sub_resource type="AtlasTexture" id=35]
atlas = SubResource( 34 )
region = Rect2( 0, 0, 48, 48 )
[sub_resource type="AtlasTexture" id=36]
atlas = SubResource( 34 )
region = Rect2( 48, 0, 48, 48 )
[sub_resource type="AtlasTexture" id=37]
atlas = SubResource( 34 )
region = Rect2( 0, 48, 48, 48 )
[sub_resource type="StreamTexture" id=8]
load_path = "res://.import/jump.png-e5e27a6608040d3526a151777807f18b.stex"
@ -65,6 +107,122 @@ region = Rect2( 0, 48, 48, 48 )
atlas = SubResource( 12 )
region = Rect2( 48, 48, 48, 48 )
[sub_resource type="StreamTexture" id=49]
load_path = "res://.import/ledge-climb.png-f1ecc7841600e3ca6f3624bf9903e1d9.stex"
[sub_resource type="AtlasTexture" id=50]
atlas = SubResource( 49 )
region = Rect2( 0, 0, 48, 48 )
[sub_resource type="AtlasTexture" id=51]
atlas = SubResource( 49 )
region = Rect2( 48, 0, 48, 48 )
[sub_resource type="AtlasTexture" id=52]
atlas = SubResource( 49 )
region = Rect2( 96, 0, 48, 48 )
[sub_resource type="AtlasTexture" id=53]
atlas = SubResource( 49 )
region = Rect2( 0, 48, 48, 48 )
[sub_resource type="AtlasTexture" id=54]
atlas = SubResource( 49 )
region = Rect2( 48, 48, 48, 48 )
[sub_resource type="StreamTexture" id=72]
load_path = "res://.import/pull.png-86930899bb5993aca09d11af6f1e0eb0.stex"
[sub_resource type="AtlasTexture" id=73]
atlas = SubResource( 72 )
region = Rect2( 0, 0, 48, 48 )
[sub_resource type="AtlasTexture" id=74]
atlas = SubResource( 72 )
region = Rect2( 48, 0, 48, 48 )
[sub_resource type="AtlasTexture" id=75]
atlas = SubResource( 72 )
region = Rect2( 96, 0, 48, 48 )
[sub_resource type="AtlasTexture" id=76]
atlas = SubResource( 72 )
region = Rect2( 0, 48, 48, 48 )
[sub_resource type="AtlasTexture" id=77]
atlas = SubResource( 72 )
region = Rect2( 48, 48, 48, 48 )
[sub_resource type="AtlasTexture" id=78]
atlas = SubResource( 72 )
region = Rect2( 96, 48, 48, 48 )
[sub_resource type="StreamTexture" id=63]
load_path = "res://.import/push.png-83c0fa5d68432717ea8417b2150c5a91.stex"
[sub_resource type="AtlasTexture" id=64]
atlas = SubResource( 63 )
region = Rect2( 0, 0, 48, 48 )
[sub_resource type="AtlasTexture" id=65]
atlas = SubResource( 63 )
region = Rect2( 48, 0, 48, 48 )
[sub_resource type="AtlasTexture" id=66]
atlas = SubResource( 63 )
region = Rect2( 96, 0, 48, 48 )
[sub_resource type="AtlasTexture" id=67]
atlas = SubResource( 63 )
region = Rect2( 0, 48, 48, 48 )
[sub_resource type="AtlasTexture" id=68]
atlas = SubResource( 63 )
region = Rect2( 48, 48, 48, 48 )
[sub_resource type="AtlasTexture" id=69]
atlas = SubResource( 63 )
region = Rect2( 96, 48, 48, 48 )
[sub_resource type="AtlasTexture" id=70]
atlas = SubResource( 63 )
region = Rect2( 0, 96, 48, 48 )
[sub_resource type="AtlasTexture" id=71]
atlas = SubResource( 63 )
region = Rect2( 48, 96, 48, 48 )
[sub_resource type="StreamTexture" id=55]
load_path = "res://.import/roll.png-eab6c0796978b2753ede3c92eeb8ee9f.stex"
[sub_resource type="AtlasTexture" id=56]
atlas = SubResource( 55 )
region = Rect2( 0, 0, 48, 48 )
[sub_resource type="AtlasTexture" id=57]
atlas = SubResource( 55 )
region = Rect2( 48, 0, 48, 48 )
[sub_resource type="AtlasTexture" id=58]
atlas = SubResource( 55 )
region = Rect2( 96, 0, 48, 48 )
[sub_resource type="AtlasTexture" id=59]
atlas = SubResource( 55 )
region = Rect2( 0, 48, 48, 48 )
[sub_resource type="AtlasTexture" id=60]
atlas = SubResource( 55 )
region = Rect2( 48, 48, 48, 48 )
[sub_resource type="AtlasTexture" id=61]
atlas = SubResource( 55 )
region = Rect2( 96, 48, 48, 48 )
[sub_resource type="AtlasTexture" id=62]
atlas = SubResource( 55 )
region = Rect2( 0, 96, 48, 48 )
[sub_resource type="StreamTexture" id=18]
load_path = "res://.import/run.png-d086b4c01d4e3ff36f750b9aff5a303a.stex"
@ -100,31 +258,109 @@ region = Rect2( 0, 96, 48, 48 )
atlas = SubResource( 18 )
region = Rect2( 48, 96, 48, 48 )
[sub_resource type="StreamTexture" id=38]
load_path = "res://.import/run-crouch.png-13dd70dd30935cf28b601677cc96319e.stex"
[sub_resource type="AtlasTexture" id=39]
atlas = SubResource( 38 )
region = Rect2( 0, 0, 48, 48 )
[sub_resource type="AtlasTexture" id=40]
atlas = SubResource( 38 )
region = Rect2( 48, 0, 48, 48 )
[sub_resource type="AtlasTexture" id=41]
atlas = SubResource( 38 )
region = Rect2( 96, 0, 48, 48 )
[sub_resource type="AtlasTexture" id=42]
atlas = SubResource( 38 )
region = Rect2( 144, 0, 48, 48 )
[sub_resource type="AtlasTexture" id=43]
atlas = SubResource( 38 )
region = Rect2( 0, 48, 48, 48 )
[sub_resource type="AtlasTexture" id=44]
atlas = SubResource( 38 )
region = Rect2( 48, 48, 48, 48 )
[sub_resource type="AtlasTexture" id=45]
atlas = SubResource( 38 )
region = Rect2( 96, 48, 48, 48 )
[sub_resource type="AtlasTexture" id=46]
atlas = SubResource( 38 )
region = Rect2( 144, 48, 48, 48 )
[sub_resource type="AtlasTexture" id=47]
atlas = SubResource( 38 )
region = Rect2( 0, 96, 48, 48 )
[sub_resource type="AtlasTexture" id=48]
atlas = SubResource( 38 )
region = Rect2( 48, 96, 48, 48 )
[resource]
resource_name = "PlayerE"
animations = [ {
"frames": [ SubResource( 2 ) ],
"loop": true,
"name": "default",
"speed": 13.0
"speed": 10.0
}, {
"frames": [ SubResource( 28 ), SubResource( 29 ), SubResource( 30 ), SubResource( 31 ), SubResource( 32 ), SubResource( 33 ) ],
"loop": false,
"name": "flip",
"speed": 10.0
}, {
"frames": [ SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ), SubResource( 5 ), SubResource( 6 ), SubResource( 2 ), SubResource( 7 ), SubResource( 7 ), SubResource( 7 ) ],
"loop": true,
"name": "idle",
"speed": 11.0
}, {
"frames": [ SubResource( 35 ), SubResource( 36 ), SubResource( 37 ), SubResource( 37 ), SubResource( 37 ), SubResource( 37 ), SubResource( 36 ), SubResource( 35 ), SubResource( 35 ), SubResource( 35 ) ],
"loop": true,
"name": "idle-crouch",
"speed": 10.0
}, {
"frames": [ SubResource( 9 ), SubResource( 10 ), SubResource( 11 ) ],
"loop": false,
"name": "jump",
"speed": 10.0
"speed": 2.0
}, {
"frames": [ SubResource( 13 ), SubResource( 14 ), SubResource( 14 ), SubResource( 15 ), SubResource( 15 ), SubResource( 16 ), SubResource( 16 ), SubResource( 17 ), SubResource( 17 ) ],
"loop": false,
"name": "land",
"speed": 13.0
"speed": 16.0
}, {
"frames": [ SubResource( 50 ), SubResource( 51 ), SubResource( 52 ), SubResource( 53 ), SubResource( 54 ) ],
"loop": false,
"name": "ledge-climb",
"speed": 9.0
}, {
"frames": [ SubResource( 73 ), SubResource( 74 ), SubResource( 75 ), SubResource( 76 ), SubResource( 77 ), SubResource( 78 ) ],
"loop": true,
"name": "pull",
"speed": 6.0
}, {
"frames": [ SubResource( 64 ), SubResource( 65 ), SubResource( 66 ), SubResource( 66 ), SubResource( 67 ), SubResource( 68 ), SubResource( 69 ), SubResource( 70 ), SubResource( 70 ), SubResource( 71 ) ],
"loop": true,
"name": "push",
"speed": 10.0
}, {
"frames": [ SubResource( 56 ), SubResource( 57 ), SubResource( 58 ), SubResource( 59 ), SubResource( 60 ), SubResource( 61 ), SubResource( 62 ) ],
"loop": true,
"name": "roll",
"speed": 10.0
}, {
"frames": [ SubResource( 19 ), SubResource( 20 ), SubResource( 21 ), SubResource( 22 ), SubResource( 23 ), SubResource( 24 ), SubResource( 25 ), SubResource( 26 ) ],
"loop": true,
"name": "run",
"speed": 13.0
}, {
"frames": [ SubResource( 39 ), SubResource( 40 ), SubResource( 41 ), SubResource( 42 ), SubResource( 43 ), SubResource( 44 ), SubResource( 45 ), SubResource( 46 ), SubResource( 47 ), SubResource( 48 ) ],
"loop": true,
"name": "run-crouch",
"speed": 10.0
} ]

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/flip.png-9fe7948b7ca939b51b6b682ffd8dd717.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/actors/players/playerE/flip.png"
dest_files=[ "res://.import/flip.png-9fe7948b7ca939b51b6b682ffd8dd717.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.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/idle-crouch.png-8f1595d55411ac4e1fef2bb6cf7e5b5c.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/actors/players/playerE/idle-crouch.png"
dest_files=[ "res://.import/idle-crouch.png-8f1595d55411ac4e1fef2bb6cf7e5b5c.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.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/ledge-climb.png-f1ecc7841600e3ca6f3624bf9903e1d9.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/actors/players/playerE/ledge-climb.png"
dest_files=[ "res://.import/ledge-climb.png-f1ecc7841600e3ca6f3624bf9903e1d9.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.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/pull.png-86930899bb5993aca09d11af6f1e0eb0.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/actors/players/playerE/pull.png"
dest_files=[ "res://.import/pull.png-86930899bb5993aca09d11af6f1e0eb0.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.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/push.png-83c0fa5d68432717ea8417b2150c5a91.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/actors/players/playerE/push.png"
dest_files=[ "res://.import/push.png-83c0fa5d68432717ea8417b2150c5a91.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.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/roll.png-eab6c0796978b2753ede3c92eeb8ee9f.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/actors/players/playerE/roll.png"
dest_files=[ "res://.import/roll.png-eab6c0796978b2753ede3c92eeb8ee9f.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.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/run-crouch.png-13dd70dd30935cf28b601677cc96319e.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/actors/players/playerE/run-crouch.png"
dest_files=[ "res://.import/run-crouch.png-13dd70dd30935cf28b601677cc96319e.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

View File

@ -54,10 +54,10 @@ func _process(delta):
# Not sure what should be called first here.
if has_method('_state_process_' + current_state.name):
call('_state_process_' + current_state.name)
process_animations()
#TODO: Not sure I want to do modifiers this way anymore
#process_state_modifier()
func _on_animation_finished():
#Disabling for now:
if frames.get_animation_loop(animation) == false:
#print("Stop!!!!!", current_state.animation_sequence.size(), " - ", current_state.animation_index)
if current_state.animation_sequence.size() > 0:
@ -66,6 +66,7 @@ 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
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
@ -73,7 +74,7 @@ func _on_animation_finished():
# 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 update_animation(enter_frame := 0, index := 0, suffix := ''):
func change_animation(enter_frame := 0, index := 0, suffix := ''):
## TODO:
# Need to find a way to attempt to keep and transfer the Index or frame
#
@ -149,7 +150,7 @@ func update_animation(enter_frame := 0, index := 0, suffix := ''):
print("Error! Resolved to empty animation sequence!?")
return
func process_animations():
func process_state_modifier():
var modifier :StateModifier = current_state.modifier
if modifier != null:
if modifier.state_timeout and modifier.state_timeout.time_left == 0:
@ -160,13 +161,13 @@ func process_animations():
modifier.TYPE.ANIMATION_SUFFIX:
# Attempt to seemlessly transition animations.
modifier = null
update_animation(frame,animation_index)
change_animation(frame,animation_index)
modifier.TYPE.REPLACE_ANIMATION:
if current_state.debug_state:
print("I don't have anything for replacements yet.")
modifier = null
update_animation()
change_animation()
_:
modifier = null
return
@ -216,13 +217,15 @@ func set_previous_animation( old_state: StateAnimatedActor, new_state: StateAnim
# Handle state change from subscribed state machine.
#From signal state_changed(old_state_name, new_state)
func _on_state_change(old_state_name:String, new_state :State):
print ("got the state change signal ", new_state.name)
print ("1? got the state change signal ", 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
update_animation()
change_animation()
if has_method('_on_state_change_' + current_state.name):
call('_on_state_change_' + current_state.name)
print("It's an animated Actor state!")
else:
push_warning("Received non animated Actor state.")

View File

@ -19,7 +19,6 @@ export var callable_state_machine :NodePath
var request_state_change: FuncRef
onready var desired_movement_vector: Vector2 = Vector2(0,0)
var current_movement_state: String
# Since animactor state machine can actually view properties from this type
# I'm thinking about moving the velocity tracker in here instead of player.
@ -27,13 +26,15 @@ var velocity = Vector2(0,0)
var momentum = Vector2(0,0)
var acceleration = Vector2(0,0)
var sim_velocity = Vector2(0,0)
#Removing Probably not used
#var sim_velocity = Vector2(0,0)
#Can't use floats here, switched to constants.
#enum directions {UP = -1, DOWN = 1, LEFT, RIGHT}
var attack_function: FuncRef
#Removing Probably not used
#var attack_function: FuncRef
const UP = -1.0
const DOWN = 1.0
@ -65,6 +66,8 @@ func process(delta):
# For event based input polling (Hadouken?)
func process_input(event: InputEvent):
# Reset desired movement vector
desired_movement_vector = Vector2(0,0)
if has_method('_state_process_input_' + current_state.name):
call('_state_process_input_' + current_state.name)
@ -110,12 +113,14 @@ 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)
#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
if has_method('_on_state_change_' + current_state.name):
call('_on_state_change_' + current_state.name)
else:
push_warning("Received non animated Actor state.")
#current_state = new_state
@ -297,7 +302,7 @@ func move_actor_as_desired(delta: float, x_move_direction_override: float = 0):
"\nVel:" + str(round(velocity.x)) + "Min:" + str(round(MIN_SPEED)) + ",Max:" + str(round(MAX_SPEED))
) # str(round(jerk))
sim_velocity.x = move_direction * sim_move_speed
#sim_velocity.x = move_direction * sim_move_speed
#print(adjusted_move_speed, ",", new_move_speed, ",", jerk)
#print(new_move_speed, " ", adjusted_move_speed)

View File

@ -9,13 +9,6 @@ extends State
##
## @WIP
# export (NodePath) var jump_node
# onready var jump_state: State = get_node(jump_node)
## Deprecated
# export var animation_name: String
# Movement Speed in Pixels Per Second
export var move_speed: float = 60
export var move_acceleration: float = 0
@ -23,24 +16,20 @@ export var move_speed_modifier: float = 0
export var move_modifier_move_acceleration: float = 0
export var jerk_factor: float = 0
var gravity: int = ProjectSettings.get_setting("physics/2d/default_gravity")
#var adjusted_move_speed: float
var jerk: float
var physics_modifier :StateModifier
var animation_finished: bool = false
# Not sure if this should be here. probably not
export(Array, String) var animation_sequence
# can't remember what this did
export(Dictionary) var emitter_frame_subscriptions
var frame_signal_emitted: bool = false
var gravity: int = ProjectSettings.get_setting("physics/2d/default_gravity")
# Modifiers may not be needed anymore.
var modifier: StateModifier
var physics_modifier :StateModifier
func enter() -> void:

View File

@ -247,6 +247,11 @@ dash_1={
common/enable_pause_aware_picking=true
2d/default_gravity=600
[physics]
2d/default_gravity=280
common/physics_interpolation=true
[rendering]
quality/driver/driver_name="GLES2"

View File

@ -2,15 +2,10 @@ extends AnimatedSprite_StateReceiver
func _ready():
# Lets see if this nutty thing works
var state_ref :State
# state_ref = get_node(callable_state_machine).get_state_reference('idle')
# state_ref.connect("state_entered", self, "_on_state_entered_idle")
state_ref = get_node(callable_state_machine).get_state_reference('fall')
state_ref.connect("state_entered", self, "_on_state_entered_fall")
# It works but node order really mattered.
# State machine needed to be processed first probably for ready function.
# good to know!
#var state_ref :State
#state_ref = get_node(callable_state_machine).get_state_reference('fall')
#state_ref.connect("state_entered", self, "_on_state_entered_fall")
pass
# I don't need this right now but I proved it can be done!
#func _state_process_idle():
@ -22,7 +17,20 @@ func _ready():
#func _on_state_entered_idle():
# print("Anim Knows Idle State Entered!")
func _on_state_entered_fall():
print("Anim Knows Fall State Entered!")
## Processing order is interesting here.
#Got call to enter state fall
#2? got the state change signal jump
#1? got the state change signal fall
#It's an animated Actor state!
## State signal comes before state machine. I'm not sure that's
## Good. Maybe I shouldn't subscribe to signals emitted by the state.
#func _on_state_entered_fall():
# print ("State Enter Signal ", current_state.name)
# frame = 2
# stop()
func _on_state_change_fall():
frame = 2
stop()

View File

@ -1,6 +1,13 @@
extends Movement_StateReceiver
#func _ready():
func _ready():
var state_ref :State
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.
state_ref.connect("state_entered", self, "_on_state_entered_" + state_name)
# Lets see if this nutty thing works
# var state_ref :State = get_node(callable_state_machine).get_state_reference('idle')
# state_ref.connect("state_entered", self, "_on_state_entered_idle")
@ -15,16 +22,38 @@ func get_movement_direction() -> float:
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))
func wants_jump() -> bool:
if Input.is_action_just_pressed("jump_" + str(player_number)):
desired_movement_vector.y = 1
return true
else:
return false
#TODO: 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():
get_movement_direction()
#func _state_process_physics_input_idle():
# get_movement_direction()
#
#func _state_process_physics_input_move():
# get_movement_direction()
func _state_process_physics_input_move():
# Probably better to do it this way then allocating individual
# state functions that all do the same thing.
func process_physics_input(delta):
# call the parent, Which would call the individuals
.process_physics_input(delta)
# then process movement controls
get_movement_direction()
wants_jump()
func _state_process_physics_idle():
if desired_movement_vector.y == 1:
request_state_change.call_func('jump')
#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')
@ -33,9 +62,28 @@ func _state_process_physics_idle():
#return fall_state
request_state_change.call_func('fall')
func _state_process_physics_land():
if current_state.animation_finished == true:
request_state_change.call_func('idle')
if !parent.is_on_floor():
#return fall_state
request_state_change.call_func('fall')
func _state_process_physics_fall():
if get_movement_direction() != 0.0:
parent.transform.x.x = get_movement_direction()
if desired_movement_vector.x != 0.0:
parent.transform.x.x = desired_movement_vector.x
if parent.is_on_floor():
#modifier.reference()
#idle_state.modifier = landing_modifier
request_state_change.call_func('land')
func _state_process_physics_jump():
if desired_movement_vector.x != 0.0:
parent.transform.x.x = desired_movement_vector.x
if velocity.y > 0:
request_state_change.call_func('fall')
if parent.is_on_floor():
#modifier.reference()
@ -44,8 +92,8 @@ func _state_process_physics_fall():
func _state_process_physics_move():
# flip sprite in direction
if get_movement_direction() != 0.0:
parent.transform.x.x = get_movement_direction()
if desired_movement_vector.x != 0.0:
parent.transform.x.x = desired_movement_vector.x
if desired_movement_vector.x == 0:
request_state_change.call_func('idle')
@ -56,4 +104,9 @@ func _state_process_physics_move():
#func _on_state_entered_idle():
# print("Movement State Idle State Entered!")
func _on_state_entered_jump():
#TODO: Make this a state variable
# I used to call it 'jump_force' like an idiot.
velocity.y = -200

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=11 format=2]
[gd_scene load_steps=13 format=2]
[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]
@ -7,22 +7,8 @@
[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://lib/classes/state_animated_actor.gd" type="Script" id=7]
[sub_resource type="Resource" id=2]
resource_local_to_scene = true
resource_name = "fall"
script = ExtResource( 7 )
debug_state = false
timeout_seconds = 0.0
name = "fall"
move_speed = 90.0
move_acceleration = 0.0
move_speed_modifier = 0.0
move_modifier_move_acceleration = 0.0
jerk_factor = 0.0
animation_sequence = [ "jump" ]
emitter_frame_subscriptions = {
}
[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]
[sub_resource type="Resource" id=3]
resource_name = "move"
@ -36,8 +22,20 @@ move_speed_modifier = 0.0
move_modifier_move_acceleration = 0.0
jerk_factor = 0.0
animation_sequence = [ "run" ]
emitter_frame_subscriptions = {
}
[sub_resource type="Resource" id=4]
resource_local_to_scene = true
resource_name = "land"
script = ExtResource( 7 )
debug_state = false
timeout_seconds = 0.0
name = "land"
move_speed = 30.0
move_acceleration = 0.0
move_speed_modifier = 0.0
move_modifier_move_acceleration = 0.0
jerk_factor = 0.0
animation_sequence = [ "land" ]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 7, 14 )
@ -48,7 +46,7 @@ actor_type = "Player"
[node name="Movement_StateMachine" parent="." index="0"]
starting_state_name = "idle"
states = [ ExtResource( 4 ), SubResource( 2 ), SubResource( 3 ) ]
states = [ ExtResource( 4 ), ExtResource( 9 ), SubResource( 3 ), ExtResource( 8 ), SubResource( 4 ) ]
[node name="AnimatedSprite_StateReceiver" parent="." index="1"]
frames = ExtResource( 2 )
@ -58,12 +56,12 @@ __meta__ = {
"layer": "",
"o_ex_p": "-.*",
"o_folder": "res://assets/actors/players/playerE",
"o_name": "run",
"o_name": "pull",
"only_visible": true,
"op_exp": true,
"sf_name": "PlayerE_SpriteFrames",
"slice": "",
"source": "/home/relay01/Assets/Library/Asset Packs 1-5/Asset Packs 1-4 (final)/Asset Pack-V1/Player Run/player run 48x48.aseprite"
"source": "/home/relay01/Assets/Library/Asset Packs 1-5/Asset Packs 1-4 (final)/Asset Pack-V2/Pull/player pull 48x48.aseprite"
}
}

View File

@ -0,0 +1,17 @@
[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 = "fall"
script = ExtResource( 1 )
debug_state = false
timeout_seconds = 0.0
name = "fall"
move_speed = 90.0
move_acceleration = 0.0
move_speed_modifier = 0.0
move_modifier_move_acceleration = 0.0
jerk_factor = 0.0
animation_sequence = [ "jump" ]

View File

@ -15,5 +15,3 @@ move_speed_modifier = 0.0
move_modifier_move_acceleration = 0.0
jerk_factor = 0.0
animation_sequence = [ "idle" ]
emitter_frame_subscriptions = {
}

View File

@ -0,0 +1,17 @@
[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 = "jump"
script = ExtResource( 1 )
debug_state = false
timeout_seconds = 0.0
name = "jump"
move_speed = 90.0
move_acceleration = 0.0
move_speed_modifier = 0.0
move_modifier_move_acceleration = 0.0
jerk_factor = 0.0
animation_sequence = [ "jump" ]