Updated pattern for boss; trying to get it to spawn bullets.
This commit is contained in:
parent
caf2bffb0c
commit
e608652170
24 changed files with 606 additions and 28 deletions
67
scenes/boss.gd
Normal file
67
scenes/boss.gd
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
extends Area2D
|
||||
|
||||
var enemy_type: String = "boss"
|
||||
|
||||
var bullet_scene = preload("res://scenes/enemy_bullet.tscn")
|
||||
var start_pos = Vector2.ZERO
|
||||
var speed = 0
|
||||
var tween_speed: float = 1.4
|
||||
|
||||
var horse_counter = 0
|
||||
|
||||
var exploding = false
|
||||
|
||||
@onready var boss = $AnimationPlayer
|
||||
@onready var screensize = get_viewport_rect().size
|
||||
|
||||
func _ready():
|
||||
position = Vector2(screensize.x / 2, -screensize.y)
|
||||
var tween = create_tween().set_ease(Tween.EASE_OUT)
|
||||
tween.tween_property(self, "position:y", 100, 2)
|
||||
await tween.finished
|
||||
boss_intro()
|
||||
|
||||
|
||||
|
||||
func boss_intro():
|
||||
await get_tree().create_timer(2).timeout
|
||||
boss.play("align")
|
||||
await get_tree().create_timer(2).timeout
|
||||
boss.play("rise")
|
||||
await get_tree().create_timer(4).timeout
|
||||
boss.play("whisper")
|
||||
await get_tree().create_timer(1).timeout
|
||||
boss_horse()
|
||||
|
||||
func boss_horse():
|
||||
await get_tree().create_timer(2).timeout
|
||||
EventBus.flash_screen.emit(.25)
|
||||
$Sprite2D.frame = 7
|
||||
$Horse.show()
|
||||
var horse_player = $Horse/AnimationPlayer
|
||||
horse_player.play("run")
|
||||
await get_tree().create_timer(10).timeout
|
||||
EventBus.flash_screen.emit(.25)
|
||||
$Horse.hide()
|
||||
horse_counter += 1
|
||||
await get_tree().create_timer(5).timeout
|
||||
lady_of_whispers()
|
||||
|
||||
|
||||
func lady_of_whispers():
|
||||
boss.play("rise")
|
||||
await get_tree().create_timer(4).timeout
|
||||
boss.play("whisper")
|
||||
await get_tree().create_timer(1).timeout
|
||||
boss_horse()
|
||||
|
||||
|
||||
func hit_detection():
|
||||
return
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1
scenes/boss.gd.uid
Normal file
1
scenes/boss.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://c1wu3aga847b0
|
||||
197
scenes/boss.tscn
197
scenes/boss.tscn
|
|
@ -1,16 +1,211 @@
|
|||
[gd_scene format=3 uid="uid://bg5fq6ltr37r5"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://c7gbcrellomr1" path="res://sprites/boss.png" id="1_dlmty"]
|
||||
[ext_resource type="Script" uid="uid://c1wu3aga847b0" path="res://scenes/boss.gd" id="1_neq0i"]
|
||||
[ext_resource type="Texture2D" uid="uid://bqtdonm2hgrw3" path="res://sprites/horse_in_motion.png" id="3_jncid"]
|
||||
[ext_resource type="Script" uid="uid://2wtoqserm8g6" path="res://scenes/boss_horse.gd" id="3_r3bxh"]
|
||||
[ext_resource type="Texture2D" uid="uid://b0bdonvu25475" path="res://sprites/frame.png" id="4_qnbj4"]
|
||||
[ext_resource type="Texture2D" uid="uid://dy743vehs0t1t" path="res://icon.svg" id="5_wqpjq"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_neq0i"]
|
||||
size = Vector2(129, 63)
|
||||
|
||||
[node name="Boss" type="Area2D" unique_id=2108172712]
|
||||
[sub_resource type="Animation" id="Animation_jncid"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [4]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("../AnimationPlayer:speed_scale")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [1.5]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_qnbj4"]
|
||||
resource_name = "align"
|
||||
length = 2.0
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0.1, 1.5, 1.7333333, 2),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [4, 5, 6, 7]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("../AnimationPlayer:speed_scale")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [1.5]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_r3bxh"]
|
||||
resource_name = "Rise"
|
||||
length = 2.0
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0.1, 1.5, 1.7333333, 2),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [7, 8, 9, 0]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("../AnimationPlayer:speed_scale")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [1.5]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_wqpjq"]
|
||||
resource_name = "whisper"
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.25, 0.5),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [0, 1, 2]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_2cdgk"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_jncid"),
|
||||
&"align": SubResource("Animation_qnbj4"),
|
||||
&"rise": SubResource("Animation_r3bxh"),
|
||||
&"whisper": SubResource("Animation_wqpjq")
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_2cdgk"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [0]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_qsl3t"]
|
||||
resource_name = "run"
|
||||
length = 0.3333
|
||||
loop_mode = 1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.033333335, 0.06666667, 0.10000001, 0.13333334, 0.16666667, 0.20000002, 0.23333335, 0.26666668, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_2avx2"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_2cdgk"),
|
||||
&"run": SubResource("Animation_qsl3t")
|
||||
}
|
||||
|
||||
[node name="Boss" type="Area2D" unique_id=2108172712 groups=["boss"]]
|
||||
z_index = -1
|
||||
script = ExtResource("1_neq0i")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=523151470]
|
||||
texture = ExtResource("1_dlmty")
|
||||
hframes = 4
|
||||
vframes = 3
|
||||
frame = 4
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=12560305]
|
||||
position = Vector2(-0.5, 1.5)
|
||||
shape = SubResource("RectangleShape2D_neq0i")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="." unique_id=1476555217]
|
||||
root_node = NodePath("../Sprite2D")
|
||||
libraries/ = SubResource("AnimationLibrary_2cdgk")
|
||||
speed_scale = 1.5
|
||||
|
||||
[node name="Horse" type="Area2D" parent="." unique_id=926134296 groups=["horse"]]
|
||||
visible = false
|
||||
position = Vector2(0, 3)
|
||||
script = ExtResource("3_r3bxh")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="Horse" unique_id=1255792406]
|
||||
position = Vector2(8.34465e-07, -1.000004)
|
||||
scale = Vector2(1.3333334, 1.1076921)
|
||||
texture = ExtResource("3_jncid")
|
||||
hframes = 11
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Horse" unique_id=1900731949]
|
||||
position = Vector2(-0.5, 1.5)
|
||||
shape = SubResource("RectangleShape2D_neq0i")
|
||||
|
||||
[node name="Frame" type="Sprite2D" parent="Horse" unique_id=1984989709]
|
||||
position = Vector2(0, -3)
|
||||
texture = ExtResource("4_qnbj4")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="Horse" unique_id=755026998]
|
||||
libraries/ = SubResource("AnimationLibrary_2avx2")
|
||||
speed_scale = 0.55
|
||||
|
||||
[node name="Sprite2D2" type="Sprite2D" parent="Horse" unique_id=1735797796]
|
||||
visible = false
|
||||
texture = ExtResource("5_wqpjq")
|
||||
|
||||
[node name="Rotater" type="Node2D" parent="Horse" unique_id=697300019]
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="Horse/Rotater" unique_id=1703348402]
|
||||
self_modulate = Color(1, 0, 0, 1)
|
||||
scale = Vector2(0.453125, 0.453125)
|
||||
texture = ExtResource("5_wqpjq")
|
||||
|
||||
[node name="ShootTimer" type="Timer" parent="Horse" unique_id=914903842]
|
||||
wait_time = 0.05
|
||||
|
|
|
|||
17
scenes/boss_bullet.gd
Normal file
17
scenes/boss_bullet.gd
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
extends Node2D
|
||||
|
||||
@export var speed = 150
|
||||
|
||||
func start(pos):
|
||||
position = pos
|
||||
|
||||
func _process(delta):
|
||||
position += transform.x * speed * delta
|
||||
|
||||
func _on_visible_on_screen_notifier_2d_screen_exited():
|
||||
queue_free()
|
||||
|
||||
func _on_area_entered(area):
|
||||
if area.name == "Player":
|
||||
queue_free()
|
||||
area.shield -= 1
|
||||
1
scenes/boss_bullet.gd.uid
Normal file
1
scenes/boss_bullet.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://d15l4y8332rni
|
||||
22
scenes/boss_bullet.tscn
Normal file
22
scenes/boss_bullet.tscn
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
[gd_scene format=3 uid="uid://dvjyo1xwrg3m7"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://d15l4y8332rni" path="res://scenes/boss_bullet.gd" id="1_i5ved"]
|
||||
[ext_resource type="Texture2D" uid="uid://dubjbfdp6ep34" path="res://_graphics/Mini Pixel Pack 3/Projectiles/Enemy_projectile (16 x 16).png" id="2_borja"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_gl7bs"]
|
||||
size = Vector2(6, 6)
|
||||
|
||||
[node name="BossBullet" type="Area2D" unique_id=722316887 groups=["enemy_bullets"]]
|
||||
script = ExtResource("1_i5ved")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=1936412719]
|
||||
texture = ExtResource("2_borja")
|
||||
hframes = 4
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=2029704873]
|
||||
shape = SubResource("RectangleShape2D_gl7bs")
|
||||
|
||||
[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="." unique_id=1574374158]
|
||||
|
||||
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
||||
[connection signal="screen_exited" from="VisibleOnScreenNotifier2D" to="." method="_on_visible_on_screen_notifier_2d_screen_exited"]
|
||||
82
scenes/boss_horse.gd
Normal file
82
scenes/boss_horse.gd
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
extends Area2D
|
||||
|
||||
var enemy_type: String = "horse"
|
||||
|
||||
var bullet_scene = preload("res://scenes/boss_bullet.tscn")
|
||||
var start_pos = Vector2.ZERO
|
||||
var speed = 0
|
||||
var tween_speed: float = 1.4
|
||||
|
||||
var exploding = false
|
||||
|
||||
var rotate_speed: int = 100
|
||||
var shooter_timer_wait_time: float = 0.2
|
||||
var spawn_point_count: int = 4
|
||||
var spawn_radius = 100
|
||||
|
||||
|
||||
@onready var boss = $AnimationPlayer
|
||||
@onready var shoot_timer = $ShootTimer
|
||||
@onready var rotater = $Rotater
|
||||
@onready var screensize = get_viewport_rect().size
|
||||
|
||||
func _ready():
|
||||
spawn_bullet()
|
||||
|
||||
#var step = 2 * PI / spawn_point_count
|
||||
|
||||
#for i in range(spawn_point_count):
|
||||
#var spawn_point = Node2D.new()
|
||||
#var pos = Vector2(spawn_radius, 0).rotated(step * i)
|
||||
#spawn_point.position = pos
|
||||
#spawn_point.rotation = pos.angle()
|
||||
#rotater.add_child(spawn_point)
|
||||
|
||||
#shoot_timer.wait_time = shooter_timer_wait_time
|
||||
#shoot_timer.start()
|
||||
|
||||
#func _process(delta: float) -> void:
|
||||
#var new_rotation = rotater.rotation_degrees + rotate_speed * delta
|
||||
#rotater.rotation_degrees - fmod(new_rotation, 360
|
||||
|
||||
|
||||
func _process(delta):
|
||||
rotater.rotation_degrees += 2 # Adjust rotation speed
|
||||
|
||||
func spawn_bullet():
|
||||
var bullet = bullet_scene.instantiate()
|
||||
bullet.position = rotater.global_position
|
||||
get_parent().add_child(bullet)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
func _on_ShootTimer_timeout() -> void:
|
||||
spawn_bullet()
|
||||
#for s in rotater.get_children():
|
||||
#var b = bullet_scene.instantiate()
|
||||
#get_tree().root.add_child(b)
|
||||
##b.position = s.global_position
|
||||
##b.rotation = s.global_rotation
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
func boss_horse():
|
||||
await get_tree().create_timer(2).timeout
|
||||
EventBus.flash_screen.emit(.25)
|
||||
$Sprite2D.frame = 6
|
||||
$Horse.show()
|
||||
$CollisionShape2D.show()
|
||||
var horse_player = $Horse/AnimationPlayer
|
||||
horse_player.play("run")
|
||||
await get_tree().create_timer(5).timeout
|
||||
EventBus.flash_screen.emit(.25)
|
||||
$Horse.hide()
|
||||
$CollisionShape2D.show()
|
||||
|
||||
func hit_detection():
|
||||
print("Horse hit!")
|
||||
1
scenes/boss_horse.gd.uid
Normal file
1
scenes/boss_horse.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://2wtoqserm8g6
|
||||
|
|
@ -5,13 +5,32 @@ extends Area2D
|
|||
@export var speed = -250
|
||||
var shader_active = false
|
||||
var pause = false
|
||||
var target = null
|
||||
|
||||
func start(pos):
|
||||
position = pos
|
||||
|
||||
func _ready():
|
||||
var target_node = get_parent().get_node("root/$EnemyShard")
|
||||
#var target = target_node.is_in_group("shards")
|
||||
|
||||
|
||||
func _process(delta):
|
||||
if pause == true: return
|
||||
position.y += speed * delta
|
||||
|
||||
if target:
|
||||
var direction = (target.position - position).normalized()
|
||||
position += direction * speed * delta
|
||||
|
||||
if position.distance_to(target.position) < 10:
|
||||
stick_to_target(target)
|
||||
|
||||
func stick_to_target(target):
|
||||
target.add_child(bullet)
|
||||
print("Sticking to target!")
|
||||
position = Vector2.ZERO
|
||||
|
||||
|
||||
# Signal checks to see if the bullet leaves the viewport then removes bullet.
|
||||
func _on_visible_on_screen_notifier_2d_screen_exited() -> void:
|
||||
|
|
@ -20,19 +39,20 @@ func _on_visible_on_screen_notifier_2d_screen_exited() -> void:
|
|||
func _on_area_entered(area: Area2D) -> void:
|
||||
|
||||
if area.is_in_group("enemies"):
|
||||
|
||||
match area.enemy_type:
|
||||
"crt":
|
||||
if area.is_in_group("enemies"):
|
||||
print("CRT hit!")
|
||||
area.hit_detection()
|
||||
queue_free()
|
||||
|
||||
|
||||
"shards":
|
||||
if area.is_in_group("shards"):
|
||||
print("Shards hit!")
|
||||
area.hit_detection()
|
||||
#stick_to_target(target)
|
||||
queue_free()
|
||||
|
||||
|
||||
"mirror":
|
||||
if area.is_in_group("enemies"):
|
||||
|
|
@ -45,6 +65,16 @@ func _on_area_entered(area: Area2D) -> void:
|
|||
print("Chicken hit!")
|
||||
area.hit_detection()
|
||||
queue_free()
|
||||
|
||||
_:
|
||||
if area.is_in_group("enemies"):
|
||||
area.hit_detection()
|
||||
|
||||
|
||||
if area.is_in_group("boss"):
|
||||
print("I've shot the boss")
|
||||
queue_free()
|
||||
|
||||
|
||||
#func bullet_fx():
|
||||
#shader_active = true
|
||||
|
|
|
|||
|
|
@ -14,14 +14,13 @@ var can_shoot = true
|
|||
var vulnerable = true
|
||||
var stunned = false
|
||||
var blocking = false
|
||||
var travel: bool = false
|
||||
|
||||
var shader_active = false
|
||||
|
||||
var enemy_move_aggression = randf_range(5, 20)
|
||||
var enemy_shoot_aggression = randf_range(4, 20)
|
||||
|
||||
const TILE = 32
|
||||
|
||||
@onready var screensize = get_viewport_rect().size
|
||||
@onready var move_timer = $MoveTimer
|
||||
@onready var crt = $CRT
|
||||
|
|
@ -30,19 +29,19 @@ func _ready():
|
|||
move_timer.start()
|
||||
|
||||
func start(pos):
|
||||
vulnerable = true
|
||||
speed = 4
|
||||
crt.frame = 0
|
||||
#var pos_mod = randf_range(-TILE,TILE) #modify the start position randomly
|
||||
#position = Vector2(pos.x + pos_mod, -pos.y) #add the modifier
|
||||
position = Vector2(pos.x, -pos.y)
|
||||
start_pos = pos
|
||||
await get_tree().create_timer(randf_range(0.25, 0.35)).timeout
|
||||
var tween = create_tween().set_trans(Tween.TRANS_BACK)
|
||||
tween.tween_property(self, "position:y", start_pos.y, tween_speed)
|
||||
await tween.finished
|
||||
move_timer.wait_time = enemy_move_aggression
|
||||
travel = true
|
||||
# move_timer.wait_time = enemy_move_aggression
|
||||
move_timer.start()
|
||||
$ShootTimer.wait_time = enemy_shoot_aggression
|
||||
# $ShootTimer.wait_time = enemy_shoot_aggression
|
||||
$ShootTimer.start()
|
||||
|
||||
func _on_timer_timeout():
|
||||
|
|
@ -50,7 +49,7 @@ func _on_timer_timeout():
|
|||
$DirectionTimer.start()
|
||||
|
||||
func _on_direction_timer_timeout():
|
||||
var move_direction = int(randf_range(0,3))
|
||||
var move_direction = randi_range(0,2)
|
||||
match move_direction:
|
||||
0:
|
||||
crt.frame = 0
|
||||
|
|
@ -92,10 +91,11 @@ func _process(delta):
|
|||
if stunned == false:
|
||||
position += direction * speed * delta
|
||||
|
||||
if position.x > screensize.x + 32:
|
||||
start(start_pos)
|
||||
#if position.x > screensize.x + 32:
|
||||
#start(start_pos)
|
||||
|
||||
if position.y > screensize.y + 32:
|
||||
if travel == true and position.y > screensize.y + 32 or position.x > screensize.x or position.x < -screensize.x:
|
||||
print("I'm off screen!")
|
||||
start(start_pos)
|
||||
|
||||
|
||||
|
|
@ -128,7 +128,7 @@ func block():
|
|||
crt.material.set_shader_parameter("toggle", 0.0)
|
||||
shader_active = false
|
||||
stunned = false
|
||||
$DirectionTimer.stop()
|
||||
$DirectionTimer.start()
|
||||
print("CRT Not Stunned!")
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ shader = SubResource("Shader_emiuq")
|
|||
shader_parameter/toggle = 0.0
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_4gyqm"]
|
||||
size = Vector2(32.727318, 27.272764)
|
||||
size = Vector2(32.727318, 23.636396)
|
||||
|
||||
[sub_resource type="Animation" id="Animation_h1rgn"]
|
||||
length = 0.001
|
||||
|
|
@ -233,7 +233,7 @@ region_enabled = true
|
|||
region_rect = Rect2(0, 0, 96, 28)
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1841693239]
|
||||
position = Vector2(4.334883e-07, 4.334883e-07)
|
||||
position = Vector2(0, -5.818181)
|
||||
scale = Vector2(0.99999857, 0.99999857)
|
||||
shape = SubResource("RectangleShape2D_4gyqm")
|
||||
|
||||
|
|
@ -247,6 +247,7 @@ one_shot = true
|
|||
|
||||
[node name="DirectionTimer" type="Timer" parent="." unique_id=2080229505]
|
||||
wait_time = 0.75
|
||||
one_shot = true
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="." unique_id=702523492]
|
||||
libraries/ = SubResource("AnimationLibrary_7ellt")
|
||||
|
|
|
|||
44
scenes/enemy_rotater.gd
Normal file
44
scenes/enemy_rotater.gd
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
extends Node2D
|
||||
|
||||
var enemy_type: String = "horse"
|
||||
|
||||
var bullet_scene = preload("res://scenes/boss_bullet.tscn")
|
||||
var start_pos = Vector2.ZERO
|
||||
var speed = 0
|
||||
var tween_speed: float = 1.4
|
||||
|
||||
var exploding = false
|
||||
|
||||
var rotate_speed: int = 100
|
||||
var shooter_timer_wait_time: float = 0.2
|
||||
var spawn_point_count: int = 4
|
||||
var spawn_radius = 100
|
||||
|
||||
@onready var shoot_timer = $ShootTimer
|
||||
@onready var rotater = $Rotater
|
||||
@onready var screensize = get_viewport_rect().size
|
||||
|
||||
func _ready():
|
||||
var step = 2 * PI / spawn_point_count
|
||||
|
||||
for i in range(spawn_point_count):
|
||||
var spawn_point = Node2D.new()
|
||||
var pos = Vector2(spawn_radius, 0).rotated(step * i)
|
||||
spawn_point.position = pos
|
||||
spawn_point.rotation = pos.angle()
|
||||
rotater.add_child(spawn_point)
|
||||
|
||||
shoot_timer.wait_time = shooter_timer_wait_time
|
||||
shoot_timer.start()
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
var new_rotation = rotater.rotation_degrees + rotate_speed * delta
|
||||
rotater.rotation_degrees - fmod(new_rotation, 360)
|
||||
|
||||
func _on_ShootTimer_timeout() -> void:
|
||||
for s in rotater.get_children():
|
||||
var b = bullet_scene.instantiate()
|
||||
get_tree().root.add_child(b)
|
||||
b.position = s.global_position
|
||||
b.rotation = s.global_rotation
|
||||
|
||||
1
scenes/enemy_rotater.gd.uid
Normal file
1
scenes/enemy_rotater.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://crtv1bey5t4d3
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
extends Node2D
|
||||
|
||||
var scroll_multiplier: float = 200
|
||||
var scroll_multiplier: float = 400
|
||||
|
||||
@onready var parallax_nodes = get_tree().get_nodes_in_group("parallax_clouds")
|
||||
|
||||
|
|
@ -8,11 +8,17 @@ func _ready():
|
|||
EventBus.cloud_speed.connect(_on_cloud_speed)
|
||||
|
||||
func _on_cloud_speed():
|
||||
$CoffeeBuoy.hide()
|
||||
|
||||
for node in parallax_nodes:
|
||||
if node is Parallax2D:
|
||||
var current_autoscroll = node.get_autoscroll()
|
||||
current_autoscroll.y += scroll_multiplier
|
||||
node.set_autoscroll(current_autoscroll)
|
||||
node.set_modulate(Color(0.40,0.40,0.40))
|
||||
|
||||
var tween = create_tween().set_trans(Tween.TRANS_LINEAR)
|
||||
tween.tween_property(node, "autoscroll:y", scroll_multiplier, 5)
|
||||
tween.tween_property(node, "modulate",Color(0.40,0.40,0.40), 2.5)
|
||||
|
||||
var coffee_dip = create_tween().set_trans(Tween.TRANS_QUAD)
|
||||
coffee_dip.tween_property($CoffeeBuoy, "modulate", Color(0.40,0.40,0.40,0),2.5)
|
||||
coffee_dip.tween_property($CoffeeBuoy, "scale", .25, 2.5)
|
||||
await coffee_dip.finished
|
||||
$CoffeeBuoy.hide()
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ scale = Vector2(0.75, 0.75)
|
|||
texture = ExtResource("2_pcgsf")
|
||||
flip_h = true
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="." unique_id=23364495]
|
||||
[node name="ColorRect" type="ColorRect" parent="." unique_id=23364495 groups=["parallax_clouds"]]
|
||||
z_index = -5
|
||||
offset_right = 239.0
|
||||
offset_bottom = 323.0
|
||||
|
|
|
|||
|
|
@ -118,8 +118,17 @@ func _on_area_entered(area):
|
|||
shield -= int(max_shield / 2)
|
||||
_on_damage_taken()
|
||||
area.hit_detection()
|
||||
|
||||
if area.is_in_group("enemy_bullets") and self.monitoring == true:
|
||||
damage_taken.emit()
|
||||
|
||||
if area.is_in_group("horse"):
|
||||
print("Entered horse!")
|
||||
shield -= int(max_shield / 2)
|
||||
_on_damage_taken()
|
||||
|
||||
if area.is_in_group("boss"):
|
||||
print("Entered boss!")
|
||||
|
||||
func _on_damage_taken():
|
||||
|
||||
|
|
|
|||
19
scenes/rotater.tscn
Normal file
19
scenes/rotater.tscn
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
[gd_scene format=3 uid="uid://q6u258bmjd8a"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://crtv1bey5t4d3" path="res://scenes/enemy_rotater.gd" id="1_i05h2"]
|
||||
[ext_resource type="Texture2D" uid="uid://dy743vehs0t1t" path="res://icon.svg" id="2_q7b1l"]
|
||||
|
||||
[node name="Enemy" type="Node2D" unique_id=467257901]
|
||||
script = ExtResource("1_i05h2")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=1152422291]
|
||||
texture = ExtResource("2_q7b1l")
|
||||
|
||||
[node name="Rotater" type="Node2D" parent="." unique_id=75253912]
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="Rotater" unique_id=1800109985]
|
||||
self_modulate = Color(1, 0, 0, 1)
|
||||
scale = Vector2(0.453125, 0.453125)
|
||||
texture = ExtResource("2_q7b1l")
|
||||
|
||||
[node name="ShootTimer" type="Timer" parent="." unique_id=1315774765]
|
||||
|
|
@ -50,6 +50,7 @@ func hit_detection():
|
|||
|
||||
if health == 0:
|
||||
exploding = true
|
||||
EventBus.flash_screen.emit(0.25)
|
||||
impact_sound.play()
|
||||
#await impact_sound.finished
|
||||
#find all nodes in group "shards" and then queue_free.
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ func _ready():
|
|||
|
||||
func spawn_enemies():
|
||||
|
||||
if wave_count == 3: #This is for CHICKENS
|
||||
if wave_count == 2: #This is for CHICKENS
|
||||
print("Enemy Wave: ", wave_count)
|
||||
enemy = CHICKEN
|
||||
for x in range(COLS):
|
||||
|
|
@ -38,7 +38,7 @@ func spawn_enemies():
|
|||
await get_tree().process_frame
|
||||
print_debug("Remaining enemies: ", enemy_count, ", ", get_tree().get_nodes_in_group("enemies").size())
|
||||
|
||||
if wave_count == 2: #This is for CRTs
|
||||
if wave_count == 3: #This is for CRTs
|
||||
print("Enemy Wave: ", wave_count)
|
||||
enemy = CRT
|
||||
var cols_mod = COLS - 1
|
||||
|
|
@ -53,7 +53,7 @@ func spawn_enemies():
|
|||
enemy_count = rows_mod * cols_mod
|
||||
await get_tree().process_frame
|
||||
|
||||
if wave_count == 1: #This if for Mirror
|
||||
if wave_count == 0 : #This if for Mirror
|
||||
print("Enemy Wave: ", wave_count)
|
||||
|
||||
# Spawn Table
|
||||
|
|
@ -89,8 +89,9 @@ func spawn_enemies():
|
|||
s.start_all_animations()
|
||||
|
||||
|
||||
if wave_count == 0: #This is for Boss
|
||||
|
||||
if wave_count == 1 : #This is for Boss
|
||||
|
||||
# Hide the player
|
||||
|
||||
# Speed up parallax
|
||||
EventBus.cloud_speed.emit()
|
||||
|
|
@ -99,7 +100,7 @@ func spawn_enemies():
|
|||
EventBus.flash_screen.emit(.25)
|
||||
var b = BOSS.instantiate()
|
||||
add_child(b)
|
||||
b.position = Vector2(screensize.x / 2, position.y + 100)
|
||||
#b.position = Vector2(screensize.x / 2, position.y + 100)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
BIN
sprites/boss.png
BIN
sprites/boss.png
Binary file not shown.
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 6 KiB |
BIN
sprites/frame.png
Normal file
BIN
sprites/frame.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 566 B |
40
sprites/frame.png.import
Normal file
40
sprites/frame.png.import
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b0bdonvu25475"
|
||||
path="res://.godot/imported/frame.png-5d6513f2dbddce1cfadf7a13c1a22d71.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://sprites/frame.png"
|
||||
dest_files=["res://.godot/imported/frame.png-5d6513f2dbddce1cfadf7a13c1a22d71.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
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/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
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
|
||||
BIN
sprites/horse_in_motion.png
Normal file
BIN
sprites/horse_in_motion.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
40
sprites/horse_in_motion.png.import
Normal file
40
sprites/horse_in_motion.png.import
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bqtdonm2hgrw3"
|
||||
path="res://.godot/imported/horse_in_motion.png-389fb5f8a67400c0a7da0d35a45b444a.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://sprites/horse_in_motion.png"
|
||||
dest_files=["res://.godot/imported/horse_in_motion.png-389fb5f8a67400c0a7da0d35a45b444a.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
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/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
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