diff --git a/Scene/TestScene.tscn b/Scene/TestScene.tscn index ad10279..0053a74 100644 --- a/Scene/TestScene.tscn +++ b/Scene/TestScene.tscn @@ -36,9 +36,13 @@ position = Vector2( 305.804, 276.773 ) scriptName = "res://Scripts/PaintEffects/Upscale.gd" [node name="Clopinette3" parent="." instance=ExtResource( 3 )] -position = Vector2( 580.834, 292.621 ) +position = Vector2( 459.898, 280.888 ) scriptName = "res://Scripts/PaintEffects/Downscale.gd" +[node name="Clopinette4" parent="." instance=ExtResource( 3 )] +position = Vector2( 604.527, 280.888 ) +scriptName = "res://Scripts/PaintEffects/ConfuseDirections.gd" + [node name="Label" type="Label" parent="."] margin_left = 67.496 margin_top = 232.645 @@ -60,11 +64,21 @@ __meta__ = { } [node name="Label3" type="Label" parent="."] -margin_left = 551.169 -margin_top = 251.979 -margin_right = 635.169 -margin_bottom = 265.979 +margin_left = 419.404 +margin_top = 238.441 +margin_right = 503.404 +margin_bottom = 252.441 text = "Gnomisme" __meta__ = { "_edit_use_anchors_": false } + +[node name="Label4" type="Label" parent="."] +margin_left = 564.032 +margin_top = 238.441 +margin_right = 648.032 +margin_bottom = 252.441 +text = "Confusion" +__meta__ = { +"_edit_use_anchors_": false +} diff --git a/Scripts/PaintEffects/ConfuseDirections.gd b/Scripts/PaintEffects/ConfuseDirections.gd new file mode 100644 index 0000000..95cfc11 --- /dev/null +++ b/Scripts/PaintEffects/ConfuseDirections.gd @@ -0,0 +1,24 @@ +extends Node + +export var Duration = 7.5 + +func shuffleList(list): + var shuffledList = [] + var indexList = range(list.size()) + for i in range(list.size()): + var x = randi() % indexList.size() + shuffledList.append(list[indexList[x]]) + indexList.remove(x) + return shuffledList + +func ConfusionRoutine(player, delta): + var elapsed = 0 + var inputs = player.baseInputs + player.inputs = shuffleList(inputs) + while elapsed < Duration: + elapsed += yield() + player.inputs = player.baseInputs + +func StartEffect(player): + var rout = ConfusionRoutine(player, 0) + return rout diff --git a/Scripts/Player.gd b/Scripts/Player.gd index 2f21ca2..9708759 100644 --- a/Scripts/Player.gd +++ b/Scripts/Player.gd @@ -10,6 +10,16 @@ var curLife = MAX_LIFE var coroutines = [] +enum EInput{ + UP, + RIGHT, + DOWN, + LEFT +} + +const baseInputs = ["ui_up", "ui_right", "ui_down", "ui_left"] +var inputs = ["ui_up", "ui_right", "ui_down", "ui_left"] + onready var animationPlayer = $AnimationPlayer onready var animationTree = $AnimationTree onready var animationState = animationTree.get("parameters/playback") @@ -25,11 +35,11 @@ func _physics_process(delta): var input_vector = Vector2.ZERO if self.name == "Player1": - input_vector.x = Input.get_action_strength("ui_right") - Input.get_action_strength("ui_left") - input_vector.y = Input.get_action_strength("ui_down") - Input.get_action_strength("ui_up") + input_vector.x = Input.get_action_strength(inputs[EInput.RIGHT]) - Input.get_action_strength(inputs[EInput.LEFT]) + input_vector.y = Input.get_action_strength(inputs[EInput.DOWN]) - Input.get_action_strength(inputs[EInput.UP]) elif self.name == "Player2": - input_vector.x = Input.get_action_strength("ui_right2") - Input.get_action_strength("ui_left2") - input_vector.y = Input.get_action_strength("ui_down2") - Input.get_action_strength("ui_up2") + input_vector.x = Input.get_action_strength(inputs[EInput.RIGHT] + "2") - Input.get_action_strength(inputs[EInput.LEFT] + "2") + input_vector.y = Input.get_action_strength(inputs[EInput.DOWN] + "2") - Input.get_action_strength(inputs[EInput.UP] + "2") input_vector = input_vector.normalized() diff --git a/project.godot b/project.godot index 3e7ba44..aac06aa 100644 --- a/project.godot +++ b/project.godot @@ -21,10 +21,10 @@ config/icon="res://icon.png" [display] -window/size/width=320 -window/size/height=180 -window/size/test_width=1280 -window/size/test_height=720 +window/size/width=1920 +window/size/height=1080 +window/size/test_width=1920 +window/size/test_height=1080 window/stretch/mode="2d" window/stretch/aspect="keep"