Merge branch 'main' of https://gitty.informatik.hs-mannheim.de/3002102/gae_wild_jam
commit
40d3d4c423
|
|
@ -2,9 +2,18 @@
|
|||
|
||||
[ext_resource type="Script" uid="uid://bm4wewhu4hpte" path="res://scripts/blue_slime.gd" id="1_ds7cs"]
|
||||
[ext_resource type="Texture2D" uid="uid://dx1ipffjtn8we" path="res://assets/Slime2/With_shadow/Slime2_Death_with_shadow.png" id="2_7qf5q"]
|
||||
[ext_resource type="Script" uid="uid://cjkaw7wqw4e30" path="res://scripts/drop_table.gd" id="2_ullxd"]
|
||||
[ext_resource type="PackedScene" uid="uid://dm6d2jg52vi41" path="res://scenes/apple.tscn" id="3_vx4o0"]
|
||||
[ext_resource type="Texture2D" uid="uid://bn44pxk3l7j1c" path="res://assets/Slime2/With_shadow/Slime2_Idle_with_shadow.png" id="3_xfb3o"]
|
||||
[ext_resource type="Texture2D" uid="uid://buquy2xkbq7cj" path="res://assets/Slime2/With_shadow/Slime2_Hurt_with_shadow.png" id="4_7qf5q"]
|
||||
[ext_resource type="Texture2D" uid="uid://b33awo7oiotwo" path="res://assets/Slime2/With_shadow/Slime2_Walk_with_shadow.png" id="4_ullxd"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_i8e30"]
|
||||
script = ExtResource("2_ullxd")
|
||||
drop = ExtResource("3_vx4o0")
|
||||
chance = 0.3
|
||||
metadata/_custom_type_script = "uid://cjkaw7wqw4e30"
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_vx4o0"]
|
||||
atlas = ExtResource("2_7qf5q")
|
||||
region = Rect2(0, 0, 64, 64)
|
||||
|
|
@ -189,6 +198,86 @@ region = Rect2(256, 0, 64, 64)
|
|||
atlas = ExtResource("3_xfb3o")
|
||||
region = Rect2(320, 0, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_xfb3o"]
|
||||
atlas = ExtResource("4_7qf5q")
|
||||
region = Rect2(0, 0, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ullxd"]
|
||||
atlas = ExtResource("4_7qf5q")
|
||||
region = Rect2(64, 0, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_324m8"]
|
||||
atlas = ExtResource("4_7qf5q")
|
||||
region = Rect2(128, 0, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_pc1ox"]
|
||||
atlas = ExtResource("4_7qf5q")
|
||||
region = Rect2(192, 0, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_sw8n0"]
|
||||
atlas = ExtResource("4_7qf5q")
|
||||
region = Rect2(256, 0, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_tkfq5"]
|
||||
atlas = ExtResource("4_7qf5q")
|
||||
region = Rect2(0, 128, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_h3n02"]
|
||||
atlas = ExtResource("4_7qf5q")
|
||||
region = Rect2(64, 128, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_k47sx"]
|
||||
atlas = ExtResource("4_7qf5q")
|
||||
region = Rect2(128, 128, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_hmaps"]
|
||||
atlas = ExtResource("4_7qf5q")
|
||||
region = Rect2(192, 128, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_2aiiu"]
|
||||
atlas = ExtResource("4_7qf5q")
|
||||
region = Rect2(256, 128, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_cnyvp"]
|
||||
atlas = ExtResource("4_7qf5q")
|
||||
region = Rect2(0, 192, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_le0b7"]
|
||||
atlas = ExtResource("4_7qf5q")
|
||||
region = Rect2(64, 192, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_e2w81"]
|
||||
atlas = ExtResource("4_7qf5q")
|
||||
region = Rect2(128, 192, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_gsgf5"]
|
||||
atlas = ExtResource("4_7qf5q")
|
||||
region = Rect2(192, 192, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_wuas8"]
|
||||
atlas = ExtResource("4_7qf5q")
|
||||
region = Rect2(256, 192, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ujrwn"]
|
||||
atlas = ExtResource("4_7qf5q")
|
||||
region = Rect2(0, 64, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_r1fh5"]
|
||||
atlas = ExtResource("4_7qf5q")
|
||||
region = Rect2(64, 64, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_3esns"]
|
||||
atlas = ExtResource("4_7qf5q")
|
||||
region = Rect2(128, 64, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_1atid"]
|
||||
atlas = ExtResource("4_7qf5q")
|
||||
region = Rect2(192, 64, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ocs3y"]
|
||||
atlas = ExtResource("4_7qf5q")
|
||||
region = Rect2(256, 64, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_df7iv"]
|
||||
atlas = ExtResource("4_ullxd")
|
||||
region = Rect2(0, 0, 64, 64)
|
||||
|
|
@ -484,6 +573,86 @@ animations = [{
|
|||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_xfb3o")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ullxd")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_324m8")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_pc1ox")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_sw8n0")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"hurt_down",
|
||||
"speed": 10.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_tkfq5")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_h3n02")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_k47sx")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_hmaps")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_2aiiu")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"hurt_left",
|
||||
"speed": 10.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_cnyvp")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_le0b7")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_e2w81")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_gsgf5")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_wuas8")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"hurt_right",
|
||||
"speed": 10.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ujrwn")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_r1fh5")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_3esns")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_1atid")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ocs3y")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"hurt_up",
|
||||
"speed": 10.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_df7iv")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
|
|
@ -607,12 +776,13 @@ radius = 8.062258
|
|||
|
||||
[node name="BlueSlime" type="CharacterBody2D" unique_id=2087784997]
|
||||
script = ExtResource("1_ds7cs")
|
||||
drop_table = Array[ExtResource("2_ullxd")]([SubResource("Resource_i8e30")])
|
||||
metadata/_custom_type_script = "uid://c0uv02nt5ocvg"
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." unique_id=840021107]
|
||||
texture_filter = 1
|
||||
sprite_frames = SubResource("SpriteFrames_324m8")
|
||||
animation = &"walk_right"
|
||||
animation = &"hurt_up"
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=535646718]
|
||||
position = Vector2(0, 1)
|
||||
|
|
|
|||
|
|
@ -1,22 +1,41 @@
|
|||
extends EnemyBase
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
var hits_remaining = 2
|
||||
var is_hurt = false
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.+
|
||||
func _ready() -> void:
|
||||
super()
|
||||
speed = 0.1
|
||||
speed = 0.1
|
||||
animated_sprite_2d.sprite_frames = animated_sprite_2d.sprite_frames.duplicate()
|
||||
$Area2D.body_entered.connect(_on_area_2d_body_entered)
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if is_dying:
|
||||
if is_dying or is_hurt:
|
||||
return
|
||||
_chase_witch()
|
||||
pass
|
||||
|
||||
func die() -> void:
|
||||
hits_remaining -= 1
|
||||
if hits_remaining <= 0:
|
||||
super()
|
||||
else:
|
||||
_play_hurt()
|
||||
|
||||
func _play_hurt() -> void:
|
||||
is_hurt = true
|
||||
var hurt_anim: String
|
||||
if abs(last_direction.x) >= abs(last_direction.y):
|
||||
hurt_anim = "hurt_left" if last_direction.x < 0 else "hurt_right"
|
||||
else:
|
||||
hurt_anim = "hurt_up" if last_direction.y < 0 else "hurt_down"
|
||||
animated_sprite_2d.sprite_frames.set_animation_loop(hurt_anim, false)
|
||||
animated_sprite_2d.play(hurt_anim)
|
||||
await animated_sprite_2d.animation_finished
|
||||
is_hurt = false
|
||||
|
||||
func _on_area_2d_body_entered(body: Node2D) -> void:
|
||||
if is_dying:
|
||||
if is_dying or is_hurt:
|
||||
return
|
||||
if body == player:
|
||||
die()
|
||||
pass # Replace with function body.
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ func _process(delta: float) -> void:
|
|||
pass
|
||||
|
||||
func spawn_enemy() -> void:
|
||||
var enemy_scene = preload("res://scenes/slime.tscn")
|
||||
var enemy_scene = preload("res://scenes/blue_slime.tscn")
|
||||
var enemy = enemy_scene.instantiate()
|
||||
enemy.global_position = get_spawn_position()
|
||||
add_child(enemy)
|
||||
|
|
|
|||
Loading…
Reference in New Issue