diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..77f7414 Binary files /dev/null and b/.DS_Store differ diff --git a/assets/.DS_Store b/assets/.DS_Store new file mode 100644 index 0000000..6b7ac02 Binary files /dev/null and b/assets/.DS_Store differ diff --git a/assets/16x16 Pixelart Food Icons/Pixel_Foods(ARTLİNE).aseprite b/assets/16x16 Pixelart Food Icons/Pixel_Foods(ARTLİNE).aseprite new file mode 100644 index 0000000..17debec Binary files /dev/null and b/assets/16x16 Pixelart Food Icons/Pixel_Foods(ARTLİNE).aseprite differ diff --git a/assets/16x16 Pixelart Food Icons/Pixel_Foods(ARTLİNE).png b/assets/16x16 Pixelart Food Icons/Pixel_Foods(ARTLİNE).png new file mode 100644 index 0000000..792f203 Binary files /dev/null and b/assets/16x16 Pixelart Food Icons/Pixel_Foods(ARTLİNE).png differ diff --git a/assets/16x16 Pixelart Food Icons/Pixel_Foods(ARTLİNE).png.import b/assets/16x16 Pixelart Food Icons/Pixel_Foods(ARTLİNE).png.import new file mode 100644 index 0000000..a6c1fab --- /dev/null +++ b/assets/16x16 Pixelart Food Icons/Pixel_Foods(ARTLİNE).png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://d2pinnrigixnp" +path="res://.godot/imported/Pixel_Foods(ARTLİNE).png-65f9f1ff4f45b0c1e5e6cf5475527854.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/16x16 Pixelart Food Icons/Pixel_Foods(ARTLİNE).png" +dest_files=["res://.godot/imported/Pixel_Foods(ARTLİNE).png-65f9f1ff4f45b0c1e5e6cf5475527854.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/assets/16x16 Pixelart Food Icons/Pixel_Foods.aseprite b/assets/16x16 Pixelart Food Icons/Pixel_Foods.aseprite new file mode 100644 index 0000000..95f3fba Binary files /dev/null and b/assets/16x16 Pixelart Food Icons/Pixel_Foods.aseprite differ diff --git a/assets/16x16 Pixelart Food Icons/Pixel_Foods_01.png b/assets/16x16 Pixelart Food Icons/Pixel_Foods_01.png new file mode 100644 index 0000000..b0e30a2 Binary files /dev/null and b/assets/16x16 Pixelart Food Icons/Pixel_Foods_01.png differ diff --git a/assets/16x16 Pixelart Food Icons/Pixel_Foods_01.png.import b/assets/16x16 Pixelart Food Icons/Pixel_Foods_01.png.import new file mode 100644 index 0000000..db331a2 --- /dev/null +++ b/assets/16x16 Pixelart Food Icons/Pixel_Foods_01.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://biu6imiybx5s1" +path="res://.godot/imported/Pixel_Foods_01.png-1e4c8ccf5ba8e0ceaf9da7b24229890a.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/16x16 Pixelart Food Icons/Pixel_Foods_01.png" +dest_files=["res://.godot/imported/Pixel_Foods_01.png-1e4c8ccf5ba8e0ceaf9da7b24229890a.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/scenes/apple.tscn b/scenes/apple.tscn new file mode 100644 index 0000000..c66bc5e --- /dev/null +++ b/scenes/apple.tscn @@ -0,0 +1,20 @@ +[gd_scene format=3 uid="uid://dm6d2jg52vi41"] + +[ext_resource type="Texture2D" uid="uid://d2pinnrigixnp" path="res://assets/16x16 Pixelart Food Icons/Pixel_Foods(ARTLİNE).png" id="1_h071m"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_7vr8k"] +atlas = ExtResource("1_h071m") +region = Rect2(1, 2, 16, 15) + +[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_3dmh2"] +radius = 9.0 +height = 18.0 + +[node name="Apple" type="Area2D" unique_id=1121088527] + +[node name="Sprite2D" type="Sprite2D" parent="." unique_id=1596918550] +texture_filter = 1 +texture = SubResource("AtlasTexture_7vr8k") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1391308033] +shape = SubResource("CapsuleShape2D_3dmh2") diff --git a/scenes/game.tscn b/scenes/game.tscn index 3831512..433a228 100644 --- a/scenes/game.tscn +++ b/scenes/game.tscn @@ -2381,4 +2381,6 @@ stream = ExtResource("9_0tnpc") autoplay = true bus = &"Music" +[node name="DropManager" type="Node2D" parent="." unique_id=1629996711] + [connection signal="timeout" from="SpawnTimer" to="SpawnControl" method="_on_spawn_timer_timeout"] diff --git a/scenes/slime.tscn b/scenes/slime.tscn index 37b8a89..ea9724f 100644 --- a/scenes/slime.tscn +++ b/scenes/slime.tscn @@ -230,7 +230,7 @@ animations = [{ "duration": 1.0, "texture": SubResource("AtlasTexture_tyl0w") }], -"loop": true, +"loop": false, "name": &"death", "speed": 10.0 }, { @@ -377,15 +377,25 @@ animations = [{ [sub_resource type="CircleShape2D" id="CircleShape2D_siike"] radius = 7.071068 +[sub_resource type="CircleShape2D" id="CircleShape2D_pjw23"] +radius = 8.062258 + [node name="Slime" type="CharacterBody2D" unique_id=1684858295] script = ExtResource("1_1a61f") [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." unique_id=752118449] texture_filter = 1 sprite_frames = SubResource("SpriteFrames_cbi0b") -animation = &"walk_down" -frame_progress = 0.2693989 +animation = &"death" [node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=769710804] position = Vector2(0, 1) shape = SubResource("CircleShape2D_siike") + +[node name="Area2D" type="Area2D" parent="." unique_id=1450702908] + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D" unique_id=951963224] +position = Vector2(0, 1) +shape = SubResource("CircleShape2D_pjw23") + +[connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"] diff --git a/scripts/enemy_base.gd b/scripts/enemy_base.gd new file mode 100644 index 0000000..51cd131 --- /dev/null +++ b/scripts/enemy_base.gd @@ -0,0 +1,44 @@ +class_name EnemyBase +extends CharacterBody2D + +@onready var animated_sprite_2d: AnimatedSprite2D = $AnimatedSprite2D + +var is_dying = false +var speed +var witch +var player + +func _ready() -> void: + witch = get_node("/root/Game/Witch") + player = get_node("/root/Game/Player") + pass # Replace with function body + +func _die(): + is_dying = true + animated_sprite_2d.play("death") + await animated_sprite_2d.animation_finished + queue_free() + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta: float) -> void: + pass + +func _chase_witch() -> void: + var direction = Vector2(witch.global_position - global_position) + velocity = direction * speed + velocity = direction * speed + + if direction == Vector2.ZERO: + animated_sprite_2d.play("idle") + elif abs(direction.x) >= abs(direction.y): + if direction.x < 0: + animated_sprite_2d.play("walk_left") + else: + animated_sprite_2d.play("walk_right") + else: + if direction.y < 0: + animated_sprite_2d.play("walk_up") + else: + animated_sprite_2d.play("walk_down") + move_and_slide() diff --git a/scripts/enemy_base.gd.uid b/scripts/enemy_base.gd.uid new file mode 100644 index 0000000..abfc93f --- /dev/null +++ b/scripts/enemy_base.gd.uid @@ -0,0 +1 @@ +uid://c0uv02nt5ocvg diff --git a/scripts/slime.gd b/scripts/slime.gd index 3ea5902..823da47 100644 --- a/scripts/slime.gd +++ b/scripts/slime.gd @@ -1,35 +1,20 @@ -extends CharacterBody2D +extends EnemyBase -@onready var animated_sprite_2d: AnimatedSprite2D = $AnimatedSprite2D -var speed = 0.04 -var player # Called when the node enters the scene tree for the first time. + +# Called every frame. 'delta' is the elapsed time since the previous frame.+ func _ready() -> void: - player = get_node("/root/Game/Witch") - pass # Replace with function body. + super() + speed = 0.04 - -# Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: + if is_dying: + return _chase_witch() pass -func _chase_witch() -> void: - var direction = Vector2(player.global_position - global_position) - velocity = direction * speed - velocity = direction * speed - - if direction == Vector2.ZERO: - animated_sprite_2d.play("idle") - elif abs(direction.x) >= abs(direction.y): - if direction.x < 0: - animated_sprite_2d.play("walk_left") - else: - animated_sprite_2d.play("walk_right") - else: - if direction.y < 0: - animated_sprite_2d.play("walk_up") - else: - animated_sprite_2d.play("walk_down") - move_and_slide() +func _on_area_2d_body_entered(body: Node2D) -> void: + if body == player: + _die() + pass # Replace with function body.