I have bug. both players jump. Resources need to be unique per player somehow.
This commit is contained in:
parent
b5d9e9268c
commit
45cff3f039
|
|
@ -284,8 +284,8 @@ crouch_1={
|
||||||
}
|
}
|
||||||
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(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)
|
, 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)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
dash_1={
|
dash_1={
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,8 @@ 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"]:
|
||||||
desired_movement_vector.y = UP
|
##Bugfix: Both players jump.
|
||||||
|
#desired_movement_vector.y = UP
|
||||||
_wants_jump = true
|
_wants_jump = true
|
||||||
return true
|
return true
|
||||||
else:
|
else:
|
||||||
|
|
@ -130,7 +131,8 @@ 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():
|
||||||
if desired_movement_vector.y == UP:
|
##Bugfix
|
||||||
|
if _wants_jump:
|
||||||
request_state_change.call_func('jump')
|
request_state_change.call_func('jump')
|
||||||
|
|
||||||
if _wants_crouch == true:
|
if _wants_crouch == true:
|
||||||
|
|
@ -303,7 +305,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 desired_movement_vector.y == UP:
|
if _wants_jump:
|
||||||
request_state_change.call_func('jump')
|
request_state_change.call_func('jump')
|
||||||
|
|
||||||
if desired_movement_vector.x == 0:
|
if desired_movement_vector.x == 0:
|
||||||
|
|
@ -428,6 +430,7 @@ 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,5 +18,6 @@ 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):
|
||||||
# pass
|
if PlayerInfo.get_player_data(player_number - 1) == null:
|
||||||
|
visible = false
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user