mirror of
https://github.com/Dariasteam/Cows-Revenge.git
synced 2026-07-17 16:45:36 +00:00
Add cowbells mechanics 2
This commit is contained in:
parent
db70b84b9c
commit
ed9ee7cf68
10 changed files with 164 additions and 122 deletions
BIN
Music/Milk machine.ogg
Normal file
BIN
Music/Milk machine.ogg
Normal file
Binary file not shown.
BIN
Music/dangerous-hills-loop.ogg
Normal file
BIN
Music/dangerous-hills-loop.ogg
Normal file
Binary file not shown.
BIN
Music/milk-machine-loop.ogg
Normal file
BIN
Music/milk-machine-loop.ogg
Normal file
Binary file not shown.
|
|
@ -16,8 +16,6 @@ func timer_timeout():
|
||||||
|
|
||||||
func play_sound():
|
func play_sound():
|
||||||
pitch += pitch_increment
|
pitch += pitch_increment
|
||||||
print ("sound ", pitch)
|
|
||||||
|
|
||||||
timer.start()
|
timer.start()
|
||||||
return pitch
|
return pitch
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ onready var sound = get_node("sound")
|
||||||
|
|
||||||
onready var hud_milk = get_tree().get_nodes_in_group("milk_hud")[0]
|
onready var hud_milk = get_tree().get_nodes_in_group("milk_hud")[0]
|
||||||
onready var hud_life = get_tree().get_nodes_in_group("life_hud")[0]
|
onready var hud_life = get_tree().get_nodes_in_group("life_hud")[0]
|
||||||
|
onready var hud_cowbell = get_tree().get_nodes_in_group("cowbell_hud")[0]
|
||||||
|
|
||||||
onready var JUMP_SOUND = ResourceLoader.load("Sound/player_jump_sound.ogg")
|
onready var JUMP_SOUND = ResourceLoader.load("Sound/player_jump_sound.ogg")
|
||||||
onready var cowbell_collector = get_node("cowbell_collector")
|
onready var cowbell_collector = get_node("cowbell_collector")
|
||||||
|
|
@ -57,6 +58,7 @@ export(int) var cowbells_collected = 0
|
||||||
|
|
||||||
func add_cowbells(var number):
|
func add_cowbells(var number):
|
||||||
cowbells_collected += number
|
cowbells_collected += number
|
||||||
|
hud_cowbell.set_counter (cowbells_collected)
|
||||||
return cowbell_collector.play_sound()
|
return cowbell_collector.play_sound()
|
||||||
|
|
||||||
func is_falling ():
|
func is_falling ():
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,12 @@
|
||||||
[ext_resource path="res://Scenes/Events/cowbell_collector.gd" type="Script" id=6]
|
[ext_resource path="res://Scenes/Events/cowbell_collector.gd" type="Script" id=6]
|
||||||
[ext_resource path="res://Sound/player_jump_sound.ogg" type="AudioStream" id=7]
|
[ext_resource path="res://Sound/player_jump_sound.ogg" type="AudioStream" id=7]
|
||||||
|
|
||||||
[sub_resource type="ConvexPolygonShape2D" id=4]
|
[sub_resource type="ConvexPolygonShape2D" id=1]
|
||||||
|
|
||||||
custom_solver_bias = 0.0
|
custom_solver_bias = 0.0
|
||||||
points = Vector2Array( -13.2061, 7.63341, -13.1494, -10.328, 11.2943, -10.3627, 11.4077, 7.42536, 1.19923, 13.0773, -3.50803, 13.0773 )
|
points = Vector2Array( -13.2061, 7.63341, -13.1494, -10.328, 11.2943, -10.3627, 11.4077, 7.42536, 1.19923, 13.0773, -3.50803, 13.0773 )
|
||||||
|
|
||||||
[sub_resource type="ConvexPolygonShape2D" id=5]
|
[sub_resource type="ConvexPolygonShape2D" id=2]
|
||||||
|
|
||||||
custom_solver_bias = 0.0
|
custom_solver_bias = 0.0
|
||||||
points = Vector2Array( -2.43698, 6.86286, -10.0513, 0.602652, -10.0513, -10.186, 9.7198, -10, 9.7198, 0.41664, 1.64128, 6.92704 )
|
points = Vector2Array( -2.43698, 6.86286, -10.0513, 0.602652, -10.0513, -10.186, 9.7198, -10, 9.7198, 0.41664, 1.64128, 6.92704 )
|
||||||
|
|
@ -42,10 +42,10 @@ tracks/0/keys = {
|
||||||
transform/scale = Vector2( 2, 2 )
|
transform/scale = Vector2( 2, 2 )
|
||||||
z/relative = false
|
z/relative = false
|
||||||
input/pickable = true
|
input/pickable = true
|
||||||
shapes/0/shape = SubResource( 4 )
|
shapes/0/shape = SubResource( 1 )
|
||||||
shapes/0/transform = Matrix32( 1.89755, 0, 0, 3.10364, 2.93931, -4.91934 )
|
shapes/0/transform = Matrix32( 1.89755, 0, 0, 3.10364, 2.93931, -4.91934 )
|
||||||
shapes/0/trigger = false
|
shapes/0/trigger = false
|
||||||
shapes/1/shape = SubResource( 5 )
|
shapes/1/shape = SubResource( 2 )
|
||||||
shapes/1/transform = Matrix32( 2.35192, 0, 0, 2.68801, 1.63985, 16.8801 )
|
shapes/1/transform = Matrix32( 2.35192, 0, 0, 2.68801, 1.63985, 16.8801 )
|
||||||
shapes/1/trigger = true
|
shapes/1/trigger = true
|
||||||
collision/layers = 1057
|
collision/layers = 1057
|
||||||
|
|
@ -56,7 +56,7 @@ max_milk = 100
|
||||||
milk_level = 0
|
milk_level = 0
|
||||||
max_life = 5
|
max_life = 5
|
||||||
MAX_JUMP_TIME = 20
|
MAX_JUMP_TIME = 20
|
||||||
MAX_WALK_SPEED = 450
|
MAX_WALK_SPEED = 500
|
||||||
invulneravility_time = 8
|
invulneravility_time = 8
|
||||||
JUMP_SPEED = 620
|
JUMP_SPEED = 620
|
||||||
altitude = 0.5
|
altitude = 0.5
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=14 format=1]
|
[gd_scene load_steps=16 format=1]
|
||||||
|
|
||||||
[ext_resource path="res://Scenes/Maps/map_1.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://Scenes/Maps/map_1.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://Scenes/Menu/life_hud.gd" type="Script" id=2]
|
[ext_resource path="res://Scenes/Menu/life_hud.gd" type="Script" id=2]
|
||||||
|
|
@ -11,6 +11,8 @@
|
||||||
[ext_resource path="res://Sprites/GUI/HUD/milbar_outter_2.png" type="Texture" id=9]
|
[ext_resource path="res://Sprites/GUI/HUD/milbar_outter_2.png" type="Texture" id=9]
|
||||||
[ext_resource path="res://Sprites/GUI/HUD/milkbar_outter_3.png" type="Texture" id=10]
|
[ext_resource path="res://Sprites/GUI/HUD/milkbar_outter_3.png" type="Texture" id=10]
|
||||||
[ext_resource path="res://Sprites/GUI/HUD/milkbar_outter_1.png" type="Texture" id=11]
|
[ext_resource path="res://Sprites/GUI/HUD/milkbar_outter_1.png" type="Texture" id=11]
|
||||||
|
[ext_resource path="res://Scenes/Menu/cowbells_hud.gd" type="Script" id=12]
|
||||||
|
[ext_resource path="res://Sprites/Charasets/cowbell.png" type="Texture" id=13]
|
||||||
|
|
||||||
[sub_resource type="Environment" id=1]
|
[sub_resource type="Environment" id=1]
|
||||||
|
|
||||||
|
|
@ -77,6 +79,7 @@ margin/bottom = 768.0
|
||||||
|
|
||||||
[node name="Viewport" type="Viewport" parent="Control"]
|
[node name="Viewport" type="Viewport" parent="Control"]
|
||||||
|
|
||||||
|
editor/display_folded = true
|
||||||
rect = Rect2( 0, 0, 1280, 768 )
|
rect = Rect2( 0, 0, 1280, 768 )
|
||||||
own_world = false
|
own_world = false
|
||||||
world = SubResource( 2 )
|
world = SubResource( 2 )
|
||||||
|
|
@ -262,6 +265,35 @@ sprite1 = ExtResource( 9 )
|
||||||
sprite2 = ExtResource( 10 )
|
sprite2 = ExtResource( 10 )
|
||||||
sprite3 = ExtResource( 11 )
|
sprite3 = ExtResource( 11 )
|
||||||
|
|
||||||
|
[node name="Cowbells" type="Node2D" parent="Control" groups=[
|
||||||
|
"cowbell_hud",
|
||||||
|
]]
|
||||||
|
|
||||||
|
script/script = ExtResource( 12 )
|
||||||
|
|
||||||
|
[node name="LineEdit" type="LineEdit" parent="Control/Cowbells"]
|
||||||
|
|
||||||
|
focus/ignore_mouse = false
|
||||||
|
focus/stop_mouse = false
|
||||||
|
size_flags/horizontal = 2
|
||||||
|
size_flags/vertical = 2
|
||||||
|
margin/left = 630.0
|
||||||
|
margin/top = 9.0
|
||||||
|
margin/right = 715.0
|
||||||
|
margin/bottom = 81.0
|
||||||
|
placeholder/text = "1"
|
||||||
|
placeholder/alpha = 1.0
|
||||||
|
editable = false
|
||||||
|
focus_mode = 2
|
||||||
|
caret/caret_blink = false
|
||||||
|
caret/caret_blink_speed = 0.65
|
||||||
|
|
||||||
|
[node name="Sprite" type="Sprite" parent="Control/Cowbells"]
|
||||||
|
|
||||||
|
transform/pos = Vector2( 586, 45 )
|
||||||
|
transform/scale = Vector2( 3, 3 )
|
||||||
|
texture = ExtResource( 13 )
|
||||||
|
|
||||||
[connection signal="pressed" from="Control/Buttons/Bttn_U" to="Control/Buttons" method="_on_Bttn_U_pressed"]
|
[connection signal="pressed" from="Control/Buttons/Bttn_U" to="Control/Buttons" method="_on_Bttn_U_pressed"]
|
||||||
|
|
||||||
[connection signal="released" from="Control/Buttons/Bttn_U" to="Control/Buttons" method="_on_Bttn_U_released"]
|
[connection signal="released" from="Control/Buttons/Bttn_U" to="Control/Buttons" method="_on_Bttn_U_released"]
|
||||||
|
|
|
||||||
10
Scenes/Menu/cowbells_hud.gd
Normal file
10
Scenes/Menu/cowbells_hud.gd
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
extends Node2D
|
||||||
|
|
||||||
|
# class member variables go here, for example:
|
||||||
|
# var a = 2
|
||||||
|
# var b = "textvar"
|
||||||
|
|
||||||
|
onready var label = get_node("LineEdit")
|
||||||
|
|
||||||
|
func set_counter (var quantity):
|
||||||
|
label.set_text(String(quantity))
|
||||||
Loading…
Add table
Add a link
Reference in a new issue