From 9827e2d9b45c60590a3796d207ae2af647c656a5 Mon Sep 17 00:00:00 2001 From: pennyrigate Date: Fri, 20 Jan 2023 04:46:24 -0500 Subject: [PATCH] add skelarcher --- control.tscn | 2 +- graphics/backgrounds/canopy.png | Bin 3483 -> 1812 bytes graphics/enemy/skelarcher_duck.png.import | 35 +++++ graphics/enemy/skelarcher_idle.png | Bin 265 -> 266 bytes graphics/enemy/skelarcher_shoot.png | Bin 675 -> 462 bytes maps/canopy.tscn | 12 +- objects/enemy/skelarcher.gd | 32 ++++ objects/enemy/skelarcher.tscn | 174 ++++++++++++++++++++++ 8 files changed, 252 insertions(+), 3 deletions(-) create mode 100644 graphics/enemy/skelarcher_duck.png.import create mode 100644 objects/enemy/skelarcher.gd create mode 100644 objects/enemy/skelarcher.tscn 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 867fda2ebd6159b63694ac1d65e27b7043ef0ebc..01e90dce6aaf1d65906bddf5d666e61ca3e34251 100644 GIT binary patch delta 1405 zcmV-@1%mpU8<{E8A(JzRCwC$*lV_%AP@lH*lqxE0~g2wDr5yo z_rIp126+uQC?>hL%#WU)>jXZAhmT8(7A;z|XwjlYixw?fv}n0!WfS@#8At|#c={+~-8u8xkg`=7_yoetaLEI+Es9ei(3nU_W;K<^n(gcGqBg^f3Vb4LPxY1IX5D2cU!Q zFda0|3re|X_@qaL0dO5`P)dzJl0FX##}C$joZ1h&m;sdY6`&*jX;-!oq3(6tD_|H0 z55S%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nZ!2%?XG*0*L~U7YY>!0{{R3lh-BVks)M%!2kdb!2!6DYwZ940Afi*K~yMHjm--V zfFKM5(DC2>Pi!4!Q;EisVE2G1y2nl8bhZRStoyxWM&%xH%PTgym2z%2T@A~o_qTQt zYYsHvZX&g^-po5cpg)!~jK2tz+8&0-t+9Su?|lsRWf9c_fw&2k1*O-Z00000NkvWt IM6N<$f@&N;?f?J) diff --git a/graphics/enemy/skelarcher_shoot.png b/graphics/enemy/skelarcher_shoot.png index 243c6a3f5c81945546665a1bcf705447398c5b34..4426a6538c257547ab46d0f90eb832e8584bf144 100644 GIT binary patch literal 462 zcmeAS@N?(olHy`uVBq!ia0vp^Gk{oxgBeJ=<*{r4QjEnx?oJHr&dIz4a#+$GeH|GX zHuiJ>Nn{1`)dPG&TrKzKeKmIa|NlQwU}A(zf0*_D{rfE@g(O&-i`y!f+K5`HfNV&J zyKe%dcuRu(f`N+RfWh{KQX5c$v%n*=n1O-s5C}7hYIrpOEf@E6aSZYBK0CRWtJ#33 zCHc;qEBpR`*4uf^^sit_^Ht$3KRt@uL%Ync{%sDFF4XW^?Ky!X`*KFgdCoN%GCgnR zwML~ZJ$0f!@K6nhXi9>_FP7QqdlxpjDa-rlgBJ$Ae2)lxL~+8Pyw35SZ#w)wFCx}!~0KPDX5kjyxtVVTB0bC_Ht*c zW|!%s0@j!39!)TDU9*4VveWrz@^#jPZm?Um`P;-C9Uak7pz)^?X3u%DOYHx(^(UljA6bJDCL*1B>P$V`a7BY394iSp0@(l>3Q^f~JqDp1q15^x1G|303x*@_xNU+1k#oN%$<*)Gb_ds39d_Wk^9Kl|_yL16S6R#}a(SJ)cwo?^Uvinud^H*C+$$4&F8 z%3@}YT78pU8%0&GyCorh`El>%F%F^$o;TKJw%Oi$1px4UUu3BhH}9BOY5-NnsM=DF zH*6=%;?5}fZ88>^zq0{=>b2zDm9_HnT9M)h(PZXZVcP&pFF-oJ?LGMGAWf~WTX%l7 zPo1zZ48;XerA0)vHh5Cm-5j<0Kx?+h{#9glAAE9_d{ht-r3Yf-JMy=q4l?!!RMhf@ zZFs|WQt@fav>>XqbU{R9IzZIDzE;ajt*F(9u3O8>E3+u5UIW!@0D#+%?iwYNXG!MJ zc~<&jE|UcSKSp0lS&guljJwKODmSSm8fd1WBBS!Fv{ZpDo28=2%tL1top}%u>53~W zFY%Z{?Z9MvXW40Gu6)tFl|14<{+t2;Cf_d#CFiXF!*X#=;}Y>jah@o`{P+L>002ov JPDHLkV1gwZMF9W+ 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"]