mirror of
https://github.com/kristoferssolo/FuncIt.git
synced 2025-10-21 19:30:35 +00:00
[Minimal] Handler and Manager script update
This commit is contained in:
parent
2589c313a4
commit
865accacca
@ -1,4 +1,5 @@
|
|||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
func _ready():
|
func update(userStateInstance):
|
||||||
|
userStateInstance.rotateBy(-1)
|
||||||
pass
|
pass
|
||||||
|
|||||||
@ -15,15 +15,23 @@ var physicsManagerInstance = preload("res://source/assets/scripts/controllers/ma
|
|||||||
|
|
||||||
# Local class variables
|
# Local class variables
|
||||||
var vectoralDirectionPreset
|
var vectoralDirectionPreset
|
||||||
|
var userInput
|
||||||
|
var userState
|
||||||
|
var VDIR
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
vectoralDirectionPreset = vectoralDirectionPresetInstance.getState()
|
vectoralDirectionPreset = vectoralDirectionPresetInstance.getState(userStateInstance.update())
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
# Update data-handler returned states
|
# Update data-handler returned states
|
||||||
var userInput = userInputInstance.update()
|
userInput = userInputInstance.update()
|
||||||
var userState = userStateInstance.update()
|
userState = userStateInstance.update()
|
||||||
# Send the returned states through processors
|
# Send the returned states through processors
|
||||||
var VDIR = VDIRprocessorInstance.process(userState, vectoralDirectionPreset)
|
VDIR = VDIRprocessorInstance.process(userState, vectoralDirectionPreset)
|
||||||
# Give the resulting data to game controllers
|
# Give the resulting data to game controllers
|
||||||
|
physicsManagerInstance.update(userStateInstance)
|
||||||
|
physics_process(delta)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
func physics_process(delta):
|
||||||
|
rotation_degrees = userState["rotation"]
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
extends Node2D
|
extends Node2D
|
||||||
|
|
||||||
func _ready():
|
func statePassback():
|
||||||
pass
|
return {"node_global_position": transform.origin, "rotation": null}
|
||||||
|
|
||||||
func set_scale(scale):
|
func set_scale(scale) -> void:
|
||||||
$player_body/player_sprite_na.scale = Vector2(scale, scale)
|
$player_body/player_sprite_na.scale = Vector2(scale, scale)
|
||||||
$player_body/player_sprite.scale = Vector2(scale, scale)
|
$player_body/player_sprite.scale = Vector2(scale, scale)
|
||||||
$player_body/player_collider.scale = Vector2(scale, scale)
|
$player_body/player_collider.scale = Vector2(scale, scale)
|
||||||
|
|||||||
@ -2,14 +2,15 @@ extends Node
|
|||||||
|
|
||||||
var userState = {}
|
var userState = {}
|
||||||
|
|
||||||
func _init() -> void:
|
var rotationalTracker = 0
|
||||||
userState = {
|
|
||||||
"state": false
|
func rotateBy(amount):
|
||||||
}
|
rotationalTracker += amount
|
||||||
pass
|
if rotationalTracker == 361: rotationalTracker = 1
|
||||||
|
elif rotationalTracker == -361: rotationalTracker = -1
|
||||||
|
|
||||||
func update():
|
func update():
|
||||||
userState = {
|
userState = preload("res://source/assets/scripts/handlers/character/player/player_node_handler.gd").new().statePassback()
|
||||||
"state": true
|
# IF necessary process and update and correct userState
|
||||||
}
|
userState["rotation"] = rotationalTracker
|
||||||
return userState
|
return userState
|
||||||
|
|||||||
@ -2,7 +2,7 @@ extends Node
|
|||||||
|
|
||||||
var vectoralState = {}
|
var vectoralState = {}
|
||||||
|
|
||||||
func _ready() -> void:
|
func getState(userState):
|
||||||
vectoralState = {
|
vectoralState = {
|
||||||
"0": { # Source (Client) positional rotation vectors
|
"0": { # Source (Client) positional rotation vectors
|
||||||
"0": { # Primary source positional vector
|
"0": { # Primary source positional vector
|
||||||
@ -56,7 +56,4 @@ func _ready() -> void:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pass
|
|
||||||
|
|
||||||
func getState():
|
|
||||||
return vectoralState
|
return vectoralState
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user