mirror of
https://github.com/kristoferssolo/FuncIt.git
synced 2025-10-21 19:30:35 +00:00
[Medium] Implement phases
This commit is contained in:
parent
a3b67d7203
commit
589392a1b8
@ -146,15 +146,15 @@ func process_rotation():
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
user_input = UIN_preset_pre_processor_instance.update()
|
||||
enter_phase_limits()
|
||||
if get_tree().is_network_server():
|
||||
Global.phase_update_global()
|
||||
clientPhase = Global.get_current_phase()
|
||||
print("MASTER:",clientPhase)
|
||||
else:
|
||||
if puppet_phase != null:
|
||||
clientPhase = puppet_phase
|
||||
Global.set_current_phase(clientPhase)
|
||||
print("SLAVE:",clientPhase)
|
||||
$"weaponHolder/Player-character-theme-gun".play(theme)
|
||||
particleImage.load("res://source/assets/sprites/character/player/theme/" + theme + "/na/Player-character-theme-particle-"+theme+".png")
|
||||
particleTexture.create_from_image(particleImage)
|
||||
@ -167,7 +167,6 @@ func _process(delta: float) -> void:
|
||||
elif $Particles2D.position.x < 0 and direction != "right":
|
||||
$Particles2D.position = Vector2(-$Particles2D.position.x,$Particles2D.position.y)
|
||||
$Particles2D.scale = -$Particles2D.scale
|
||||
user_input = UIN_preset_pre_processor_instance.update()
|
||||
user_state = get_user_state()
|
||||
dimensions = get_dimensions()
|
||||
VDIR = VDIR_preset_pre_processor_instance.update(user_state, dimensions)
|
||||
@ -261,7 +260,7 @@ func _physics_process(delta) -> void:
|
||||
rotate_weapon()
|
||||
choose_trajectory()
|
||||
enable_trajectory_line(trajectory_line)
|
||||
if Input.is_action_just_released("input_shoot") and can_shoot and not is_reloading:
|
||||
if user_input["shoot"] and can_shoot and not is_reloading:
|
||||
rpc("shoot", trajectory, get_tree().get_network_unique_id())
|
||||
is_reloading = true
|
||||
reload_timer.start()
|
||||
@ -480,5 +479,30 @@ func rotate_weapon():
|
||||
$"weaponHolder/Player-character-theme-gun".rotation_degrees = weaponAngle
|
||||
pass
|
||||
|
||||
|
||||
|
||||
func enter_phase_limits():
|
||||
if clientPhase != null and clientPhase["active"] != null:
|
||||
if clientPhase["active"]["phase_id"] == 0:
|
||||
user_input["r_inc"] = false
|
||||
user_input["r_dec"] = false
|
||||
user_input["shoot"] = false
|
||||
elif clientPhase["active"]["phase_id"] == 1:
|
||||
user_input["left"] = false
|
||||
user_input["right"] = false
|
||||
user_input["up"] = false
|
||||
user_input["down"] = false
|
||||
user_input["shoot"] = false
|
||||
elif clientPhase["active"]["phase_id"] == 2:
|
||||
user_input["left"] = false
|
||||
user_input["right"] = false
|
||||
user_input["up"] = false
|
||||
user_input["down"] = false
|
||||
user_input["r_inc"] = false
|
||||
user_input["r_dec"] = false
|
||||
else:
|
||||
user_input["left"] = false
|
||||
user_input["right"] = false
|
||||
user_input["up"] = false
|
||||
user_input["down"] = false
|
||||
user_input["r_inc"] = false
|
||||
user_input["r_dec"] = false
|
||||
user_input["shoot"] = false
|
||||
|
||||
@ -11,7 +11,8 @@ func _init() -> void:
|
||||
"debug": false,
|
||||
"enter": false,
|
||||
"r_inc": false,
|
||||
"r_dec": false
|
||||
"r_dec": false,
|
||||
"shoot": false
|
||||
}
|
||||
pass
|
||||
|
||||
@ -25,6 +26,7 @@ func update():
|
||||
"boost": Input.is_action_pressed("input_shift"),
|
||||
"enter": Input.is_action_pressed("input_enter"),
|
||||
"r_inc": Input.is_action_pressed("rotation_increase"),
|
||||
"r_dec": Input.is_action_pressed("rotation_decrease")
|
||||
"r_dec": Input.is_action_pressed("rotation_decrease"),
|
||||
"shoot": Input.is_action_pressed("input_shoot")
|
||||
}
|
||||
return inputState
|
||||
|
||||
@ -6,21 +6,25 @@ var alive_players = []
|
||||
|
||||
var clientPhase = {
|
||||
"0": {
|
||||
"phase_id": 0,
|
||||
"phase_name": "Movement phase",
|
||||
"length": 2,
|
||||
"start_time": null
|
||||
},
|
||||
"1": {
|
||||
"phase_id": 1,
|
||||
"phase_name": "Weapon adjustment phase",
|
||||
"length": 2,
|
||||
"start_time": null
|
||||
},
|
||||
"2": {
|
||||
"phase_id": 2,
|
||||
"phase_name": "Bullet simulation phase",
|
||||
"length": 2,
|
||||
"start_time": null
|
||||
},
|
||||
"3": {
|
||||
"phase_id": 3,
|
||||
"phase_name": "Idle phase",
|
||||
"length": 2,
|
||||
"start_time": null
|
||||
@ -37,7 +41,7 @@ func phase_update_global():
|
||||
if activePhaseTracker != null:
|
||||
if clientPhase[str(activePhaseTracker)]["start_time"] != null:
|
||||
if currentTime["second"] + currentTime["minute"] * 60 - clientPhase[str(activePhaseTracker)]["start_time"]["second"] - clientPhase[str(activePhaseTracker)]["start_time"]["minute"] * 60 > clientPhase[str(activePhaseTracker)]["length"]:
|
||||
if activePhaseTracker == clientPhase.size - 1:
|
||||
if activePhaseTracker == clientPhase.size() - 2:
|
||||
clientPhase[str(activePhaseTracker)]["start_time"] = null
|
||||
activePhaseTracker = 0
|
||||
else:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user