Wired up boss heart behaviour
This commit is contained in:
parent
bee8cf77f1
commit
a13f274767
7 changed files with 95 additions and 15 deletions
|
|
@ -7,7 +7,7 @@ var start_pos = Vector2.ZERO
|
|||
var speed = 0
|
||||
var tween_speed: float = 1.4
|
||||
|
||||
var horse_counter = 0
|
||||
var horse_counter = 1
|
||||
|
||||
var exploding = false
|
||||
|
||||
|
|
@ -39,8 +39,9 @@ func boss_horse():
|
|||
print("Boss horse!")
|
||||
await get_tree().create_timer(2).timeout
|
||||
EventBus.flash_screen.emit(.25)
|
||||
$Sprite2D.frame = 7
|
||||
$Heart.hide()
|
||||
$Horse.show()
|
||||
$Sprite2D.frame = 7
|
||||
$Horse.start()
|
||||
var horse_player = $Horse/AnimationPlayer
|
||||
horse_player.play("run")
|
||||
|
|
@ -48,23 +49,38 @@ func boss_horse():
|
|||
EventBus.flash_screen.emit(.25)
|
||||
$Horse.hide()
|
||||
$Horse.end()
|
||||
horse_counter += 1
|
||||
await get_tree().create_timer(5).timeout
|
||||
horse_counter += 1
|
||||
lady_of_whispers()
|
||||
|
||||
|
||||
func lady_of_whispers():
|
||||
print("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()
|
||||
|
||||
if horse_counter == 2:
|
||||
|
||||
print("Lady of Whispers offers you a heart!")
|
||||
boss.play("rise")
|
||||
await get_tree().create_timer(4).timeout
|
||||
# boss.play("whisper")
|
||||
offer_heart()
|
||||
|
||||
if horse_counter <= 1:
|
||||
print("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
|
||||
|
||||
|
||||
func offer_heart():
|
||||
$Heart.show()
|
||||
await get_tree().create_timer(4).timeout
|
||||
boss_horse()
|
||||
horse_counter = 0
|
||||
print("Horse Counter:",horse_counter)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
[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"]
|
||||
[ext_resource type="Texture2D" uid="uid://c4nhwvs13x5bc" path="res://sprites/heart.png" id="7_2cdgk"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_neq0i"]
|
||||
size = Vector2(129, 63)
|
||||
|
|
@ -154,6 +155,9 @@ _data = {
|
|||
&"run": SubResource("Animation_qsl3t")
|
||||
}
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_qsl3t"]
|
||||
size = Vector2(31, 28)
|
||||
|
||||
[node name="Boss" type="Area2D" unique_id=2108172712 groups=["boss"]]
|
||||
z_index = -1
|
||||
script = ExtResource("1_neq0i")
|
||||
|
|
@ -212,4 +216,14 @@ texture = ExtResource("5_wqpjq")
|
|||
wait_time = 0.05
|
||||
one_shot = true
|
||||
|
||||
[node name="Heart" type="Area2D" parent="." unique_id=1098254590 groups=["heart"]]
|
||||
position = Vector2(0, -71)
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="Heart" unique_id=520903474]
|
||||
texture = ExtResource("7_2cdgk")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Heart" unique_id=11221326]
|
||||
position = Vector2(0.5, 0)
|
||||
shape = SubResource("RectangleShape2D_qsl3t")
|
||||
|
||||
[connection signal="timeout" from="Horse/ShootTimer" to="Horse" method="_on_shoot_timer_timeout"]
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@ var tween_speed: float = 1.4
|
|||
var exploding = false
|
||||
|
||||
var rotate_speed: int = 100
|
||||
var shoot_timer_wait_time: float = 0.2
|
||||
var rotate_direction: int = 0
|
||||
var shoot_timer_wait_time: float = 0.1
|
||||
var spawn_point_count: int = 4
|
||||
var spawn_radius = 100
|
||||
|
||||
|
|
@ -44,6 +45,7 @@ var horse_phase: bool = false
|
|||
|
||||
func start():
|
||||
shoot_timer.start()
|
||||
rotate_direction = randi_range(0,1)
|
||||
print("Shoot timer started!")
|
||||
|
||||
func end():
|
||||
|
|
@ -51,7 +53,11 @@ func end():
|
|||
|
||||
|
||||
func _process(delta):
|
||||
rotater.rotation_degrees += 2 # Adjust rotation speed
|
||||
|
||||
if rotate_direction == 0:
|
||||
rotater.rotation_degrees += 2.5 # Adjust rotation speed
|
||||
if rotate_direction == 1:
|
||||
rotater.rotation_degrees -= 2.5 # Adjust rotation speed
|
||||
|
||||
func spawn_bullet():
|
||||
print("I'm spawning bullets!")
|
||||
|
|
|
|||
|
|
@ -71,9 +71,10 @@ func _on_area_entered(area: Area2D) -> void:
|
|||
area.hit_detection()
|
||||
|
||||
|
||||
if area.is_in_group("boss"):
|
||||
print("I've shot the boss")
|
||||
queue_free()
|
||||
if area.is_in_group("heart"):
|
||||
print("I've shot the heart!")
|
||||
area.hit_detection()
|
||||
queue_free()
|
||||
|
||||
|
||||
#func bullet_fx():
|
||||
|
|
|
|||
|
|
@ -129,6 +129,9 @@ func _on_area_entered(area):
|
|||
|
||||
if area.is_in_group("boss"):
|
||||
print("Entered boss!")
|
||||
|
||||
if area.is_in_group("heart"):
|
||||
print("Got the heart!")
|
||||
|
||||
func _on_damage_taken():
|
||||
|
||||
|
|
|
|||
BIN
sprites/heart.png
Normal file
BIN
sprites/heart.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 299 B |
40
sprites/heart.png.import
Normal file
40
sprites/heart.png.import
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c4nhwvs13x5bc"
|
||||
path="res://.godot/imported/heart.png-69bff64251259751f4bcc5909839a008.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://sprites/heart.png"
|
||||
dest_files=["res://.godot/imported/heart.png-69bff64251259751f4bcc5909839a008.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