Skip to content

Commit

Permalink
Somethings more :
Browse files Browse the repository at this point in the history
     - Score colorizing depending on value
     - Score bumping on new point
     - Make an anim for main menu enter
  • Loading branch information
ObaniGemini committed Nov 19, 2017
1 parent 54d89ca commit e31a072
Show file tree
Hide file tree
Showing 6 changed files with 203 additions and 16 deletions.
3 changes: 1 addition & 2 deletions assets/knight/knight.gd
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
extends KinematicBody2D


var jump_allow = false
var just_jumped = false
var jumping = false
Expand Down Expand Up @@ -31,7 +30,7 @@ func _fixed_process(delta):
get_node("Camera2D").clear_current()
set_pos(Vector2(-256,-256))
else:
if check_down.is_colliding():
if check_down.is_colliding() or is_colliding():
vertical_speed = 0
jump_allow = true
else:
Expand Down
3 changes: 0 additions & 3 deletions assets/tiles/tile.gd
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
extends StaticBody2D

func _ready():
pass

func _on_VisibilityNotifier2D_exit_screen():
queue_free()
21 changes: 16 additions & 5 deletions assets/tiles/tile.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,25 @@
[sub_resource type="RectangleShape2D" id=1]

custom_solver_bias = 0.0
extents = Vector2( 64, 16 )
extents = Vector2( 64, 20 )

[sub_resource type="SpriteFrames" id=2]

animations = [ { "frames":[ ExtResource( 2 ), ExtResource( 3 ), ExtResource( 4 ) ], "loop":true, "name":"default", "speed":5.0 } ]
animations = [ {
"frames": [ ExtResource( 2 ), ExtResource( 3 ), ExtResource( 4 ) ],
"loop": true,
"name": "default",
"speed": 5.0
} ]

[sub_resource type="RectangleShape2D" id=3]

custom_solver_bias = 0.0
extents = Vector2( 66, 320 )

[node name="tile" type="StaticBody2D" groups=[ "tile" ]]
[node name="tile" type="StaticBody2D" groups=[
"tile",
]]

input/pickable = false
shapes/0/shape = SubResource( 1 )
Expand All @@ -34,7 +41,9 @@ constant_angular_velocity = 0.0
friction = 0.0
bounce = 0.0
script/script = ExtResource( 1 )
__meta__ = { "_edit_lock_":true }
__meta__ = {
"_edit_lock_": true
}

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

Expand All @@ -53,7 +62,9 @@ _update_shape_index = 0

rect = Rect2( -64, -64, 128, 128 )

[node name="Area2D" type="Area2D" parent="." groups=[ "tile" ]]
[node name="Area2D" type="Area2D" parent="." groups=[
"tile",
]]

input/pickable = true
shapes/0/shape = SubResource( 3 )
Expand Down
11 changes: 11 additions & 0 deletions main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,17 @@ func add_points(amount,pos):
add_life()
coins_life -= 100
get_node("gui/coins").set_text(str(coins))
var r = 1 - (coins/400.0)
if (coins/400.0) > 1:
r = (coins/400.0) - 1
var g = 1 - (coins/200.0)
if (coins/200.0) > 1:
g = (coins/200.0) - 1
var b = 1 - (coins/100.0)
if (coins/100.0) > 1:
b = (coins/100.0) - 1
get_node("gui/coins").set("custom_colors/font_color", Color(r, g, b))
get_node("gui/coins/AnimationPlayer").play("point")

func _on_activate_zombies_timeout():
active_zombies = true
Expand Down
47 changes: 44 additions & 3 deletions main.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=12 format=1]
[gd_scene load_steps=13 format=1]

[ext_resource path="res://main.gd" type="Script" id=1]
[ext_resource path="res://assets/knight/knight.tscn" type="PackedScene" id=2]
Expand Down Expand Up @@ -64,6 +64,33 @@ tracks/1/keys = {
"values": [ 0.5, 0.35 ]
}

[sub_resource type="Animation" id=3]

resource/name = "point"
length = 0.2
loop = false
step = 0.1
tracks/0/type = "value"
tracks/0/path = NodePath(".:rect/scale")
tracks/0/interp = 1
tracks/0/imported = false
tracks/0/keys = {
"times": FloatArray( 0, 0.2 ),
"transitions": FloatArray( 1, 1 ),
"update": 0,
"values": [ Vector2( 2, 2 ), Vector2( 1, 1 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath(".:rect/pos")
tracks/1/interp = 1
tracks/1/imported = false
tracks/1/keys = {
"times": FloatArray( 0, 0.2 ),
"transitions": FloatArray( 1, 1 ),
"update": 0,
"values": [ Vector2( 1034, 0 ), Vector2( 1146, 12 ) ]
}

[node name="main" type="Node2D"]

script/script = ExtResource( 1 )
Expand Down Expand Up @@ -218,21 +245,35 @@ texture = ExtResource( 7 )

[node name="coins" type="Label" parent="gui"]

anchor/left = 1
anchor/bottom = 1
focus/ignore_mouse = true
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 0
margin/left = 1146.0
margin/left = 134.0
margin/top = 12.0
margin/right = 1261.0
margin/bottom = 85.0
margin/bottom = 635.0
custom_fonts/font = ExtResource( 9 )
custom_colors/font_color = Color( 1, 1, 1, 1 )
text = "0"
align = 2
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1

[node name="AnimationPlayer" type="AnimationPlayer" parent="gui/coins"]

playback/process_mode = 1
playback/default_blend_time = 0.0
root/root = NodePath("..")
anims/point = SubResource( 3 )
playback/active = true
playback/speed = 1.0
blend_times = [ ]
autoplay = ""

[node name="lifes" type="Node" parent="gui"]

[node name="random_sword" type="Timer" parent="."]
Expand Down
134 changes: 131 additions & 3 deletions main_menu.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=7 format=1]
[gd_scene load_steps=9 format=1]

[ext_resource path="res://main_menu.gd" type="Script" id=1]
[ext_resource path="res://assets/bg/bg_2.png" type="Texture" id=2]
Expand All @@ -7,6 +7,68 @@
[ext_resource path="res://assets/misc/logo.png" type="Texture" id=5]
[ext_resource path="res://assets/fonts/amaranth_32_real_black.fnt" type="BitmapFont" id=6]

[sub_resource type="ColorRamp" id=2]

offsets = FloatArray( 0, 1 )
colors = ColorArray( 1, 1, 1, 0.0980392, 1, 1, 1, 0 )

[sub_resource type="Animation" id=1]

resource/name = "enter"
length = 0.6
loop = false
step = 0.1
tracks/0/type = "value"
tracks/0/path = NodePath("logo:transform/pos")
tracks/0/interp = 1
tracks/0/imported = false
tracks/0/keys = {
"times": FloatArray( 0, 0.2, 0.6 ),
"transitions": FloatArray( 0.25, 0.25, 1 ),
"update": 0,
"values": [ Vector2( 1600, 360 ), Vector2( 1600, 360 ), Vector2( 1000, 360 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("logo:transform/scale")
tracks/1/interp = 1
tracks/1/imported = false
tracks/1/keys = {
"times": FloatArray( 0, 0.2, 0.6 ),
"transitions": FloatArray( 0.25, 0.25, 1 ),
"update": 0,
"values": [ Vector2( 0.25, 1 ), Vector2( 0.25, 1 ), Vector2( 1, 1 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("logo/Particles2D:config/emitting")
tracks/2/interp = 1
tracks/2/imported = false
tracks/2/keys = {
"times": FloatArray( 0, 0.2 ),
"transitions": FloatArray( 1, 1 ),
"update": 1,
"values": [ true, true ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("mighty_knight:transform/pos")
tracks/3/interp = 1
tracks/3/imported = false
tracks/3/keys = {
"times": FloatArray( 0, 0.2, 0.6 ),
"transitions": FloatArray( 0.25, 0.25, 1 ),
"update": 0,
"values": [ Vector2( -256, 414 ), Vector2( -256, 414 ), Vector2( 248, 414 ) ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("mighty_knight/Particles2D:config/emitting")
tracks/4/interp = 1
tracks/4/imported = false
tracks/4/keys = {
"times": FloatArray( 0, 0.5 ),
"transitions": FloatArray( 1, 1 ),
"update": 1,
"values": [ true, false ]
}

[node name="main_menu" type="Node2D"]

script/script = ExtResource( 1 )
Expand Down Expand Up @@ -36,14 +98,69 @@ max_lines_visible = -1

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

transform/pos = Vector2( 248, 340 )
transform/pos = Vector2( -256, 414 )
texture = ExtResource( 4 )

[node name="Particles2D" type="Particles2D" parent="mighty_knight"]

visibility/behind_parent = true
config/amount = 16
config/lifetime = 0.2
config/process_mode = 1
config/local_space = false
config/texture = ExtResource( 4 )
params/direction = 0.0
params/spread = 0.0
params/linear_velocity = 0.0
params/spin_velocity = 0.0
params/orbit_velocity = 0.0
params/gravity_direction = 0.0
params/gravity_strength = 0.0
params/radial_accel = 0.0
params/tangential_accel = 0.0
params/damping = 0.0
params/initial_angle = 0.0
params/initial_size = 1.0
params/final_size = 1.0
params/hue_variation = 0.0
params/anim_speed_scale = 1.0
params/anim_initial_pos = 0.0
color/color_ramp = SubResource( 2 )

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

transform/pos = Vector2( 1000, 360 )
transform/pos = Vector2( 1600, 360 )
transform/scale = Vector2( 0.25, 1 )
texture = ExtResource( 5 )

[node name="Particles2D" type="Particles2D" parent="logo"]

visibility/behind_parent = true
config/amount = 16
config/lifetime = 0.2
config/process_mode = 1
config/local_space = false
config/texture = ExtResource( 5 )
params/direction = 360.0
params/spread = 180.0
params/linear_velocity = 20.0
params/spin_velocity = 0.0
params/orbit_velocity = 0.0
params/gravity_direction = 0.0
params/gravity_strength = 0.0
params/radial_accel = 0.0
params/tangential_accel = 0.0
params/damping = 0.0
params/initial_angle = 0.0
params/initial_size = 1.0
params/final_size = 1.2
params/hue_variation = 0.0
params/anim_speed_scale = 1.0
params/anim_initial_pos = 0.0
randomness/direction = 1.0
randomness/spread = 1.0
color/color_ramp = SubResource( 2 )

[node name="open_url" type="TextureButton" parent="."]

focus/ignore_mouse = false
Expand Down Expand Up @@ -77,6 +194,17 @@ shortcut = null
text = "Start"
flat = false

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

playback/process_mode = 1
playback/default_blend_time = 0.0
root/root = NodePath("..")
anims/enter = SubResource( 1 )
playback/active = true
playback/speed = 1.0
blend_times = [ ]
autoplay = "enter"

[connection signal="pressed" from="open_url" to="." method="_on_open_url_pressed"]

[connection signal="pressed" from="play" to="." method="_on_play_pressed"]
Expand Down

0 comments on commit e31a072

Please sign in to comment.