Compare commits
No commits in common. "f67fdbbe3ef758881b26b970bbda52f61d54db38" and "b5d9e9268c66e5137b3aae9fbe6b2c06804a94c2" have entirely different histories.
f67fdbbe3e
...
b5d9e9268c
|
|
@ -36,15 +36,14 @@ func _ready():
|
||||||
#check for unique state name
|
#check for unique state name
|
||||||
if !(states_index.has(this_state.name)):
|
if !(states_index.has(this_state.name)):
|
||||||
# call setup
|
# call setup
|
||||||
var dupe_state = this_state.duplicate()
|
this_state.setup()
|
||||||
dupe_state.setup()
|
|
||||||
if debug_state_machine:
|
if debug_state_machine:
|
||||||
print("Initializing State Node: ", s)
|
print("Initializing State Node: ", s)
|
||||||
dupe_state.debug_state = true
|
this_state.debug_state = true
|
||||||
if dupe_state.state_timeout != null:
|
if this_state.state_timeout != null:
|
||||||
add_child(dupe_state.state_timeout)
|
add_child(this_state.state_timeout)
|
||||||
# Add to state index
|
# Add to state index
|
||||||
states_index[dupe_state.name] = dupe_state
|
states_index[this_state.name] = this_state
|
||||||
else:
|
else:
|
||||||
push_error("Multiple states with same name in: ")
|
push_error("Multiple states with same name in: ")
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -284,8 +284,8 @@ crouch_1={
|
||||||
}
|
}
|
||||||
jump_1={
|
jump_1={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [ Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":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(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"physical_scancode":0,"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)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
dash_1={
|
dash_1={
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,7 @@ func get_movement_direction() -> float:
|
||||||
var _wants_jump :bool
|
var _wants_jump :bool
|
||||||
func wants_jump() -> bool:
|
func wants_jump() -> bool:
|
||||||
if Input.is_action_just_pressed("jump_" + str(player_number)) and stamina_component.stamina >= state_stamina_cost["jump"]:
|
if Input.is_action_just_pressed("jump_" + str(player_number)) and stamina_component.stamina >= state_stamina_cost["jump"]:
|
||||||
##Bugfix: Both players jump.
|
desired_movement_vector.y = UP
|
||||||
#desired_movement_vector.y = UP
|
|
||||||
_wants_jump = true
|
_wants_jump = true
|
||||||
return true
|
return true
|
||||||
else:
|
else:
|
||||||
|
|
@ -131,8 +130,7 @@ func flip_sprite_to_movement_direction():
|
||||||
parent.transform.x.x = desired_movement_vector.x
|
parent.transform.x.x = desired_movement_vector.x
|
||||||
|
|
||||||
func _state_process_physics_idle():
|
func _state_process_physics_idle():
|
||||||
##Bugfix
|
if desired_movement_vector.y == UP:
|
||||||
if _wants_jump:
|
|
||||||
request_state_change.call_func('jump')
|
request_state_change.call_func('jump')
|
||||||
|
|
||||||
if _wants_crouch == true:
|
if _wants_crouch == true:
|
||||||
|
|
@ -305,7 +303,7 @@ func _state_process_physics_move():
|
||||||
# flip sprite in direction
|
# flip sprite in direction
|
||||||
flip_sprite_to_movement_direction()
|
flip_sprite_to_movement_direction()
|
||||||
|
|
||||||
if _wants_jump:
|
if desired_movement_vector.y == UP:
|
||||||
request_state_change.call_func('jump')
|
request_state_change.call_func('jump')
|
||||||
|
|
||||||
if desired_movement_vector.x == 0:
|
if desired_movement_vector.x == 0:
|
||||||
|
|
@ -430,7 +428,6 @@ func _state_process_physics_crouch_move():
|
||||||
# print("Movement State Idle State Entered!")
|
# print("Movement State Idle State Entered!")
|
||||||
|
|
||||||
func _on_state_entered_jump():
|
func _on_state_entered_jump():
|
||||||
print ("how many times do I get called?")
|
|
||||||
#TODO: Make this a state variable
|
#TODO: Make this a state variable
|
||||||
# I used to call it 'jump_force' like an idiot.
|
# I used to call it 'jump_force' like an idiot.
|
||||||
velocity.y = -200
|
velocity.y = -200
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,5 @@ func _ready():
|
||||||
selected_inventory_items.set_player_number(player_number)
|
selected_inventory_items.set_player_number(player_number)
|
||||||
|
|
||||||
# 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):
|
||||||
if PlayerInfo.get_player_data(player_number - 1) == null:
|
# pass
|
||||||
visible = false
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user