add antlion

This commit is contained in:
pennyrigate 2023-02-01 14:13:10 -05:00
parent 1a0e9d5937
commit 3d630b51fc
7 changed files with 249 additions and 1 deletions

BIN
graphics/enemy/antlion.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/antlion.png-d369a6b81d52bd231cbe21ebcf4a19a9.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://graphics/enemy/antlion.png"
dest_files=[ "res://.import/antlion.png-d369a6b81d52bd231cbe21ebcf4a19a9.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/antlion_body.png-bcaee6ef06ac133db9c32040e4b38d32.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://graphics/enemy/antlion_body.png"
dest_files=[ "res://.import/antlion_body.png-bcaee6ef06ac133db9c32040e4b38d32.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=1
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

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=15 format=2]
[gd_scene load_steps=16 format=2]
[ext_resource path="res://objects/player/player.tscn" type="PackedScene" id=1]
[ext_resource path="res://tilesets/t_cave.tres" type="TileSet" id=2]
@ -14,6 +14,7 @@
[ext_resource path="res://objects/environment/turniwood/turning_platform.tscn" type="PackedScene" id=12]
[ext_resource path="res://objects/collectibles/arrow.tscn" type="PackedScene" id=13]
[ext_resource path="res://objects/environment/falling_block/falling_block.tscn" type="PackedScene" id=14]
[ext_resource path="res://objects/enemy/antlion.tscn" type="PackedScene" id=15]
[node name="Map" type="Node2D" groups=["map"]]
script = ExtResource( 11 )
@ -100,3 +101,6 @@ delay = 2.0
[node name="FallingBlock" parent="." instance=ExtResource( 14 )]
position = Vector2( 192, 112 )
[node name="Antlion" parent="." instance=ExtResource( 15 )]
position = Vector2( 144, 152 )

11
objects/enemy/antlion.gd Normal file
View file

@ -0,0 +1,11 @@
extends "res://objects/enemy/enemy.gd"
onready var raycast = $Rotation/RayCast2D
onready var anims = $AnimationPlayer
func _on_Sight_area_entered(area):
if area.is_in_group("player"):
anims.play("lunge")
func _on_AnimationPlayer_animation_finished(anim_name):
if anim_name == "lunge": anims.play("spin")

163
objects/enemy/antlion.tscn Normal file
View file

@ -0,0 +1,163 @@
[gd_scene load_steps=10 format=2]
[ext_resource path="res://graphics/enemy/antlion.png" type="Texture" id=1]
[ext_resource path="res://scripts/1px_border.gdshader" type="Shader" id=2]
[ext_resource path="res://objects/enemy/antlion.gd" type="Script" id=3]
[ext_resource path="res://graphics/enemy/antlion_body.png" type="Texture" id=4]
[sub_resource type="Animation" id=7]
resource_name = "lunge"
length = 1.1
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Hitbox:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0.3, 0.7, 1.1 ),
"transitions": PoolRealArray( 1, 1, 1 ),
"update": 0,
"values": [ Vector2( 0, 0 ), Vector2( 0, -72 ), Vector2( 0, 0 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Head:position")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1, 1.05, 1.1 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ Vector2( 0, 0 ), Vector2( 0, -9 ), Vector2( 0, -18 ), Vector2( 0, -27 ), Vector2( 0, -36 ), Vector2( 0, -45 ), Vector2( 0, -54 ), Vector2( 0, -63 ), Vector2( 0, -72 ), Vector2( 0, -63 ), Vector2( 0, -54 ), Vector2( 0, -45 ), Vector2( 0, -36 ), Vector2( 0, -27 ), Vector2( 0, -18 ), Vector2( 0, -9 ), Vector2( 0, 0 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("Head/Body:region_rect")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1, 1.05, 1.1 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ Rect2( 0, 0, 10, 0 ), Rect2( 0, 0, 10, 9 ), Rect2( 0, 0, 10, 18 ), Rect2( 0, 0, 10, 27 ), Rect2( 0, 0, 10, 36 ), Rect2( 0, 0, 10, 45 ), Rect2( 0, 0, 10, 54 ), Rect2( 0, 0, 10, 63 ), Rect2( 0, 0, 10, 72 ), Rect2( 0, 0, 10, 63 ), Rect2( 0, 0, 10, 54 ), Rect2( 0, 0, 10, 45 ), Rect2( 0, 0, 10, 36 ), Rect2( 0, 0, 10, 27 ), Rect2( 0, 0, 10, 18 ), Rect2( 0, 0, 10, 9 ), Rect2( 0, 0, 10, 0 ) ]
}
[sub_resource type="Animation" id=5]
resource_name = "spin"
length = 0.8
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath("Head: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.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ Rect2( 0, 0, 20, 20 ), Rect2( 20, 0, 20, 20 ), Rect2( 0, 0, 20, 20 ), Rect2( 20, 0, 20, 20 ), Rect2( 0, 0, 20, 20 ), Rect2( 20, 0, 20, 20 ), Rect2( 0, 0, 20, 20 ), Rect2( 20, 0, 20, 20 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Head:rotation_degrees")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 0.0, -45.0, 0.0, -45.0, 0.0, -45.0, 0.0, -45.0 ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("Head:offset")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ Vector2( 0, -4 ), Vector2( 3, -4 ), Vector2( 0, -4 ), Vector2( 3, -4 ), Vector2( 0, -4 ), Vector2( 3, -4 ), Vector2( 0, -4 ), Vector2( 3, -4 ) ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("Head/Body:region_rect")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Rect2( 0, 0, 10, 0 ) ]
}
tracks/4/type = "value"
tracks/4/path = NodePath(".:rotation_degrees")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 0.0, 45.0, 90.0, 135.0, 180.0, 225.0, 270.0, 315.0 ]
}
[sub_resource type="RectangleShape2D" id=6]
extents = Vector2( 4, 8 )
[sub_resource type="RectangleShape2D" id=8]
extents = Vector2( 4, 32 )
[sub_resource type="ShaderMaterial" id=1]
shader = ExtResource( 2 )
shader_param/border_color = Color( 0, 0, 0, 1 )
shader_param/border_corners = false
[node name="Antlion" type="Node2D"]
script = ExtResource( 3 )
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
autoplay = "spin"
anims/lunge = SubResource( 7 )
anims/spin = SubResource( 5 )
[node name="Hitbox" type="Area2D" parent="." groups=["enemy_hitbox"]]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
position = Vector2( 0, -4 )
shape = SubResource( 6 )
[node name="Sight" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Sight"]
position = Vector2( 0, -36 )
shape = SubResource( 8 )
[node name="Head" type="Sprite" parent="."]
material = SubResource( 1 )
scale = Vector2( 1, 1 )
texture = ExtResource( 1 )
offset = Vector2( 0, -4 )
region_enabled = true
region_rect = Rect2( 0, 0, 20, 20 )
[node name="Body" type="Sprite" parent="Head"]
visible = false
position = Vector2( -5, 4 )
texture = ExtResource( 4 )
centered = false
region_enabled = true
region_rect = Rect2( 0, 0, 10, 0 )
[connection signal="animation_finished" from="AnimationPlayer" to="." method="_on_AnimationPlayer_animation_finished"]
[connection signal="area_entered" from="Hitbox" to="." method="_on_Hitbox_area_entered"]
[connection signal="area_entered" from="Sight" to="." method="_on_Sight_area_entered"]