collisions, enemies, knockback, rolling
This commit is contained in:
10
assets/Enemies/Bat.gd
Normal file
10
assets/Enemies/Bat.gd
Normal file
@ -0,0 +1,10 @@
|
||||
extends KinematicBody2D
|
||||
|
||||
var knockback = Vector2.ZERO
|
||||
|
||||
func _physics_process(delta):
|
||||
knockback = knockback.move_toward(Vector2.ZERO,200*delta)
|
||||
knockback = move_and_slide(knockback)
|
||||
|
||||
func _on_Hurtbox_area_entered(area):
|
||||
knockback = area.knockbackvector * 120
|
68
assets/Enemies/Bat.tscn
Normal file
68
assets/Enemies/Bat.tscn
Normal file
@ -0,0 +1,68 @@
|
||||
[gd_scene load_steps=13 format=2]
|
||||
|
||||
[ext_resource path="res://assets/Shadows/SmallShadow.png" type="Texture" id=1]
|
||||
[ext_resource path="res://assets/Enemies/Bat.png" type="Texture" id=2]
|
||||
[ext_resource path="res://assets/Boxes/Hurtbox.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://assets/Enemies/Bat.gd" type="Script" id=4]
|
||||
|
||||
[sub_resource type="AtlasTexture" id=1]
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 0, 0, 16, 24 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=2]
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 16, 0, 16, 24 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=3]
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 32, 0, 16, 24 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=4]
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 48, 0, 16, 24 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=5]
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 64, 0, 16, 24 )
|
||||
|
||||
[sub_resource type="SpriteFrames" id=6]
|
||||
animations = [ {
|
||||
"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ) ],
|
||||
"loop": true,
|
||||
"name": "default",
|
||||
"speed": 10.0
|
||||
} ]
|
||||
|
||||
[sub_resource type="CircleShape2D" id=7]
|
||||
radius = 3.91596
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id=8]
|
||||
radius = 7.14859
|
||||
height = 4.89034
|
||||
|
||||
[node name="Bat" type="KinematicBody2D"]
|
||||
collision_layer = 16
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
|
||||
position = Vector2( -0.10413, -0.55414 )
|
||||
frames = SubResource( 6 )
|
||||
frame = 3
|
||||
playing = true
|
||||
offset = Vector2( 0, -12 )
|
||||
|
||||
[node name="Shadow" type="Sprite" parent="."]
|
||||
texture = ExtResource( 1 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource( 7 )
|
||||
|
||||
[node name="Hurtbox" parent="." instance=ExtResource( 3 )]
|
||||
collision_layer = 8
|
||||
|
||||
[node name="CollisionShape2D" parent="Hurtbox" index="0"]
|
||||
position = Vector2( 0.10511, -14.9259 )
|
||||
shape = SubResource( 8 )
|
||||
[connection signal="area_entered" from="Hurtbox" to="." method="_on_Hurtbox_area_entered"]
|
||||
|
||||
[editable path="Hurtbox"]
|
Reference in New Issue
Block a user