Fixed confuseDirections

This commit is contained in:
Hurlu 2020-04-05 10:48:29 +02:00
parent 0c59fbccc7
commit cc7ec9f185
8 changed files with 87 additions and 9 deletions

BIN
Assets/zétoile.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 835 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/zétoile.png-95e033ce52b6e389eaf579da15f7aac5.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/zétoile.png"
dest_files=[ "res://.import/zétoile.png-95e033ce52b6e389eaf579da15f7aac5.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

View File

@ -20,6 +20,7 @@ margin_top = 39.6669
margin_right = 332.0 margin_right = 332.0
margin_bottom = 79.6669 margin_bottom = 79.6669
rect_scale = Vector2( 1.75, 1.75 ) rect_scale = Vector2( 1.75, 1.75 )
step = 0.1
value = 99.0 value = 99.0
texture_under = ExtResource( 3 ) texture_under = ExtResource( 3 )
texture_over = ExtResource( 2 ) texture_over = ExtResource( 2 )

View File

@ -1,7 +1,8 @@
[gd_scene load_steps=26 format=2] [gd_scene load_steps=28 format=2]
[ext_resource path="res://Assets/spriteset test.png" type="Texture" id=1] [ext_resource path="res://Assets/spriteset test.png" type="Texture" id=1]
[ext_resource path="res://Scripts/Player.gd" type="Script" id=2] [ext_resource path="res://Scripts/Player.gd" type="Script" id=2]
[ext_resource path="res://Assets/zétoile.png" type="Texture" id=3]
[sub_resource type="RectangleShape2D" id=1] [sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 15.5015, 46.849 ) extents = Vector2( 15.5015, 46.849 )
@ -202,6 +203,11 @@ start_node = "Idle"
[sub_resource type="AnimationNodeStateMachinePlayback" id=23] [sub_resource type="AnimationNodeStateMachinePlayback" id=23]
[sub_resource type="Curve2D" id=24]
_data = {
"points": PoolVector2Array( -15.7724, -10.548, 15.7724, 10.548, 79.9353, -88.996, 8.91483, -9.7366, -8.91483, 9.7366, 75.135, -62.2204, 10.2863, 13.7935, -10.2863, -13.7935, -33.2145, -63.0318, -10.2863, 9.7366, 10.2863, -9.7366, -16.7564, -88.1847, -14.4009, 13.7935, 14.4009, -13.7935, -16.7564, -88.996, -6.85756, -19.4732, 6.85756, 19.4732, 79.9353, -88.996 )
}
[node name="KinematicBody2D" type="KinematicBody2D"] [node name="KinematicBody2D" type="KinematicBody2D"]
script = ExtResource( 2 ) script = ExtResource( 2 )
@ -231,3 +237,33 @@ active = true
parameters/playback = SubResource( 23 ) parameters/playback = SubResource( 23 )
parameters/Idle/blend_position = Vector2( -1.1, 0.0314158 ) parameters/Idle/blend_position = Vector2( -1.1, 0.0314158 )
parameters/Run/blend_position = Vector2( -0.0925897, 0.517895 ) parameters/Run/blend_position = Vector2( -0.0925897, 0.517895 )
[node name="ConfusionStars" type="Node2D" parent="."]
[node name="Path2D" type="Path2D" parent="ConfusionStars"]
position = Vector2( -19.4617, -21.2425 )
scale = Vector2( 0.731191, 0.591658 )
curve = SubResource( 24 )
[node name="PathFollow2D" type="PathFollow2D" parent="ConfusionStars/Path2D"]
position = Vector2( 79.9353, -88.996 )
rotation = 0.639347
rotate = false
[node name="Sprite" type="Sprite" parent="ConfusionStars/Path2D/PathFollow2D"]
position = Vector2( 0.823479, -2.89215 )
rotation = -0.639347
scale = Vector2( 1.1136, 1.2906 )
texture = ExtResource( 3 )
[node name="PathFollow2D2" type="PathFollow2D" parent="ConfusionStars/Path2D"]
position = Vector2( -18.8506, -56.7147 )
rotation = 0.639347
offset = 129.76
rotate = false
[node name="Sprite" type="Sprite" parent="ConfusionStars/Path2D/PathFollow2D2"]
position = Vector2( 0.823479, -2.89215 )
rotation = -0.639347
scale = Vector2( 1.1136, 1.2906 )
texture = ExtResource( 3 )

View File

@ -11,8 +11,7 @@ var scripts = ["res://Scripts/PaintEffects/ConfuseDirections.gd",
"res://Scripts/PaintEffects/Upscale.gd"] "res://Scripts/PaintEffects/Upscale.gd"]
func spawnBucket(): func spawnBucket():
var newBucket = bucket.instance() var newBucket = bucket.instance()
newBucket.scriptName = scripts[randi() % scripts.size()]
self.get_parent().add_child(newBucket) self.get_parent().add_child(newBucket)
newBucket.add_to_group("bucket") newBucket.add_to_group("bucket")
newBucket.set_position(spawnPoints[randi() % spawnPoints.size()].get_position()) newBucket.set_position(spawnPoints[randi() % spawnPoints.size()].get_position())

View File

@ -1,12 +1,9 @@
extends Control extends Control
onready var healthBar = $HealthBar onready var healthBar = $HealthBar
onready var updateTween = $UpdateTween
func healthUpdated(health): func healthUpdated(health):
healthBar.value = health healthBar.value = health
updateTween.interpolate_property(healthBar, "value", health, 0.2, Tween.TRANS_SINE, Tween.EASE_IN_OUT)
updateTween.start()
func maxHealthUpdated(maxHealth): func maxHealthUpdated(maxHealth):
healthBar.max_value = maxHealth healthBar.max_value = maxHealth

View File

@ -3,13 +3,15 @@ extends Node
export var Duration = 7.5 export var Duration = 7.5
func ConfusionRoutine(player, delta): func ConfusionRoutine(player, delta):
var elapsed = 0 player.get_node("ConfusionStars").visible = true
var inputs = player.baseInputs var elapsed = delta
var inputs = player.baseInputs + []
inputs.shuffle() inputs.shuffle()
player.inputs = inputs player.inputs = inputs
while elapsed < Duration: while elapsed < Duration:
elapsed += yield() elapsed += yield()
player.inputs = player.baseInputs player.inputs = player.baseInputs
player.get_node("ConfusionStars").visible = false
func StartEffect(player): func StartEffect(player):
var rout = ConfusionRoutine(player, 0) var rout = ConfusionRoutine(player, 0)

View File

@ -5,6 +5,10 @@ var ACCELERATION = 1800
var FRICTION = 2000 var FRICTION = 2000
var MAX_LIFE = 30 var MAX_LIFE = 30
const PICKUP_BONUS = 5 const PICKUP_BONUS = 5
export var rota_speed = 100
var follow1;
var follow2;
var vel = Vector2.ZERO var vel = Vector2.ZERO
var curLife = MAX_LIFE var curLife = MAX_LIFE
@ -27,6 +31,9 @@ onready var animationState = animationTree.get("parameters/playback")
var healthBar = null var healthBar = null
func _ready(): func _ready():
get_node("ConfusionStars").visible = false
follow1 = get_node("ConfusionStars/Path2D/PathFollow2D")
follow2 = get_node("ConfusionStars/Path2D/PathFollow2D2")
if self.name == "Player1": if self.name == "Player1":
healthBar = get_tree().get_nodes_in_group("healthbar")[0] healthBar = get_tree().get_nodes_in_group("healthbar")[0]
elif self.name == "Player2": elif self.name == "Player2":
@ -34,6 +41,8 @@ func _ready():
healthBar.maxHealthUpdated(MAX_LIFE) healthBar.maxHealthUpdated(MAX_LIFE)
func _process(delta): func _process(delta):
follow1.set_offset(follow1.get_offset() + delta * rota_speed)
follow2.set_offset(follow2.get_offset() + delta * rota_speed)
updatePaintEffects(delta) updatePaintEffects(delta)
curLife -= delta curLife -= delta
if curLife <= 0: if curLife <= 0: