diff --git a/maps/canopy.tscn b/maps/canopy.tscn index ceb85e3..5dfaa23 100644 --- a/maps/canopy.tscn +++ b/maps/canopy.tscn @@ -1,14 +1,17 @@ -[gd_scene load_steps=8 format=2] +[gd_scene load_steps=10 format=2] [ext_resource path="res://objects/Camera2D.tscn" type="PackedScene" id=1] [ext_resource path="res://maps/map.gd" type="Script" id=2] [ext_resource path="res://graphics/backgrounds/canopy.png" type="Texture" id=3] [ext_resource path="res://tilesets/t_canopy.tres" type="TileSet" id=4] +[ext_resource path="res://objects/enemy/skelarcher.tscn" type="PackedScene" id=5] [ext_resource path="res://objects/player/player.tscn" type="PackedScene" id=6] [ext_resource path="res://objects/hud/hud.tscn" type="PackedScene" id=7] +[ext_resource path="res://scripts/delete_on_game_running.gd" type="Script" id=8] [ext_resource path="res://objects/enemy/jumping_spider.tscn" type="PackedScene" id=10] [node name="Map" type="Node2D" groups=["map"]] +pause_mode = 1 script = ExtResource( 2 ) [node name="Camera2D" parent="." instance=ExtResource( 1 )] @@ -17,19 +20,38 @@ script = ExtResource( 2 ) position = Vector2( 128, 96 ) z_index = -2 texture = ExtResource( 3 ) +__meta__ = { +"_edit_lock_": true +} [node name="Ground" type="TileMap" parent="."] tile_set = ExtResource( 4 ) cell_size = Vector2( 8, 8 ) format = 1 -tile_data = PoolIntArray( 1441792, 0, 0, 1441793, 0, 0, 1441794, 0, 0, 1441795, 0, 0, 1441796, 0, 0, 1441797, 0, 0, 1441798, 0, 0, 1441799, 0, 0, 1441800, 0, 0, 1441801, 0, 0, 1441802, 0, 0, 1441803, 0, 0, 1441804, 0, 0, 1441805, 0, 0, 1441806, 0, 0, 1441807, 0, 0, 1441808, 0, 0, 1441809, 0, 0, 1441810, 0, 0, 1441811, 0, 0, 1441812, 0, 0, 1441813, 0, 0, 1441814, 0, 0, 1441815, 0, 0, 1441816, 0, 0, 1441817, 0, 0, 1441818, 0, 0, 1441819, 0, 0, 1441820, 0, 0, 1441821, 0, 0, 1441822, 0, 0, 1441823, 0, 0, 1507328, 0, 65537, 1507329, 0, 65537, 1507330, 0, 65537, 1507331, 0, 65537, 1507332, 0, 65537, 1507333, 0, 65537, 1507334, 0, 65537, 1507335, 0, 65537, 1507336, 0, 65537, 1507337, 0, 65537, 1507338, 0, 65537, 1507339, 0, 65537, 1507340, 0, 65537, 1507341, 0, 65537, 1507342, 0, 65537, 1507343, 0, 65537, 1507344, 0, 65537, 1507345, 0, 65537, 1507346, 0, 65537, 1507347, 0, 65537, 1507348, 0, 65537, 1507349, 0, 65537, 1507350, 0, 65537, 1507351, 0, 65537, 1507352, 0, 65537, 1507353, 0, 65537, 1507354, 0, 65537, 1507355, 0, 65537, 1507356, 0, 65537, 1507357, 0, 65537, 1507358, 0, 65537, 1507359, 0, 65537 ) +tile_data = PoolIntArray( 1441792, 0, 0, 1441793, 0, 0, 1441794, 0, 0, 1441795, 0, 0, 1441796, 0, 0, 1441797, 0, 0, 1441798, 0, 0, 1441799, 0, 0, 1441800, 0, 0, 1441801, 0, 0, 1441802, 0, 0, 1441803, 0, 0, 1441804, 0, 0, 1441805, 0, 0, 1441806, 0, 0, 1441807, 0, 0, 1441808, 0, 0, 1441809, 0, 0, 1441810, 0, 0, 1441811, 0, 0, 1441812, 0, 0, 1441813, 0, 0, 1441814, 0, 0, 1441815, 0, 0, 1441816, 0, 0, 1441817, 0, 0, 1441818, 0, 0, 1441819, 0, 0, 1441820, 0, 0, 1441821, 0, 0, 1441822, 0, 0, 1441823, 0, 0, 1441824, 0, 0, 1441825, 0, 0, 1441826, 0, 0, 1441827, 0, 0, 1441828, 0, 0, 1441829, 0, 0, 1441830, 0, 0, 1441831, 0, 0, 1441832, 0, 0, 1441833, 0, 0, 1441834, 0, 0, 1441835, 0, 0, 1441836, 0, 0, 1441837, 0, 0, 1441838, 0, 0, 1441839, 0, 0, 1441840, 0, 0, 1441841, 0, 0, 1441842, 0, 0, 1441843, 0, 0, 1441844, 0, 0, 1441845, 0, 0, 1441846, 0, 0, 1441847, 0, 0, 1441848, 0, 0, 1441849, 0, 0, 1441850, 0, 0, 1441851, 0, 0, 1441852, 0, 0, 1441853, 0, 0, 1441854, 0, 0, 1441855, 0, 0, 1507328, 0, 65537, 1507329, 0, 65537, 1507330, 0, 65537, 1507331, 0, 65537, 1507332, 0, 65537, 1507333, 0, 65537, 1507334, 0, 65537, 1507335, 0, 65537, 1507336, 0, 65537, 1507337, 0, 65537, 1507338, 0, 65537, 1507339, 0, 65537, 1507340, 0, 65537, 1507341, 0, 65537, 1507342, 0, 65537, 1507343, 0, 65537, 1507344, 0, 65537, 1507345, 0, 65537, 1507346, 0, 65537, 1507347, 0, 65537, 1507348, 0, 65537, 1507349, 0, 65537, 1507350, 0, 65537, 1507351, 0, 65537, 1507352, 0, 65537, 1507353, 0, 65537, 1507354, 0, 65537, 1507355, 0, 65537, 1507356, 0, 65537, 1507357, 0, 65537, 1507358, 0, 65537, 1507359, 0, 65537, 1507360, 0, 65537, 1507361, 0, 65537, 1507362, 0, 65537, 1507363, 0, 65537, 1507364, 0, 65537, 1507365, 0, 65537, 1507366, 0, 65537, 1507367, 0, 65537, 1507368, 0, 65537, 1507369, 0, 65537, 1507370, 0, 65537, 1507371, 0, 65537, 1507372, 0, 65537, 1507373, 0, 65537, 1507374, 0, 65537, 1507375, 0, 65537, 1507376, 0, 65537, 1507377, 0, 65537, 1507378, 0, 65537, 1507379, 0, 65537, 1507380, 0, 65537, 1507381, 0, 65537, 1507382, 0, 65537, 1507383, 0, 65537, 1507384, 0, 65537, 1507385, 0, 65537, 1507386, 0, 65537, 1507387, 0, 65537, 1507388, 0, 65537, 1507389, 0, 65537, 1507390, 0, 65537, 1507391, 0, 65537 ) [node name="Player" parent="." instance=ExtResource( 6 )] position = Vector2( 24, 166 ) +[node name="Enemies" type="Node2D" parent="."] + +[node name="Skelarcher" parent="Enemies" instance=ExtResource( 5 )] +position = Vector2( 128, 168 ) +scale = Vector2( -1, 1 ) + +[node name="Skelarcher2" parent="Enemies" instance=ExtResource( 5 )] +position = Vector2( 160, 168 ) + [node name="CanvasLayer" parent="." instance=ExtResource( 7 )] [node name="JumpingSpider" parent="." instance=ExtResource( 10 )] position = Vector2( 88, 168 ) left_boundary = 3 right_boundary = 3 + +[node name="ColorRect" type="ColorRect" parent="."] +margin_left = 256.0 +margin_right = 512.0 +margin_bottom = 192.0 +color = Color( 0, 0.392157, 1, 0.113725 ) +script = ExtResource( 8 ) diff --git a/objects/enemy/skelarcher.gd b/objects/enemy/skelarcher.gd index 73f8c4a..6960cd3 100644 --- a/objects/enemy/skelarcher.gd +++ b/objects/enemy/skelarcher.gd @@ -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) diff --git a/objects/enemy/skelarcher.tscn b/objects/enemy/skelarcher.tscn index 39369d4..11192b5 100644 --- a/objects/enemy/skelarcher.tscn +++ b/objects/enemy/skelarcher.tscn @@ -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"]