This commit is contained in:
baldas_h 2020-04-04 17:11:22 +02:00
commit dd17fce575
4 changed files with 97 additions and 13 deletions

View File

@ -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
}

View File

@ -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

View File

@ -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()

View File

@ -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"
@ -53,24 +53,60 @@ texture={
[input]
ui_left={
"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":16777231,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null)
]
}
ui_right={
"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":16777233,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null)
]
}
ui_up={
"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":16777232,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null)
]
}
ui_down={
"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":16777234,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null)
]
}
ui_right2={
"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":68,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":1,"button_index":15,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":1,"axis":0,"axis_value":1.0,"script":null)
]
}
ui_left2={
"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":81,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":1,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":1,"axis":0,"axis_value":-1.0,"script":null)
]
}
ui_up2={
"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":90,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":1,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":1,"axis":1,"axis_value":-1.0,"script":null)
]
}
ui_down2={
"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":83,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":1,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":1,"axis":1,"axis_value":1.0,"script":null)
]
}