skeletons can be flipped!
This commit is contained in:
parent
a2eaf0f214
commit
fcfeabed8b
3 changed files with 41 additions and 63 deletions
|
@ -2,7 +2,7 @@ extends "res://objects/enemy/enemy.gd"
|
|||
|
||||
const ArrowProjectile = preload("res://objects/player/arrow_projectile.tscn")
|
||||
const BoneParticle = preload("res://objects/enemy/bone_particle.tscn")
|
||||
const arrowpos = Vector2(4,4)
|
||||
const arrowpos = Vector2(9,2)
|
||||
|
||||
export var shoot_time = 1.0
|
||||
export var arrow_speed = 120.0
|
||||
|
@ -13,6 +13,8 @@ export var bones_speed = 50.0
|
|||
onready var timer = $Timer
|
||||
onready var anims = $AnimationPlayer
|
||||
onready var sprite = $Sprite
|
||||
onready var arrow_spawn_l = $ArrowSpawnL
|
||||
onready var arrow_spawn_r = $ArrowSpawnR
|
||||
|
||||
func _ready():
|
||||
death_sound = Game.a_die_skeleton
|
||||
|
@ -23,11 +25,11 @@ func _on_Timer_timeout():
|
|||
|
||||
func spawn_arrow():
|
||||
var arrow = ArrowProjectile.instance()
|
||||
arrow.global_position = Vector2(
|
||||
global_position.x + arrowpos.x * sprite.scale.x,
|
||||
global_position.y + arrowpos.y
|
||||
)
|
||||
arrow.direction = sprite.scale.x
|
||||
if scale.x > 0:
|
||||
arrow.global_position = global_position + arrow_spawn_r.position
|
||||
else:
|
||||
arrow.global_position = global_position + arrow_spawn_l.position
|
||||
arrow.direction = scale.x
|
||||
arrow.target_group = "player"
|
||||
arrow.speed = arrow_speed
|
||||
Game.get_map().add_child(arrow)
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
[gd_scene load_steps=18 format=2]
|
||||
[gd_scene load_steps=8 format=2]
|
||||
|
||||
[ext_resource path="res://scripts/1px_border.gdshader" type="Shader" id=1]
|
||||
[ext_resource path="res://graphics/enemy/skelarcher_shoot.png" type="Texture" id=2]
|
||||
[ext_resource path="res://graphics/enemy/skelarcher_idle.png" type="Texture" id=3]
|
||||
[ext_resource path="res://objects/enemy/skelarcher.gd" type="Script" id=4]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id=18]
|
||||
|
@ -10,52 +9,6 @@ shader = ExtResource( 1 )
|
|||
shader_param/border_color = Color( 0, 0, 0, 1 )
|
||||
shader_param/border_corners = true
|
||||
|
||||
[sub_resource type="ShaderMaterial" id=1]
|
||||
shader = ExtResource( 1 )
|
||||
shader_param/border_color = Color( 0, 0, 0, 1 )
|
||||
shader_param/border_corners = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id=11]
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 0, 0, 19, 20 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=12]
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 19, 0, 19, 20 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=13]
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 38, 0, 19, 20 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=14]
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 57, 0, 19, 20 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=15]
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 76, 0, 19, 20 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=16]
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 95, 0, 19, 20 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=17]
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 114, 0, 19, 20 )
|
||||
|
||||
[sub_resource type="SpriteFrames" id=9]
|
||||
animations = [ {
|
||||
"frames": [ ExtResource( 3 ) ],
|
||||
"loop": true,
|
||||
"name": "idle",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ SubResource( 11 ), SubResource( 12 ), SubResource( 13 ), SubResource( 14 ), SubResource( 15 ), SubResource( 16 ), SubResource( 17 ) ],
|
||||
"loop": false,
|
||||
"name": "shoot",
|
||||
"speed": 15.0
|
||||
} ]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=10]
|
||||
extents = Vector2( 4, 4 )
|
||||
|
||||
|
@ -148,18 +101,13 @@ shoot_time = 3.0
|
|||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
material = SubResource( 18 )
|
||||
position = Vector2( 5, -2 )
|
||||
texture = ExtResource( 2 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 0, 0, 19, 20 )
|
||||
|
||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
|
||||
visible = false
|
||||
material = SubResource( 1 )
|
||||
frames = SubResource( 9 )
|
||||
animation = "idle"
|
||||
playing = true
|
||||
|
||||
[node name="Hitbox" type="Area2D" parent="." groups=["enemy_hitbox"]]
|
||||
position = Vector2( 5, -2 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
|
||||
position = Vector2( -1, 6 )
|
||||
|
@ -171,5 +119,11 @@ shape = SubResource( 10 )
|
|||
anims/idle = SubResource( 19 )
|
||||
anims/shoot = SubResource( 20 )
|
||||
|
||||
[node name="ArrowSpawnR" type="Position2D" parent="."]
|
||||
position = Vector2( 9, 2 )
|
||||
|
||||
[node name="ArrowSpawnL" type="Position2D" parent="."]
|
||||
position = Vector2( -9, 2 )
|
||||
|
||||
[connection signal="area_entered" from="Hitbox" to="." method="_on_Hitbox_area_entered"]
|
||||
[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue