Skip to content

Commit

Permalink
Added colored Stand do indicate selected element
Browse files Browse the repository at this point in the history
  • Loading branch information
rockrick1 committed Nov 13, 2017
1 parent e55feb8 commit daadb78
Show file tree
Hide file tree
Showing 4 changed files with 161 additions and 31 deletions.
165 changes: 146 additions & 19 deletions Scenes/Character.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,17 @@ height = 25.0

[sub_resource type="SpriteFrames" id=2]

animations = [ { "frames":[ ExtResource( 2 ), ExtResource( 3 ), ExtResource( 4 ), ExtResource( 5 ), ExtResource( 6 ), ExtResource( 7 ), ExtResource( 8 ), ExtResource( 9 ), ExtResource( 10 ), ExtResource( 11 ), ExtResource( 12 ), ExtResource( 13 ), ExtResource( 14 ), ExtResource( 15 ), ExtResource( 16 ), ExtResource( 17 ), ExtResource( 18 ), ExtResource( 19 ), ExtResource( 20 ), ExtResource( 21 ), ExtResource( 22 ), ExtResource( 23 ), ExtResource( 24 ), ExtResource( 25 ), ExtResource( 26 ), ExtResource( 27 ), ExtResource( 28 ), ExtResource( 29 ), ExtResource( 30 ), ExtResource( 31 ), ExtResource( 32 ), ExtResource( 33 ), ExtResource( 34 ), ExtResource( 35 ), ExtResource( 36 ), ExtResource( 37 ), ExtResource( 38 ), ExtResource( 39 ), ExtResource( 40 ), ExtResource( 41 ), ExtResource( 42 ), ExtResource( 43 ), ExtResource( 44 ), ExtResource( 45 ) ], "loop":true, "name":"Skeleton", "speed":5.0 }, { "frames":[ ExtResource( 46 ), ExtResource( 47 ), ExtResource( 48 ), ExtResource( 49 ), ExtResource( 50 ), ExtResource( 51 ), ExtResource( 52 ), ExtResource( 53 ), ExtResource( 54 ), ExtResource( 55 ), ExtResource( 56 ), ExtResource( 57 ), ExtResource( 58 ), ExtResource( 59 ), ExtResource( 60 ), ExtResource( 61 ), ExtResource( 62 ), ExtResource( 63 ), ExtResource( 64 ), ExtResource( 65 ), ExtResource( 66 ), ExtResource( 67 ), ExtResource( 68 ), ExtResource( 69 ), ExtResource( 70 ), ExtResource( 71 ), ExtResource( 72 ), ExtResource( 73 ), ExtResource( 74 ), ExtResource( 75 ), ExtResource( 76 ), ExtResource( 77 ), ExtResource( 78 ), ExtResource( 79 ), ExtResource( 80 ), ExtResource( 81 ), ExtResource( 82 ), ExtResource( 83 ), ExtResource( 84 ), ExtResource( 85 ), ExtResource( 86 ), ExtResource( 87 ), ExtResource( 88 ), ExtResource( 89 ) ], "loop":true, "name":"Broleton", "speed":5.0 } ]
animations = [ {
"frames": [ ExtResource( 2 ), ExtResource( 3 ), ExtResource( 4 ), ExtResource( 5 ), ExtResource( 6 ), ExtResource( 7 ), ExtResource( 8 ), ExtResource( 9 ), ExtResource( 10 ), ExtResource( 11 ), ExtResource( 12 ), ExtResource( 13 ), ExtResource( 14 ), ExtResource( 15 ), ExtResource( 16 ), ExtResource( 17 ), ExtResource( 18 ), ExtResource( 19 ), ExtResource( 20 ), ExtResource( 21 ), ExtResource( 22 ), ExtResource( 23 ), ExtResource( 24 ), ExtResource( 25 ), ExtResource( 26 ), ExtResource( 27 ), ExtResource( 28 ), ExtResource( 29 ), ExtResource( 30 ), ExtResource( 31 ), ExtResource( 32 ), ExtResource( 33 ), ExtResource( 34 ), ExtResource( 35 ), ExtResource( 36 ), ExtResource( 37 ), ExtResource( 38 ), ExtResource( 39 ), ExtResource( 40 ), ExtResource( 41 ), ExtResource( 42 ), ExtResource( 43 ), ExtResource( 44 ), ExtResource( 45 ) ],
"loop": true,
"name": "Skeleton",
"speed": 5.0
}, {
"frames": [ ExtResource( 46 ), ExtResource( 47 ), ExtResource( 48 ), ExtResource( 49 ), ExtResource( 50 ), ExtResource( 51 ), ExtResource( 52 ), ExtResource( 53 ), ExtResource( 54 ), ExtResource( 55 ), ExtResource( 56 ), ExtResource( 57 ), ExtResource( 58 ), ExtResource( 59 ), ExtResource( 60 ), ExtResource( 61 ), ExtResource( 62 ), ExtResource( 63 ), ExtResource( 64 ), ExtResource( 65 ), ExtResource( 66 ), ExtResource( 67 ), ExtResource( 68 ), ExtResource( 69 ), ExtResource( 70 ), ExtResource( 71 ), ExtResource( 72 ), ExtResource( 73 ), ExtResource( 74 ), ExtResource( 75 ), ExtResource( 76 ), ExtResource( 77 ), ExtResource( 78 ), ExtResource( 79 ), ExtResource( 80 ), ExtResource( 81 ), ExtResource( 82 ), ExtResource( 83 ), ExtResource( 84 ), ExtResource( 85 ), ExtResource( 86 ), ExtResource( 87 ), ExtResource( 88 ), ExtResource( 89 ) ],
"loop": true,
"name": "Broleton",
"speed": 5.0
} ]

[sub_resource type="Animation" id=3]

Expand All @@ -109,7 +119,12 @@ tracks/0/type = "value"
tracks/0/path = NodePath(".:frame")
tracks/0/interp = 1
tracks/0/imported = false
tracks/0/keys = { "times":FloatArray( 0 ), "transitions":FloatArray( 1 ), "update":1, "values":[ 41 ] }
tracks/0/keys = {
"times": FloatArray( 0 ),
"transitions": FloatArray( 1 ),
"update": 1,
"values": [ 41 ]
}

[sub_resource type="Animation" id=4]

Expand All @@ -121,7 +136,12 @@ tracks/0/type = "value"
tracks/0/path = NodePath(".:frame")
tracks/0/interp = 1
tracks/0/imported = false
tracks/0/keys = { "times":FloatArray( 0 ), "transitions":FloatArray( 1 ), "update":1, "values":[ 42 ] }
tracks/0/keys = {
"times": FloatArray( 0 ),
"transitions": FloatArray( 1 ),
"update": 1,
"values": [ 42 ]
}

[sub_resource type="Animation" id=5]

Expand All @@ -133,7 +153,12 @@ tracks/0/type = "value"
tracks/0/path = NodePath(".:frame")
tracks/0/interp = 1
tracks/0/imported = false
tracks/0/keys = { "times":FloatArray( 0 ), "transitions":FloatArray( 1 ), "update":1, "values":[ 0 ] }
tracks/0/keys = {
"times": FloatArray( 0 ),
"transitions": FloatArray( 1 ),
"update": 1,
"values": [ 0 ]
}

[sub_resource type="Animation" id=6]

Expand All @@ -144,7 +169,12 @@ tracks/0/type = "value"
tracks/0/path = NodePath(".:frame")
tracks/0/interp = 1
tracks/0/imported = false
tracks/0/keys = { "times":FloatArray( 0 ), "transitions":FloatArray( 1 ), "update":1, "values":[ 1 ] }
tracks/0/keys = {
"times": FloatArray( 0 ),
"transitions": FloatArray( 1 ),
"update": 1,
"values": [ 1 ]
}

[sub_resource type="Animation" id=7]

Expand All @@ -155,7 +185,12 @@ tracks/0/type = "value"
tracks/0/path = NodePath(".:frame")
tracks/0/interp = 1
tracks/0/imported = false
tracks/0/keys = { "times":FloatArray( 0 ), "transitions":FloatArray( 1 ), "update":1, "values":[ 2 ] }
tracks/0/keys = {
"times": FloatArray( 0 ),
"transitions": FloatArray( 1 ),
"update": 1,
"values": [ 2 ]
}

[sub_resource type="Animation" id=8]

Expand All @@ -166,7 +201,12 @@ tracks/0/type = "value"
tracks/0/path = NodePath(".:frame")
tracks/0/interp = 1
tracks/0/imported = false
tracks/0/keys = { "times":FloatArray( 0 ), "transitions":FloatArray( 1 ), "update":1, "values":[ 3 ] }
tracks/0/keys = {
"times": FloatArray( 0 ),
"transitions": FloatArray( 1 ),
"update": 1,
"values": [ 3 ]
}

[sub_resource type="Animation" id=9]

Expand All @@ -178,7 +218,12 @@ tracks/0/type = "value"
tracks/0/path = NodePath(".:frame")
tracks/0/interp = 1
tracks/0/imported = false
tracks/0/keys = { "times":FloatArray( 0 ), "transitions":FloatArray( 1 ), "update":1, "values":[ 43 ] }
tracks/0/keys = {
"times": FloatArray( 0 ),
"transitions": FloatArray( 1 ),
"update": 1,
"values": [ 43 ]
}

[sub_resource type="Animation" id=10]

Expand All @@ -190,7 +235,12 @@ tracks/0/type = "value"
tracks/0/path = NodePath(".:frame")
tracks/0/interp = 1
tracks/0/imported = false
tracks/0/keys = { "times":FloatArray( 0 ), "transitions":FloatArray( 1 ), "update":1, "values":[ 4 ] }
tracks/0/keys = {
"times": FloatArray( 0 ),
"transitions": FloatArray( 1 ),
"update": 1,
"values": [ 4 ]
}

[sub_resource type="Animation" id=11]

Expand All @@ -201,7 +251,12 @@ tracks/0/type = "value"
tracks/0/path = NodePath(".:frame")
tracks/0/interp = 1
tracks/0/imported = false
tracks/0/keys = { "times":FloatArray( 0, 0.2, 0.4, 0.6 ), "transitions":FloatArray( 1, 1, 1, 1 ), "update":1, "values":[ 5, 6, 7, 8 ] }
tracks/0/keys = {
"times": FloatArray( 0, 0.2, 0.4, 0.6 ),
"transitions": FloatArray( 1, 1, 1, 1 ),
"update": 1,
"values": [ 5, 6, 7, 8 ]
}

[sub_resource type="Animation" id=12]

Expand All @@ -213,7 +268,12 @@ tracks/0/type = "value"
tracks/0/path = NodePath(".:frame")
tracks/0/interp = 1
tracks/0/imported = false
tracks/0/keys = { "times":FloatArray( 0, 0.2, 0.4, 0.6 ), "transitions":FloatArray( 1, 1, 1, 1 ), "update":1, "values":[ 9, 10, 11, 12 ] }
tracks/0/keys = {
"times": FloatArray( 0, 0.2, 0.4, 0.6 ),
"transitions": FloatArray( 1, 1, 1, 1 ),
"update": 1,
"values": [ 9, 10, 11, 12 ]
}

[sub_resource type="Animation" id=13]

Expand All @@ -225,7 +285,12 @@ tracks/0/type = "value"
tracks/0/path = NodePath(".:frame")
tracks/0/interp = 1
tracks/0/imported = false
tracks/0/keys = { "times":FloatArray( 0, 0.2, 0.4, 0.6 ), "transitions":FloatArray( 1, 1, 1, 1 ), "update":1, "values":[ 13, 14, 15, 16 ] }
tracks/0/keys = {
"times": FloatArray( 0, 0.2, 0.4, 0.6 ),
"transitions": FloatArray( 1, 1, 1, 1 ),
"update": 1,
"values": [ 13, 14, 15, 16 ]
}

[sub_resource type="Animation" id=14]

Expand All @@ -236,7 +301,12 @@ tracks/0/type = "value"
tracks/0/path = NodePath(".:frame")
tracks/0/interp = 1
tracks/0/imported = false
tracks/0/keys = { "times":FloatArray( 0, 0.2, 0.4, 0.6, 0.8, 1 ), "transitions":FloatArray( 1, 1, 1, 1, 1, 1 ), "update":1, "values":[ 17, 18, 19, 20, 21, 22 ] }
tracks/0/keys = {
"times": FloatArray( 0, 0.2, 0.4, 0.6, 0.8, 1 ),
"transitions": FloatArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 17, 18, 19, 20, 21, 22 ]
}

