very cool
This commit is contained in:
parent
0f67687c55
commit
c7bda26eed
12 changed files with 172 additions and 16 deletions
BIN
0014.wav
Normal file
BIN
0014.wav
Normal file
Binary file not shown.
24
0014.wav.import
Normal file
24
0014.wav.import
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://igps611ecoc"
|
||||
path="res://.godot/imported/0014.wav-fa68a7bd2db71d351ca25159fbf8c79f.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://0014.wav"
|
||||
dest_files=["res://.godot/imported/0014.wav-fa68a7bd2db71d351ca25159fbf8c79f.sample"]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop_mode=0
|
||||
edit/loop_begin=0
|
||||
edit/loop_end=-1
|
||||
compress/mode=2
|
||||
10
game.tscn
10
game.tscn
|
|
@ -1,8 +1,9 @@
|
|||
[gd_scene load_steps=17 format=3 uid="uid://jo1lu66y1gx6"]
|
||||
[gd_scene load_steps=18 format=3 uid="uid://jo1lu66y1gx6"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://i348o6hqw2dn" path="res://sprites/44389.png" id="1_e2o6t"]
|
||||
[ext_resource type="Script" uid="uid://5qnvkmmtxsw2" path="res://gameManager.gd" id="1_feb5d"]
|
||||
[ext_resource type="AudioStream" uid="uid://ck06glyqpqy3n" path="res://Battle Mode - Mario Kart DS OST Extended.mp3" id="3_feb5d"]
|
||||
[ext_resource type="AudioStream" uid="uid://igps611ecoc" path="res://0014.wav" id="4_fc0e3"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_feb5d"]
|
||||
size = Vector2(16, 254)
|
||||
|
|
@ -43,15 +44,17 @@ font_color = Color(0.481789, 0.481789, 0.481789, 1)
|
|||
[sub_resource type="CircleShape2D" id="CircleShape2D_7jktm"]
|
||||
radius = 3.0
|
||||
|
||||
[node name="Game" type="Node2D" node_paths=PackedStringArray("player_spawns_nodes", "starting_shine_nodes", "shine_nodes", "scorecard_container", "elim_timer_label", "game_timer_label")]
|
||||
[node name="Game" type="Node2D" node_paths=PackedStringArray("player_spawns_nodes", "starting_shine_nodes", "shine_nodes", "scorecard_container", "elim_timer_label", "game_timer_label", "chime_player")]
|
||||
script = ExtResource("1_feb5d")
|
||||
shyguy_mode = true
|
||||
max_shinies = 16
|
||||
player_spawns_nodes = NodePath("PlayerSpawns")
|
||||
starting_shine_nodes = NodePath("StartingShineLocations")
|
||||
shine_nodes = NodePath("ShineLocations")
|
||||
scorecard_container = NodePath("GameUI/Scoreboard/VBoxContainer/scorecard_container")
|
||||
elim_timer_label = NodePath("GameUI/ElimTimer")
|
||||
game_timer_label = NodePath("GameUI/GameTimer")
|
||||
chime_player = NodePath("Chimer")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
texture_filter = 1
|
||||
|
|
@ -440,3 +443,6 @@ stream = ExtResource("3_feb5d")
|
|||
volume_db = -20.0
|
||||
autoplay = true
|
||||
parameters/looping = true
|
||||
|
||||
[node name="Chimer" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("4_fc0e3")
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
extends Node2D
|
||||
class_name GM
|
||||
|
||||
@export var shyguy_mode : bool
|
||||
@export var max_shinies : int = 9
|
||||
var player_spawns : Array[Node]
|
||||
var starting_shine_spawns : Array[Node]
|
||||
var shine_spawns : Array[Node]
|
||||
static var shine_spawns : Array[Node]
|
||||
var players : Array[Player]
|
||||
|
||||
@export_group("Node References")
|
||||
|
|
@ -13,9 +15,14 @@ var players : Array[Player]
|
|||
@export var scorecard_container : VBoxContainer
|
||||
@export var elim_timer_label : Label
|
||||
@export var game_timer_label : Label
|
||||
@export var chime_player : AudioStreamPlayer
|
||||
|
||||
var game_timer : float = 0
|
||||
var elim_timer : float = 60
|
||||
var shiny_spawn_timer : float = 5
|
||||
var shiny_count : int = 4
|
||||
var play_next_chime : float = 5
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
player_spawns = player_spawns_nodes.get_children()
|
||||
|
|
@ -47,14 +54,48 @@ func spawnPlayer(id : int):
|
|||
func spawn_shinies():
|
||||
for i in range(4):
|
||||
var shiny = load("res://shiny.tscn").instantiate()
|
||||
shiny.position = shine_spawns[i].position
|
||||
shiny.position = starting_shine_spawns[i].position
|
||||
add_child(shiny)
|
||||
|
||||
func spawn_new_shiny():
|
||||
var shiny = load("res://shiny.tscn").instantiate()
|
||||
var ranPos = randi_range(0,shine_spawns.size()-1)
|
||||
shiny.position = shine_spawns[ranPos].position
|
||||
shiny_spawn_timer = 5
|
||||
shiny_count += 1
|
||||
add_child(shiny)
|
||||
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
elim_timer -= delta
|
||||
game_timer += delta
|
||||
shiny_spawn_timer -= delta
|
||||
if(shiny_spawn_timer<=0 and shiny_count < max_shinies):
|
||||
spawn_new_shiny()
|
||||
if(elim_timer <= 0):
|
||||
elim_players()
|
||||
update_ui()
|
||||
|
||||
if elim_timer < play_next_chime:
|
||||
if play_next_chime > 0:
|
||||
play_next_chime -= 1
|
||||
chime_player.play(0.9)
|
||||
|
||||
func elim_players():
|
||||
var lowestScore : int = 10
|
||||
var highestScore : int = 0
|
||||
for player in players:
|
||||
if player.score < lowestScore and player.alive:
|
||||
lowestScore = player.score
|
||||
if player.score > highestScore and player.alive:
|
||||
highestScore = player.score
|
||||
for player in players:
|
||||
if player.score == lowestScore and player.alive and player.score != highestScore:
|
||||
player.alive = false
|
||||
elim_timer = 30
|
||||
play_next_chime = 5
|
||||
|
||||
func update_ui():
|
||||
elim_timer_label.text = format_time(elim_timer, false)
|
||||
game_timer_label.text = format_time(game_timer, true)
|
||||
|
|
|
|||
28
player.gd
28
player.gd
|
|
@ -4,6 +4,7 @@ class_name Player
|
|||
var id : int = 0
|
||||
var score : int = 0
|
||||
var scorecard : Scorecard
|
||||
var alive : bool = true
|
||||
@export var start_speed = 100
|
||||
|
||||
@export var animated_sprite : AnimatedSprite2D
|
||||
|
|
@ -17,3 +18,30 @@ func _ready() -> void:
|
|||
|
||||
func setup():
|
||||
animated_sprite.frame = id
|
||||
|
||||
func respawn_shiny():
|
||||
var shiny = load("res://shiny.tscn").instantiate()
|
||||
var ranPos = randi_range(0,GM.shine_spawns.size()-1)
|
||||
shiny.position = GM.shine_spawns[ranPos].position
|
||||
get_tree().get_root().add_child(shiny)
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
scorecard.score = score
|
||||
scorecard.alive = alive
|
||||
if(linear_velocity.length() < 35):
|
||||
linear_velocity *= 1.1
|
||||
if(not alive):
|
||||
modulate = Color("ffffff42")
|
||||
contact_monitor = false
|
||||
scorecard.alive = false
|
||||
for i in range(score):
|
||||
respawn_shiny()
|
||||
process_mode = Node.PROCESS_MODE_DISABLED
|
||||
|
||||
func _on_body_entered(body: Node) -> void:
|
||||
#print("mew")
|
||||
if body.is_in_group("player") :
|
||||
print("playersHit")
|
||||
if(score > 0):
|
||||
score -= 1
|
||||
respawn_shiny()
|
||||
|
|
|
|||
|
|
@ -10,10 +10,12 @@ bounce = 1.0
|
|||
[sub_resource type="CircleShape2D" id="CircleShape2D_4flbx"]
|
||||
radius = 4.0
|
||||
|
||||
[node name="Player" type="RigidBody2D" node_paths=PackedStringArray("animated_sprite")]
|
||||
[node name="Player" type="RigidBody2D" node_paths=PackedStringArray("animated_sprite") groups=["player"]]
|
||||
physics_material_override = SubResource("PhysicsMaterial_onrkg")
|
||||
gravity_scale = 0.0
|
||||
lock_rotation = true
|
||||
contact_monitor = true
|
||||
max_contacts_reported = 1
|
||||
linear_damp_mode = 1
|
||||
script = ExtResource("1_onrkg")
|
||||
start_speed = 2000
|
||||
|
|
@ -26,3 +28,5 @@ sprite_frames = ExtResource("2_onrkg")
|
|||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_4flbx")
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||
|
|
|
|||
|
|
@ -19,6 +19,10 @@ config/icon="res://icon.svg"
|
|||
|
||||
window/stretch/mode="viewport"
|
||||
|
||||
[global_group]
|
||||
|
||||
player=""
|
||||
|
||||
[rendering]
|
||||
|
||||
textures/canvas_textures/default_texture_filter=0
|
||||
|
|
|
|||
11
scorecard.gd
11
scorecard.gd
|
|
@ -3,12 +3,23 @@ class_name Scorecard
|
|||
|
||||
var score : int = 0
|
||||
var id : int = 0
|
||||
var alive : bool = true
|
||||
|
||||
@export_group("Node References")
|
||||
@export var score_label : Label
|
||||
@export var sprite : AnimatedSprite2D
|
||||
@export var back : TextureRect
|
||||
@export var alive_texture : Texture
|
||||
@export var dead_texture : Texture
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
|
||||
|
||||
if alive:
|
||||
back.texture = alive_texture
|
||||
score_label.text = str(score)
|
||||
sprite.frame = id
|
||||
else:
|
||||
back.texture = dead_texture
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://cp2t5xc2yk3q4"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://cp2t5xc2yk3q4"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://ddafqftfujtry" path="res://scorecard.gd" id="1_hcikf"]
|
||||
[ext_resource type="Texture2D" uid="uid://77quibtjcvca" path="res://sprites/scorecard.png" id="1_l1cy6"]
|
||||
[ext_resource type="SpriteFrames" uid="uid://c7ceeyn5e3kgr" path="res://playerSprites.tres" id="3_hcikf"]
|
||||
[ext_resource type="Texture2D" uid="uid://b4ffkmx1xbr7e" path="res://sprites/scorecard - white.png" id="3_lb3t7"]
|
||||
|
||||
[node name="Scorecard" type="Control" node_paths=PackedStringArray("score_label", "sprite")]
|
||||
[node name="Scorecard" type="Control" node_paths=PackedStringArray("score_label", "sprite", "back")]
|
||||
self_modulate = Color(0.879205, 0.000618961, 0.879199, 1)
|
||||
custom_minimum_size = Vector2(0, 23)
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
|
|
@ -17,12 +19,19 @@ grow_vertical = 2
|
|||
script = ExtResource("1_hcikf")
|
||||
score_label = NodePath("Score")
|
||||
sprite = NodePath("PlayerSprite")
|
||||
back = NodePath("Back")
|
||||
alive_texture = ExtResource("1_l1cy6")
|
||||
dead_texture = ExtResource("3_lb3t7")
|
||||
|
||||
[node name="Back" type="TextureRect" parent="."]
|
||||
layout_mode = 1
|
||||
show_behind_parent = true
|
||||
offset_right = 58.0
|
||||
offset_bottom = 23.0
|
||||
texture = ExtResource("1_l1cy6")
|
||||
texture = ExtResource("3_lb3t7")
|
||||
|
||||
[node name="PlayerSprite" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(9, 12)
|
||||
sprite_frames = ExtResource("3_hcikf")
|
||||
|
||||
[node name="Score" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
|
|
@ -30,7 +39,3 @@ offset_left = 37.0
|
|||
offset_right = 56.0
|
||||
offset_bottom = 23.0
|
||||
text = "00"
|
||||
|
||||
[node name="PlayerSprite" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(9, 12)
|
||||
sprite_frames = ExtResource("3_hcikf")
|
||||
|
|
|
|||
1
shiny.gd
1
shiny.gd
|
|
@ -6,5 +6,4 @@ func _on_body_entered(body: Player) -> void:
|
|||
print(body.name)
|
||||
if body is Player:
|
||||
body.score += 1
|
||||
body.scorecard.score = body.score
|
||||
queue_free()
|
||||
|
|
|
|||
BIN
sprites/scorecard - white.png
Normal file
BIN
sprites/scorecard - white.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 468 B |
34
sprites/scorecard - white.png.import
Normal file
34
sprites/scorecard - white.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b4ffkmx1xbr7e"
|
||||
path="res://.godot/imported/scorecard - white.png-ee6694917486210177c0f5c675a30e2d.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://sprites/scorecard - white.png"
|
||||
dest_files=["res://.godot/imported/scorecard - white.png-ee6694917486210177c0f5c675a30e2d.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
Loading…
Add table
Add a link
Reference in a new issue