one-dimensional vertical slice

This commit is contained in:
pennyrigate 2025-12-14 13:05:46 -05:00
parent 548a23d0e9
commit 3607ca7e2e
42 changed files with 692 additions and 2 deletions

14
objects/bosses/tesu.gd Normal file
View file

@ -0,0 +1,14 @@
extends Node2D
var health = 100.0
func _on_area_2d_area_entered(area: Area2D) -> void:
%HurtSound.play()
health -= 0.25
print(%Movements.current_animation)
if health < 50.0 && health >= 25.0 && %Movements.current_animation != "midway_left":
%Movements.play("midway_left")
if health < 25.0 && %Movements.current_animation != "pinch":
%Movements.play("pinch")
%AnimationPlayer.play("hurt")

View file

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

163
objects/bosses/tesu.tscn Normal file
View file

@ -0,0 +1,163 @@
[gd_scene load_steps=14 format=3 uid="uid://b1rm2x7lofhkm"]
[ext_resource type="Script" uid="uid://cv578r7dikm6r" path="res://objects/bosses/tesu.gd" id="1_aikw2"]
[ext_resource type="Texture2D" uid="uid://y0c5cddwa216" path="res://graphics/boss_sprites/tesu.png" id="1_h31ol"]
[ext_resource type="AudioStream" uid="uid://dwffpsx7xlfla" path="res://audio/sounds/boss_hit.ogg" id="3_aikw2"]
[ext_resource type="PackedScene" uid="uid://cciq2vk8sex8w" path="res://objects/bullet_emitter/test_bullet_emitter.tscn" id="4_jhpyq"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_1r8x3"]
size = Vector2(33, 35)
[sub_resource type="Curve" id="Curve_aikw2"]
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.13380282, 1), 0.0, 0.0, 0, 0, Vector2(0.42957747, 0.6778524), 0.0, 0.0, 0, 0, Vector2(0.64084506, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
point_count = 5
[sub_resource type="Animation" id="Animation_jhpyq"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Body/Sprite2D:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 1)]
}
[sub_resource type="Animation" id="Animation_aikw2"]
resource_name = "hurt"
length = 0.2
step = 0.0333333
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Body/Sprite2D:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 0,
"values": [Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_1r8x3"]
_data = {
&"RESET": SubResource("Animation_jhpyq"),
&"hurt": SubResource("Animation_aikw2")
}
[sub_resource type="Animation" id="Animation_smtp5"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Body:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, 0)]
}
[sub_resource type="Animation" id="Animation_1r8x3"]
resource_name = "midway_left"
length = 7.0
loop_mode = 1
step = 0.0333333
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Body:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 1, 2.5, 3.0333333, 4.1, 5, 6.4333334, 7),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1),
"update": 0,
"values": [Vector2(0, 0), Vector2(-80, 0), Vector2(-80, 0), Vector2(0, 0), Vector2(0, 0), Vector2(80, 0), Vector2(80, 0), Vector2(0, 0)]
}
[sub_resource type="Animation" id="Animation_sppxf"]
resource_name = "pinch"
length = 4.0
loop_mode = 1
step = 0.0333333
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Body:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.96666664, 2, 3, 4),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 0,
"values": [Vector2(0, 0), Vector2(-80, 0), Vector2(0, 0), Vector2(80, 0), Vector2(0, 0)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_sppxf"]
_data = {
&"RESET": SubResource("Animation_smtp5"),
&"midway_left": SubResource("Animation_1r8x3"),
&"pinch": SubResource("Animation_sppxf")
}
[node name="Tesu" type="Node2D"]
script = ExtResource("1_aikw2")
[node name="Body" type="Node2D" parent="."]
[node name="Sprite2D" type="Sprite2D" parent="Body"]
texture = ExtResource("1_h31ol")
[node name="Area2D" type="Area2D" parent="Body"]
collision_mask = 4
[node name="CollisionShape2D" type="CollisionShape2D" parent="Body/Area2D"]
position = Vector2(-0.5, 0.5)
shape = SubResource("RectangleShape2D_1r8x3")
[node name="TestBulletEmitter" parent="Body" instance=ExtResource("4_jhpyq")]
[node name="HurtSound" type="AudioStreamPlayer" parent="."]
unique_name_in_owner = true
stream = ExtResource("3_aikw2")
[node name="CPUParticles2D" type="CPUParticles2D" parent="."]
unique_name_in_owner = true
visible = false
emitting = false
amount = 3
lifetime = 0.2
one_shot = true
explosiveness = 0.31
randomness = 1.0
direction = Vector2(1, 1)
spread = 147.5
initial_velocity_min = 225.0
initial_velocity_max = 225.0
angle_max = 286.0
scale_amount_min = 3.0
scale_amount_max = 3.0
scale_amount_curve = SubResource("Curve_aikw2")
color = Color(1, 0, 0.22352941, 1)
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
unique_name_in_owner = true
libraries = {
&"": SubResource("AnimationLibrary_1r8x3")
}
[node name="Movements" type="AnimationPlayer" parent="."]
unique_name_in_owner = true
libraries = {
&"": SubResource("AnimationLibrary_sppxf")
}
[connection signal="area_entered" from="Body/Area2D" to="." method="_on_area_2d_area_entered"]

View file

@ -0,0 +1,10 @@
class_name BulletEmitter extends Node2D
@export var is_player_bullet = false
@export var bullet_type: PackedScene
func emit_bullets():
var SpawnedBullet = bullet_type.instantiate()
SpawnedBullet.is_player_bullet = is_player_bullet
SpawnedBullet.global_position = global_position
get_owner().get_owner().add_child(SpawnedBullet)

View file

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

View file

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://coijpuakhr7ux"]
[ext_resource type="Script" uid="uid://dgckw2ixj2mu5" path="res://objects/bullet_emitter/bullet_emitter.gd" id="1_hjn36"]
[node name="BulletEmitter" type="Node2D"]
script = ExtResource("1_hjn36")

View file

@ -0,0 +1,7 @@
extends BulletEmitter
func _on_timer_timeout() -> void:
for i in range(10):
emit_bullets()
%AudioStreamPlayer.play()

View file

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

View file

@ -0,0 +1,21 @@
[gd_scene load_steps=4 format=3 uid="uid://cciq2vk8sex8w"]
[ext_resource type="Script" uid="uid://vwpwjsd5e11o" path="res://objects/bullet_emitter/test_bullet_emitter.gd" id="1_qnpsh"]
[ext_resource type="PackedScene" uid="uid://je8ntnqgk0p6" path="res://objects/bullet_types/test_bullet.tscn" id="2_jdxi1"]
[ext_resource type="AudioStream" uid="uid://ct7yjy0e5kb02" path="res://audio/sounds/spawn_bullet_2.ogg" id="3_6pw22"]
[node name="TestBulletEmitter" type="Node2D"]
script = ExtResource("1_qnpsh")
bullet_type = ExtResource("2_jdxi1")
metadata/_custom_type_script = "uid://dgckw2ixj2mu5"
[node name="Timer" type="Timer" parent="."]
wait_time = 0.5
autostart = true
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
unique_name_in_owner = true
stream = ExtResource("3_6pw22")
volume_db = -5.0
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]

