forked from team-sg/hero-mark-2
roboturret has hue shifting eye
This commit is contained in:
parent
51a3214407
commit
1be92824ef
3 changed files with 35 additions and 2 deletions
Binary file not shown.
Before Width: | Height: | Size: 2 KiB After Width: | Height: | Size: 2 KiB |
|
@ -10,6 +10,9 @@ onready var shootpos = $ShootPos
|
||||||
onready var raycast = $RayCast2D
|
onready var raycast = $RayCast2D
|
||||||
const ArrowProjectile = preload("res://objects/enemy/roboturret_proj.tscn")
|
const ArrowProjectile = preload("res://objects/enemy/roboturret_proj.tscn")
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
death_sound = Audio.a_die_robot
|
||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
if raycast.is_colliding():
|
if raycast.is_colliding():
|
||||||
if sign(shootpos.position.x) == -1:
|
if sign(shootpos.position.x) == -1:
|
||||||
|
@ -29,6 +32,10 @@ func spawn_bullet():
|
||||||
Game.get_map().add_child(arrow)
|
Game.get_map().add_child(arrow)
|
||||||
timer.start(shoot_time)
|
timer.start(shoot_time)
|
||||||
|
|
||||||
|
func die():
|
||||||
|
.die()
|
||||||
|
Game.instance_node(load("res://objects/enemy/roboturret_die.tscn"), position.x, position.y, get_parent())
|
||||||
|
|
||||||
func _on_Timer_timeout():
|
func _on_Timer_timeout():
|
||||||
if !anims.is_playing(): spawn_bullet()
|
if !anims.is_playing(): spawn_bullet()
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
[gd_scene load_steps=9 format=2]
|
[gd_scene load_steps=11 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://shaders/1px_border.gdshader" type="Shader" id=1]
|
[ext_resource path="res://shaders/1px_border.gdshader" type="Shader" id=1]
|
||||||
[ext_resource path="res://graphics/enemy/roboturret.png" type="Texture" id=2]
|
[ext_resource path="res://graphics/enemy/roboturret.png" type="Texture" id=2]
|
||||||
[ext_resource path="res://objects/enemy/roboturret.gd" type="Script" id=3]
|
[ext_resource path="res://objects/enemy/roboturret.gd" type="Script" id=3]
|
||||||
|
[ext_resource path="res://graphics/enemy/tin_eye.png" type="Texture" id=4]
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id=1]
|
[sub_resource type="ShaderMaterial" id=1]
|
||||||
shader = ExtResource( 1 )
|
shader = ExtResource( 1 )
|
||||||
|
@ -107,7 +108,23 @@ tracks/2/keys = {
|
||||||
[sub_resource type="RectangleShape2D" id=5]
|
[sub_resource type="RectangleShape2D" id=5]
|
||||||
extents = Vector2( 4, 4 )
|
extents = Vector2( 4, 4 )
|
||||||
|
|
||||||
[node name="Roboturret" type="Node2D"]
|
[sub_resource type="Animation" id=6]
|
||||||
|
resource_name = "eye hue"
|
||||||
|
loop = true
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath("Eye:modulate")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PoolRealArray( 0, 0.5, 1 ),
|
||||||
|
"transitions": PoolRealArray( 1, 1, 1 ),
|
||||||
|
"update": 0,
|
||||||
|
"values": [ Color( 0.560784, 1, 0.560784, 1 ), Color( 1, 0.56, 0.567333, 1 ), Color( 0.560784, 1, 0.560784, 1 ) ]
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Roboturret" type="Node2D" groups=["enemy"]]
|
||||||
script = ExtResource( 3 )
|
script = ExtResource( 3 )
|
||||||
score_for_killing = 100
|
score_for_killing = 100
|
||||||
|
|
||||||
|
@ -118,6 +135,11 @@ texture = ExtResource( 2 )
|
||||||
hframes = 5
|
hframes = 5
|
||||||
region_rect = Rect2( 20, 0, 20, 16 )
|
region_rect = Rect2( 20, 0, 20, 16 )
|
||||||
|
|
||||||
|
[node name="Eye" type="Sprite" parent="."]
|
||||||
|
modulate = Color( 0.560784, 1, 0.560784, 1 )
|
||||||
|
position = Vector2( 3, 3 )
|
||||||
|
texture = ExtResource( 4 )
|
||||||
|
|
||||||
[node name="ShootPos" type="Position2D" parent="."]
|
[node name="ShootPos" type="Position2D" parent="."]
|
||||||
position = Vector2( -9, 2 )
|
position = Vector2( -9, 2 )
|
||||||
|
|
||||||
|
@ -143,5 +165,9 @@ collide_with_areas = true
|
||||||
position = Vector2( 4, 4 )
|
position = Vector2( 4, 4 )
|
||||||
shape = SubResource( 5 )
|
shape = SubResource( 5 )
|
||||||
|
|
||||||
|
[node name="EyeAnim" type="AnimationPlayer" parent="."]
|
||||||
|
autoplay = "eye hue"
|
||||||
|
"anims/eye hue" = SubResource( 6 )
|
||||||
|
|
||||||
[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]
|
[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]
|
||||||
[connection signal="area_entered" from="Hitbox" to="." method="_on_Hitbox_area_entered"]
|
[connection signal="area_entered" from="Hitbox" to="." method="_on_Hitbox_area_entered"]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue