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
|
||||
|
||||
func _ready():
|
||||
func update(userStateInstance):
|
||||
userStateInstance.rotateBy(-1)
|
||||
pass
|
||||
|
||||
@ -15,15 +15,23 @@ var physicsManagerInstance = preload("res://source/assets/scripts/controllers/ma
|
||||
|
||||
# Local class variables
|
||||
var vectoralDirectionPreset
|
||||
var userInput
|
||||
var userState
|
||||
var VDIR
|
||||
|
||||
func _ready():
|
||||
vectoralDirectionPreset = vectoralDirectionPresetInstance.getState()
|
||||
vectoralDirectionPreset = vectoralDirectionPresetInstance.getState(userStateInstance.update())
|
||||
|
||||
func _process(delta):
|
||||
# Update data-handler returned states
|
||||
var userInput = userInputInstance.update()
|
||||
var userState = userStateInstance.update()
|
||||
userInput = userInputInstance.update()
|
||||
userState = userStateInstance.update()
|
||||
# Send the returned states through processors
|
||||
var VDIR = VDIRprocessorInstance.process(userState, vectoralDirectionPreset)
|
||||
VDIR = VDIRprocessorInstance.process(userState, vectoralDirectionPreset)
|
||||
# Give the resulting data to game controllers
|
||||
physicsManagerInstance.update(userStateInstance)
|
||||
physics_process(delta)
|
||||
pass
|
||||
|
||||
func physics_process(delta):
|
||||
rotation_degrees = userState["rotation"]
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
extends Node2D
|
||||
|
||||
func _ready():
|
||||
pass
|
||||
func statePassback():
|
||||
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.scale = Vector2(scale, scale)
|
||||
$player_body/player_collider.scale = Vector2(scale, scale)
|
||||
|
||||
@ -2,14 +2,15 @@ extends Node
|
||||
|
||||
var userState = {}
|
||||
|
||||
func _init() -> void:
|
||||
userState = {
|
||||
"state": false
|
||||
}
|
||||
pass
|
||||
var rotationalTracker = 0
|
||||
|
||||
func rotateBy(amount):
|
||||
rotationalTracker += amount
|
||||
if rotationalTracker == 361: rotationalTracker = 1
|
||||
elif rotationalTracker == -361: rotationalTracker = -1
|
||||
|
||||
func update():
|
||||
userState = {
|
||||
"state": true
|
||||
}
|
||||
userState = preload("res://source/assets/scripts/handlers/character/player/player_node_handler.gd").new().statePassback()
|
||||
# IF necessary process and update and correct userState
|
||||
userState["rotation"] = rotationalTracker
|
||||
return userState
|
||||
|
||||
@ -2,7 +2,7 @@ extends Node
|
||||
|
||||
var vectoralState = {}
|
||||
|
||||
func _ready() -> void:
|
||||
func getState(userState):
|
||||
vectoralState = {
|
||||
"0": { # Source (Client) positional rotation vectors
|
||||
"0": { # Primary source positional vector
|
||||
@ -56,7 +56,4 @@ func _ready() -> void:
|
||||
}
|
||||
}
|
||||
}
|
||||
pass
|
||||
|
||||
func getState():
|
||||
return vectoralState
|
||||
|
||||
Loading…
Reference in New Issue
Block a user