View file

@ -0,0 +1,3 @@
class_name Bullet extends Node2D
@export var is_player_bullet = false

View file

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

View file

@ -0,0 +1,14 @@
extends Bullet
var speed = Vector2.ZERO
var bullet_speed = 2
var angle = randf_range(-360,360)
var colors = [Color.RED,Color.BLUE,Color.GREEN,Color.YELLOW,]
func _ready() -> void:
var color_choice = randi_range(0,colors.size() - 1)
$Sprite.modulate = colors[color_choice]
func _physics_process(delta: float) -> void:
speed = Vector2.RIGHT.rotated(rad_to_deg(angle)) * bullet_speed
position += speed

View file

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

View file

@ -0,0 +1,61 @@
[gd_scene load_steps=8 format=3 uid="uid://je8ntnqgk0p6"]
[ext_resource type="Script" uid="uid://dgrxej0tqnnfd" path="res://objects/bullet_types/test_bullet.gd" id="1_nd7f1"]
[ext_resource type="Texture2D" uid="uid://du7gh3nk66mpo" path="res://graphics/bullets/normal_bullet/bullet_1.png" id="2_gcdq1"]
[ext_resource type="Texture2D" uid="uid://xe124f1kgf3x" path="res://graphics/bullets/normal_bullet/bullet_2.png" id="3_ic0v5"]
[ext_resource type="Texture2D" uid="uid://cenv3e67bv5fl" path="res://graphics/bullets/normal_bullet/bullet_core_1.png" id="4_ic0v5"]
[ext_resource type="Texture2D" uid="uid://4a633mudwp4q" path="res://graphics/bullets/normal_bullet/bullet_core_2.png" id="5_163b3"]
[sub_resource type="SpriteFrames" id="SpriteFrames_tg74j"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("2_gcdq1")
}, {
"duration": 1.0,
"texture": ExtResource("3_ic0v5")
}, {
"duration": 1.0,
"texture": ExtResource("3_ic0v5")
}, {
"duration": 1.0,
"texture": ExtResource("2_gcdq1")
}],
"loop": true,
"name": &"default",
"speed": 20.0
}]
[sub_resource type="SpriteFrames" id="SpriteFrames_10vvt"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("4_ic0v5")
}, {
"duration": 1.0,
"texture": ExtResource("5_163b3")
}, {
"duration": 1.0,
"texture": ExtResource("5_163b3")
}, {
"duration": 1.0,
"texture": ExtResource("4_ic0v5")
}],
"loop": true,
"name": &"default",
"speed": 20.0
}]
[node name="TestBullet" type="Node2D"]
script = ExtResource("1_nd7f1")
[node name="Sprite" type="AnimatedSprite2D" parent="."]
modulate = Color(0, 1, 1, 1)
sprite_frames = SubResource("SpriteFrames_tg74j")
autoplay = "default"
frame_progress = 0.26925442
[node name="Sprite2" type="AnimatedSprite2D" parent="."]
sprite_frames = SubResource("SpriteFrames_10vvt")
autoplay = "default"
frame_progress = 0.21053335

View file

@ -1,8 +1,11 @@
[gd_scene load_steps=3 format=3 uid="uid://bgoqv662xuf1r"]
[gd_scene load_steps=4 format=3 uid="uid://bgoqv662xuf1r"]
[ext_resource type="Script" uid="uid://b84vrx30l3hei" path="res://objects/player/bullet.gd" id="1_4hrp6"]
[ext_resource type="Texture2D" uid="uid://cm68ysi8ojc88" path="res://bullet.png" id="2_du4f6"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_du4f6"]
size = Vector2(8, 10)
[node name="Bullet" type="Node2D"]
script = ExtResource("1_4hrp6")
speed = Vector2(0, 500)
@ -10,3 +13,11 @@ speed = Vector2(0, 500)
[node name="Sprite2D" type="Sprite2D" parent="."]
position = Vector2(0, -5)
texture = ExtResource("2_du4f6")
[node name="Area2D" type="Area2D" parent="."]
collision_layer = 4
collision_mask = 7
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
position = Vector2(0, -5)
shape = SubResource("RectangleShape2D_du4f6")

View file

@ -19,5 +19,6 @@ wait_time = 0.1
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
stream = ExtResource("3_td01p")
volume_db = -10.0
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]