forked from team-sg/hero-mark-2
start work on boss1
This commit is contained in:
parent
ed04bf1c2e
commit
85f3a0af08
8 changed files with 244 additions and 7 deletions
40
objects/enemy/boss/boss1.gd
Normal file
40
objects/enemy/boss/boss1.gd
Normal file
|
@ -0,0 +1,40 @@
|
|||
extends "res://objects/enemy/enemy_move_sidesideupdown.gd"
|
||||
|
||||
var hp = 3
|
||||
var arrow_speed = 80
|
||||
export var phase2_speed = 100
|
||||
export var phase3_speed = 150
|
||||
const ArrowProjectile = preload("res://objects/player/arrow_projectile.tscn")
|
||||
const arrow_pickup = preload("res://objects/collectibles/arrow.tscn")
|
||||
onready var shoot_timer = $ShootTimer
|
||||
var shoot_time = Vector2(0.4,0.7)
|
||||
export var arrow_spawns = [Vector2(0,0),Vector2(0,0),Vector2(0,0)]
|
||||
|
||||
func _ready():
|
||||
seed(hash("HEROMARK2"))
|
||||
|
||||
func _physics_process(delta):
|
||||
match hp:
|
||||
2:
|
||||
speed = phase2_speed
|
||||
shoot_time = Vector2(0.4,0.5)
|
||||
1:
|
||||
speed = phase3_speed
|
||||
shoot_time = Vector2(0.3,0.5)
|
||||
0: die()
|
||||
|
||||
func shoot():
|
||||
var arrow = ArrowProjectile.instance()
|
||||
arrow.global_position = Vector2(
|
||||
global_position.x + $Position2D.position.x,
|
||||
stepify(global_position.y + $Position2D.position.y,8)
|
||||
)
|
||||
arrow.direction = -1
|
||||
arrow.breaks_on_wall = false
|
||||
arrow.target_group = "player"
|
||||
arrow.speed = arrow_speed
|
||||
get_owner().add_child(arrow)
|
||||
|
||||
func _on_ShootTimer_timeout():
|
||||
shoot_timer.start(rand_range(shoot_time.x,shoot_time.y))
|
||||
shoot()
|
90
objects/enemy/boss/boss1.tscn
Normal file
90
objects/enemy/boss/boss1.tscn
Normal file
|
@ -0,0 +1,90 @@
|
|||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://objects/enemy/boss/boss1.gd" type="Script" id=2]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 12, 8 )
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=2]
|
||||
extents = Vector2( 16, 12 )
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=3]
|
||||
extents = Vector2( 16, 4 )
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=4]
|
||||
extents = Vector2( 8, 8 )
|
||||
|
||||
[node name="Boss1" type="Node2D"]
|
||||
script = ExtResource( 2 )
|
||||
move_direction = 1
|
||||
flip_sprite = false
|
||||
|
||||
[node name="Sprite" type="ColorRect" parent="."]
|
||||
margin_left = 8.0
|
||||
margin_right = 40.0
|
||||
margin_bottom = 40.0
|
||||
color = Color( 0.960784, 0.2, 0.258824, 1 )
|
||||
|
||||
[node name="BackPack" type="ColorRect" parent="Sprite"]
|
||||
margin_left = 24.0
|
||||
margin_top = 8.0
|
||||
margin_right = 40.0
|
||||
margin_bottom = 32.0
|
||||
color = Color( 0.960784, 0.2, 0.258824, 1 )
|
||||
|
||||
[node name="LegR" type="ColorRect" parent="Sprite"]
|
||||
margin_top = 40.0
|
||||
margin_right = 8.0
|
||||
margin_bottom = 48.0
|
||||
color = Color( 0.960784, 0.2, 0.258824, 1 )
|
||||
|
||||
[node name="LegL" type="ColorRect" parent="Sprite"]
|
||||
margin_left = 24.0
|
||||
margin_top = 40.0
|
||||
margin_right = 32.0
|
||||
margin_bottom = 48.0
|
||||
color = Color( 0.960784, 0.2, 0.258824, 1 )
|
||||
|
||||
[node name="Visor" type="ColorRect" parent="Sprite"]
|
||||
margin_left = -8.0
|
||||
margin_top = 8.0
|
||||
margin_right = 16.0
|
||||
margin_bottom = 24.0
|
||||
color = Color( 0.27451, 0.796078, 0.756863, 1 )
|
||||
|
||||
[node name="WeakSpot" type="Area2D" parent="." groups=["boss_weakspot", "enemy_hitbox"]]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="WeakSpot"]
|
||||
position = Vector2( 12, 16 )
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="Hitbox" type="Area2D" parent="." groups=["blocks_arrow", "enemy_hitbox"]]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
|
||||
position = Vector2( 24, 36 )
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="CollisionShape2D2" type="CollisionShape2D" parent="Hitbox"]
|
||||
position = Vector2( 24, 4 )
|
||||
shape = SubResource( 3 )
|
||||
|
||||
[node name="CollisionShape2D3" type="CollisionShape2D" parent="Hitbox"]
|
||||
position = Vector2( 32, 16 )
|
||||
shape = SubResource( 4 )
|
||||
|
||||
[node name="ShootTimer" type="Timer" parent="."]
|
||||
wait_time = 0.5
|
||||
one_shot = true
|
||||
autostart = true
|
||||
|
||||
[node name="Position2D" type="Position2D" parent="."]
|
||||
position = Vector2( 8, 32 )
|
||||
|
||||
[node name="ArrowSpawnTimer" type="Timer" parent="."]
|
||||
wait_time = 5.0
|
||||
one_shot = true
|
||||
autostart = true
|
||||
|
||||
[connection signal="area_entered" from="Hitbox" to="." method="_on_Hitbox_area_entered"]
|
||||
[connection signal="timeout" from="ShootTimer" to="." method="_on_ShootTimer_timeout"]
|
||||
[connection signal="timeout" from="ArrowSpawnTimer" to="." method="_on_ArrowSpawnTimer_timeout"]
|
Loading…
Add table
Add a link
Reference in a new issue