Fish Cascade WIP added

This commit is contained in:
GitCosm0s
2026-02-10 18:29:46 -05:00
parent 3042bb93c7
commit f49239b095
16 changed files with 352 additions and 2 deletions

View File

@@ -19,6 +19,7 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
metadata/_edit_use_anchors_ = true
[node name="TextureRect" type="TextureRect" parent="CanvasLayer/Control" unique_id=308962101]
layout_mode = 1
@@ -29,6 +30,7 @@ grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("1_lcssi")
expand_mode = 1
metadata/_edit_use_anchors_ = true
[node name="BackgroundMusic" type="AudioStreamPlayer2D" parent="." unique_id=1814622732]
stream = ExtResource("2_ije4o")

View File

@@ -0,0 +1,77 @@
extends Node2D
# word stuff
var word_set
var word_set_file_path
var word_set_file
var word_set_content
var word_set_array
# init random
var alphabet = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N",
"O","P","Q","R","S","T","U","V","W","X","Y","Z"]
var fishs = []
var fish_speed = 75
# numbers
var delay = 2
var spawn_timer = 0
# objects
var fish_source = preload("res://scenes/objects/game/fish.tscn")
# Runs on start
func _ready() -> void:
# Load Corresponding Text File
word_set_file_path = "res://gameplay/word_sets/" + word_set + ".txt"
word_set_file = FileAccess.open(word_set_file_path, FileAccess.READ)
# Gets file contents as text
word_set_content = word_set_file.get_as_text()
# Splits text file contents by line and removes the first entry (its just the name)
word_set_array = word_set_content.split("\n", true)
word_set_array.remove_at(0)
if word_set_array[len(word_set_array)-1] == "":
word_set_array.remove_at(len(word_set_array)-1)
#print(word_set_array)
# Runs every frame
func _process(delta: float) -> void:
spawn_timer += delta
if spawn_timer >= delay:
spawn_timer = 0
spawn_word()
func spawn_word():
var new_word = word_set_array[randi_range(0,len(word_set_array)-1)]
var viewport_size = get_viewport_rect().size
var offset = randf_range(0,800)
for char in new_word:
if char != " ":
var new_commet = fish_source.instantiate()
new_commet.position = Vector2(128+offset,-128)
new_commet.get_node("Sprite").get_node("Label").text = char
new_commet.speed = fish_speed
add_child(new_commet)
$FishTux.position = Vector2(offset,660)
fishs.append(new_commet)
offset += 30
func _input(event):
if event is InputEventKey and event.pressed:
if event.as_text() in alphabet:
print(event.as_text())
if len(fishs) > 0:
var fish = fishs[0]
if event.as_text() == fish.get_node("Sprite").get_node("Label").text:
fishs.erase(fish)
fish.get_node("Sprite").get_node("Label").add_theme_color_override("font_color", Color.RED)
await fish.get_node("Sprite").animation_finished
fish.queue_free()

View File

@@ -0,0 +1 @@
uid://bcxlia8u8tjm7

View File