[sub_resource type="Animation" id=15]

Expand All @@ -247,7 +317,12 @@ tracks/0/type = "value"
tracks/0/path = NodePath(".:frame")
tracks/0/interp = 1
tracks/0/imported = false
tracks/0/keys = { "times":FloatArray( 0, 0.2, 0.4, 0.6, 0.8, 1 ), "transitions":FloatArray( 1, 1, 1, 1, 1, 1 ), "update":1, "values":[ 23, 24, 25, 26, 27, 28 ] }
tracks/0/keys = {
"times": FloatArray( 0, 0.2, 0.4, 0.6, 0.8, 1 ),
"transitions": FloatArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 23, 24, 25, 26, 27, 28 ]
}

[sub_resource type="Animation" id=16]

Expand All @@ -258,7 +333,12 @@ tracks/0/type = "value"
tracks/0/path = NodePath(".:frame")
tracks/0/interp = 1
tracks/0/imported = false
tracks/0/keys = { "times":FloatArray( 0, 0.2, 0.4, 0.6 ), "transitions":FloatArray( 1, 1, 1, 1 ), "update":1, "values":[ 29, 30, 31, 32 ] }
tracks/0/keys = {
"times": FloatArray( 0, 0.2, 0.4, 0.6 ),
"transitions": FloatArray( 1, 1, 1, 1 ),
"update": 1,
"values": [ 29, 30, 31, 32 ]
}

[sub_resource type="Animation" id=17]

Expand All @@ -270,7 +350,12 @@ tracks/0/type = "value"
tracks/0/path = NodePath(".:frame")
tracks/0/interp = 1
tracks/0/imported = false
tracks/0/keys = { "times":FloatArray( 0, 0.2, 0.4, 0.6 ), "transitions":FloatArray( 1, 1, 1, 1 ), "update":1, "values":[ 33, 34, 35, 36 ] }
tracks/0/keys = {
"times": FloatArray( 0, 0.2, 0.4, 0.6 ),
"transitions": FloatArray( 1, 1, 1, 1 ),
"update": 1,
"values": [ 33, 34, 35, 36 ]
}

[sub_resource type="Animation" id=18]

Expand All @@ -282,7 +367,12 @@ tracks/0/type = "value"
tracks/0/path = NodePath(".:frame")
tracks/0/interp = 1
tracks/0/imported = false
tracks/0/keys = { "times":FloatArray( 0, 0.2, 0.4, 0.6 ), "transitions":FloatArray( 1, 1, 1, 1 ), "update":1, "values":[ 37, 38, 39, 40 ] }
tracks/0/keys = {
"times": FloatArray( 0, 0.2, 0.4, 0.6 ),
"transitions": FloatArray( 1, 1, 1, 1 ),
"update": 1,
"values": [ 37, 38, 39, 40 ]
}

[sub_resource type="StyleBoxFlat" id=19]

Expand Down Expand Up @@ -349,13 +439,48 @@ script/script = ExtResource( 1 )

[node name="Sprite" type="AnimatedSprite" parent="."]

editor/display_folded = true
transform/pos = Vector2( 0.0922657, 17.3916 )
transform/scale = Vector2( 0.150367, 0.150367 )
frames = SubResource( 2 )
animation = "Skeleton"
frame = 13

[node name="Glow" type="AnimatedSprite" parent="Sprite"]

visibility/behind_parent = true
visibility/blend_mode = 1
transform/scale = Vector2( 1.2, 1.2 )
frames = SubResource( 2 )
animation = "Skeleton"
frame = 13
modulate = Color( 0, 1, 0, 1 )

[node name="AnimationPlayerGlow" type="AnimationPlayer" parent="Sprite/Glow"]

playback/process_mode = 1
playback/default_blend_time = 0.0
root/root = NodePath("..")
anims/idle_down = SubResource( 3 )
anims/idle_downleft = SubResource( 4 )
anims/idle_downright = SubResource( 5 )
anims/idle_left = SubResource( 6 )
anims/idle_right = SubResource( 7 )
anims/idle_up = SubResource( 8 )
anims/idle_upleft = SubResource( 9 )
anims/idle_upright = SubResource( 10 )
anims/run_down = SubResource( 11 )
anims/run_downleft = SubResource( 12 )
anims/run_downright = SubResource( 13 )
anims/run_left = SubResource( 14 )
anims/run_right = SubResource( 15 )
anims/run_up = SubResource( 16 )
anims/run_upleft = SubResource( 17 )
anims/run_upright = SubResource( 18 )
playback/active = true
playback/speed = 1.0
blend_times = [ ]
autoplay = "idle_down"

[node name="AnimationPlayer" type="AnimationPlayer" parent="Sprite"]

playback/process_mode = 1
Expand Down Expand Up @@ -388,7 +513,9 @@ transform/pos = Vector2( 0, 20 )
shape = SubResource( 1 )
trigger = false
_update_shape_index = 0
__meta__ = { "_edit_lock_":true }
__meta__ = {
"_edit_lock_": true
}

[node name="ChargeBar" type="ProgressBar" parent="."]

Expand Down
15 changes: 5 additions & 10 deletions Scenes/Main.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ transform/pos = Vector2( 150, 150 )

[node name="Character1" parent="." instance=ExtResource( 1 )]

editor/display_folded = true
transform/pos = Vector2( 250, 150 )

[node name="Sprite" parent="Character1"]
Expand All @@ -31,7 +32,7 @@ transform/pos = Vector2( 350, 150 )
[node name="StaticBody2D" type="StaticBody2D" parent="."]

editor/display_folded = true
transform/pos = Vector2( 1000, 280 )
transform/pos = Vector2( 989.987, 280.16 )
transform/scale = Vector2( 1, 7 )
input/pickable = false
shapes/0/shape = SubResource( 1 )
Expand All @@ -43,7 +44,9 @@ constant_linear_velocity = Vector2( 0, 0 )
constant_angular_velocity = 0.0
friction = 1.0
bounce = 0.0
__meta__ = { "_edit_group_":true }
__meta__ = {
"_edit_group_": true
}

[node name="Sprite" type="Sprite" parent="StaticBody2D"]

Expand All @@ -70,14 +73,6 @@ stream/paused = false
stream/loop_restart_time = 0.0
stream/buffering_ms = 500

[connection signal="timeout" from="Character1/Cooldown" to="Character1" method="_on_Cooldown_timeout"]

[connection signal="timeout" from="Character1/StunTimer" to="Character1" method="_on_StunTimer_timeout"]

[connection signal="timeout" from="Character1/SlowTimer" to="Character1" method="_on_SlowTimer_timeout"]

[connection signal="timeout" from="Character1/RootTimer" to="Character1" method="_on_RootTimer_timeout"]


[editable path="Character1"]
[editable path="CameraCenterPoint"]
10 changes: 10 additions & 0 deletions Scripts/Character.gd
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ var btn_melee = input_states.new(name_adapter("char_melee"))

var current_anim = "idle_down"
onready var anim_player = get_node("Sprite/AnimationPlayer")
onready var glow_player = get_node("Sprite/Glow/AnimationPlayerGlow")


var current_direction = Vector2( 0, 1 )

Expand Down Expand Up @@ -140,8 +142,15 @@ func _fixed_process(delta):


func change_element( element ):
var fire = Color(1, 0, 0)
var nature = Color(0, 1, 0)
var water = Color(0, 0, 1)
var lightning = Color(1, 1, 0)

var colors = {"fire":fire, "nature":nature, "water":water, "lightning":lightning}
if magic_element != element:
charge = 0
get_node("Sprite/Glow").set_modulate(colors[element])
get_node("ChargeBar").set_value(charge)
magic_element = element

Expand Down Expand Up @@ -323,6 +332,7 @@ func update_anim( new_animation ):

if new_animation != current_anim:
anim_player.play(new_animation)
glow_player.play(new_animation)
current_anim = new_animation


Expand Down
2 changes: 0 additions & 2 deletions Scripts/Projectiles/TidalWave.gd
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ var parent
func fire( direction, parent ):
self.direction = direction
self.parent = parent
# add_collision_exception_with( parent )
set_pos( parent.get_pos() )
print(direction)
if direction.x != 0:
if direction.x < 0:
get_node("Sprite").set_scale(Vector2(-0.5, 0.5))
Expand Down

0 comments on commit daadb78

Please sign in to comment.