diff --git a/control.tscn b/control.tscn index 29c5df1..abd6879 100644 --- a/control.tscn +++ b/control.tscn @@ -2,7 +2,7 @@ [ext_resource path="res://scripts/scaling.gd" type="Script" id=1] [ext_resource path="res://graphics/borders/prideborder.png" type="Texture" id=2] -[ext_resource path="res://maps/cave.tscn" type="PackedScene" id=3] +[ext_resource path="res://maps/canopy.tscn" type="PackedScene" id=3] [ext_resource path="res://scripts/crt.gdshader" type="Shader" id=4] [ext_resource path="res://scripts/theme.tres" type="Theme" id=5] diff --git a/graphics/backgrounds/canopy.png b/graphics/backgrounds/canopy.png index 867fda2..01e90dc 100644 Binary files a/graphics/backgrounds/canopy.png and b/graphics/backgrounds/canopy.png differ diff --git a/graphics/enemy/skelarcher_duck.png.import b/graphics/enemy/skelarcher_duck.png.import new file mode 100644 index 0000000..cb1a6fe --- /dev/null +++ b/graphics/enemy/skelarcher_duck.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/skelarcher_duck.png-ea842fa5209405d34f5606825e37ff96.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://graphics/enemy/skelarcher_duck.png" +dest_files=[ "res://.import/skelarcher_duck.png-ea842fa5209405d34f5606825e37ff96.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/graphics/enemy/skelarcher_idle.png b/graphics/enemy/skelarcher_idle.png index bb4c455..d7957ea 100644 Binary files a/graphics/enemy/skelarcher_idle.png and b/graphics/enemy/skelarcher_idle.png differ diff --git a/graphics/enemy/skelarcher_shoot.png b/graphics/enemy/skelarcher_shoot.png index 243c6a3..4426a65 100644 Binary files a/graphics/enemy/skelarcher_shoot.png and b/graphics/enemy/skelarcher_shoot.png differ diff --git a/maps/canopy.tscn b/maps/canopy.tscn index 155278c..96cce73 100644 --- a/maps/canopy.tscn +++ b/maps/canopy.tscn @@ -1,9 +1,11 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=7 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] [node name="Map" type="Node2D" groups=["map"]] script = ExtResource( 2 ) @@ -15,8 +17,14 @@ position = Vector2( 128, 96 ) z_index = -2 texture = ExtResource( 3 ) -[node name="Ground" type="TileMap" parent="Camera2D"] +[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 ) + +[node name="Player" parent="." instance=ExtResource( 6 )] +position = Vector2( 24, 166 ) + +[node name="Skelarcher" parent="." instance=ExtResource( 5 )] +position = Vector2( 70, 166 ) diff --git a/objects/enemy/skelarcher.gd b/objects/enemy/skelarcher.gd new file mode 100644 index 0000000..248f79a --- /dev/null +++ b/objects/enemy/skelarcher.gd @@ -0,0 +1,32 @@ +extends "res://objects/enemy/enemy.gd" + +export var shoot_time = 1.0 +export var arrow_speed = 120.0 + +onready var timer = $Timer +onready var anims = $AnimationPlayer +onready var sprite = $Sprite + +const ArrowProjectile = preload("res://objects/player/arrow_projectile.tscn") +const arrowpos = Vector2(4,4) + +func _ready(): + timer.start(shoot_time) + +func _process(delta): + Debug.print(Game.get_map()) + +func _on_Timer_timeout(): + anims.play("shoot") + +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 + arrow.target_group = "player" + arrow.speed = arrow_speed + Game.get_map().add_child(arrow) + timer.start(shoot_time) diff --git a/objects/enemy/skelarcher.tscn b/objects/enemy/skelarcher.tscn new file mode 100644 index 0000000..65b8981 --- /dev/null +++ b/objects/enemy/skelarcher.tscn @@ -0,0 +1,174 @@ +[gd_scene load_steps=18 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] +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 ) + +[sub_resource type="Animation" id=19] +resource_name = "idle" +tracks/0/type = "value" +tracks/0/path = NodePath("Sprite:region_rect") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 0, +"values": [ Rect2( 0, 0, 19, 20 ) ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("Sprite:texture") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ ExtResource( 2 ) ] +} + +[sub_resource type="Animation" id=20] +resource_name = "shoot" +length = 0.5 +step = 0.06 +tracks/0/type = "value" +tracks/0/path = NodePath("Sprite:region_rect") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 0.06, 0.12, 0.24, 0.3, 0.36, 0.42 ), +"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1 ), +"update": 1, +"values": [ Rect2( 0, 0, 19, 20 ), Rect2( 19, 0, 19, 20 ), Rect2( 38, 0, 19, 20 ), Rect2( 76, 0, 19, 20 ), Rect2( 95, 0, 19, 20 ), Rect2( 114, 0, 19, 20 ), Rect2( 133, 0, 19, 20 ) ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("Sprite:texture") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ ExtResource( 2 ) ] +} +tracks/2/type = "value" +tracks/2/path = NodePath("AnimationPlayer:current_animation") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/keys = { +"times": PoolRealArray( 0.48 ), +"transitions": PoolRealArray( 1 ), +"update": 2, +"values": [ "idle" ] +} +tracks/3/type = "method" +tracks/3/path = NodePath(".") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/keys = { +"times": PoolRealArray( 0.24 ), +"transitions": PoolRealArray( 1 ), +"values": [ { +"args": [ ], +"method": "spawn_arrow" +} ] +} + +[node name="Skelarcher" type="Node2D" groups=["enemy"]] +script = ExtResource( 4 ) +shoot_time = 3.0 + +[node name="Sprite" type="Sprite" parent="."] +material = SubResource( 18 ) +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"]] + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"] +position = Vector2( -1, 6 ) +shape = SubResource( 10 ) + +[node name="Timer" type="Timer" parent="."] + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +anims/idle = SubResource( 19 ) +anims/shoot = SubResource( 20 ) + +[connection signal="area_entered" from="Hitbox" to="." method="_on_Hitbox_area_entered"] +[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]