@@ -0,0 +1,117 @@
[gd_scene format=3 uid="uid://cylk271eo0sxu"]
[ext_resource type="Texture2D" uid="uid://cwypumqx8itup" path="res://original data/images/kcas0.jpg" id="1_lx3ow"]
[ext_resource type="Script" uid="uid://bcxlia8u8tjm7" path="res://scenes/game/fish_cascade.gd" id="1_tj4tg"]
[ext_resource type="Texture2D" uid="uid://dd2yqhqic7acs" path="res://original data/images/tux/gulp0.png" id="2_04abn"]
[ext_resource type="Texture2D" uid="uid://5vts7ippn4cl" path="res://original data/images/tux/gulp1.png" id="3_o008d"]
[ext_resource type="Texture2D" uid="uid://cwnh5jv7ftuam" path="res://original data/images/tux/gulp2.png" id="4_1s1b5"]
[ext_resource type="Texture2D" uid="uid://cy7chpor47cqe" path="res://original data/images/tux/gulp3.png" id="5_pvajk"]
[ext_resource type="Texture2D" uid="uid://tpukb58o242b" path="res://original data/images/tux/run0.png" id="6_lg4hc"]
[ext_resource type="Texture2D" uid="uid://cuprnmxy5a7u2" path="res://original data/images/tux/run1.png" id="7_tj4tg"]
[ext_resource type="Texture2D" uid="uid://bsh0r0ldjgt51" path="res://original data/images/tux/stand0.png" id="8_wevax"]
[ext_resource type="Texture2D" uid="uid://cebh8ecpj0274" path="res://original data/images/tux/stand1.png" id="9_8sqkf"]
[ext_resource type="Texture2D" uid="uid://bwimfoayd83p2" path="res://original data/images/tux/stand-.png" id="10_me7rb"]
[ext_resource type="Texture2D" uid="uid://dyjdddytxqybg" path="res://original data/images/tux/walk0.png" id="11_lg4hc"]
[ext_resource type="Texture2D" uid="uid://bequiqfu54xe7" path="res://original data/images/tux/walk1.png" id="12_tj4tg"]
[ext_resource type="Texture2D" uid="uid://f6sy7wboy6td" path="res://original data/images/tux/walk2.png" id="13_wevax"]
[ext_resource type="Texture2D" uid="uid://nduj5djmkad7" path="res://original data/images/tux/walk3.png" id="14_8sqkf"]
[ext_resource type="AudioStream" uid="uid://c8017fjw3ntl0" path="res://assets/audio/music/game/2-27. Pursuit - A Great Turnabout.mp3" id="16_wevax"]
[sub_resource type="SpriteFrames" id="SpriteFrames_5wky4"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("2_04abn")
}, {
"duration": 1.0,
"texture": ExtResource("3_o008d")
}, {
"duration": 1.0,
"texture": ExtResource("4_1s1b5")
}, {
"duration": 1.0,
"texture": ExtResource("5_pvajk")
}],
"loop": true,
"name": &"gulp",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("6_lg4hc")
}, {
"duration": 1.0,
"texture": ExtResource("7_tj4tg")
}],
"loop": true,
"name": &"run",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("8_wevax")
}, {
"duration": 1.0,
"texture": ExtResource("9_8sqkf")
}, {
"duration": 1.0,
"texture": ExtResource("10_me7rb")
}],
"loop": true,
"name": &"stand",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("11_lg4hc")
}, {
"duration": 1.0,
"texture": ExtResource("12_tj4tg")
}, {
"duration": 1.0,
"texture": ExtResource("13_wevax")
}, {
"duration": 1.0,
"texture": ExtResource("14_8sqkf")
}],
"loop": true,
"name": &"walk",
"speed": 5.0
}]
[node name="FishCascade" type="Node2D" unique_id=82120739]
script = ExtResource("1_tj4tg")
[node name="CanvasLayer" type="CanvasLayer" parent="." unique_id=1937900767]
layer = -1
[node name="Control" type="Control" parent="CanvasLayer" unique_id=1754186074]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
metadata/_edit_use_anchors_ = true
[node name="TextureRect" type="TextureRect" parent="CanvasLayer/Control" unique_id=1605677218]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("1_lx3ow")
expand_mode = 1
metadata/_edit_use_anchors_ = true
[node name="FishTux" type="AnimatedSprite2D" parent="." unique_id=1877342570]
position = Vector2(650, 660)
sprite_frames = SubResource("SpriteFrames_5wky4")
animation = &"stand"
frame_progress = 0.36790088
[node name="BackgroundMusic" type="AudioStreamPlayer2D" parent="." unique_id=414011462]
stream = ExtResource("16_wevax")
volume_db = -15.0
autoplay = true

16
scenes/game/fish_tux.gd Normal file
View File

@@ -0,0 +1,16 @@
extends AnimatedSprite2D
var speed = 10
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
play('stand')
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func movetofish(loc):
Vector2(loc, 660)

View File

@@ -0,0 +1 @@
uid://cqo3yt8ao4laj

View File

@@ -1,6 +1,6 @@
[gd_scene format=3 uid="uid://cb2i4ei3lihbh"]
[ext_resource type="Shader" uid="uid://b4yhwgv8l8djq" path="res://scroll.gdshader" id="1_3oan1"]
[ext_resource type="Shader" path="res://scroll.gdshader" id="1_3oan1"]
[ext_resource type="Script" uid="uid://buqy4h8s5nhg7" path="res://scenes/menus/select_mode/select_mode.gd" id="1_avhy0"]
[ext_resource type="Texture2D" uid="uid://dew71sa7dwdnc" path="res://textures/tux typing +.png" id="2_3oan1"]
[ext_resource type="AudioStream" uid="uid://df31l8x4fxwf0" path="res://assets/audio/music/menus/Mario Kart Wii Music - Menu (Medley) [fN2dJP0WLDQ].mp3" id="3_xhbdh"]

View File

@@ -0,0 +1,14 @@
extends Node2D
var speed = 100
var scene
func _ready() -> void:
scene = self.get_parent()
func _process(delta: float) -> void:
self.position.y += speed*delta
if self.position.y >= 720:
scene.fishs.erase(self)
self.queue_free()

View File

@@ -0,0 +1 @@
uid://c0mf5vliqjiou

View File

@@ -0,0 +1,59 @@
[gd_scene format=3 uid="uid://b6xc0bu0slgue"]
[ext_resource type="Script" uid="uid://c0mf5vliqjiou" path="res://scenes/objects/game/fish.gd" id="1_dy21x"]
[ext_resource type="Texture2D" uid="uid://bpmmklm87rhys" path="res://original data/images/fishy0.png" id="1_foolk"]
[ext_resource type="Texture2D" uid="uid://bgjxv801vvsw2" path="res://original data/images/fishy1.png" id="2_dy21x"]
[ext_resource type="Texture2D" uid="uid://b4wc4ngjdq0es" path="res://original data/images/fishy2.png" id="3_qijva"]
[ext_resource type="Texture2D" uid="uid://ba8uy4eamf0qc" path="res://original data/images/fishy3.png" id="4_2qncy"]
[ext_resource type="Texture2D" uid="uid://n6yqudl5bdtc" path="res://original data/images/fishy-.png" id="5_u8vaa"]
[ext_resource type="Texture2D" uid="uid://dn63xjbx8yqac" path="res://original data/images/splat0.png" id="7_qijva"]
[sub_resource type="SpriteFrames" id="SpriteFrames_10y2t"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("1_foolk")
}, {
"duration": 1.0,
"texture": ExtResource("2_dy21x")
}, {
"duration": 1.0,
"texture": ExtResource("3_qijva")
}, {
"duration": 1.0,
"texture": ExtResource("4_2qncy")
}, {
"duration": 1.0,
"texture": ExtResource("5_u8vaa")
}],
"loop": true,
"name": &"fish",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("7_qijva")
}],
"loop": true,
"name": &"splat",
"speed": 5.0
}]
[node name="Fish" type="Node2D" unique_id=1446966186]
script = ExtResource("1_dy21x")
[node name="Sprite" type="AnimatedSprite2D" parent="." unique_id=71448930]
sprite_frames = SubResource("SpriteFrames_10y2t")
animation = &"fish"
[node name="Label" type="Label" parent="Sprite" unique_id=1746822548]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -12.0
offset_top = -46.0
offset_right = -22.0
grow_horizontal = 2
grow_vertical = 2
horizontal_alignment = 1
vertical_alignment = 1

View File

@@ -7,7 +7,11 @@ func _on_pressed() -> void:
current_scene = self.get_parent().get_parent().get_parent()
if current_scene.game_mode == "cascade":
pass
$ButtonPress.play()
await $ButtonPress.finished
next_scene = load("res://scenes/game/fish_cascade.tscn").instantiate()
next_scene.word_set = self.text.to_lower().replace(" ", "")
get_tree().change_scene_to_node(next_scene)
elif current_scene.game_mode == "comet":
$ButtonPress.play()
await $ButtonPress.finished