Compare commits
No commits in common. "3c1dfb3f55e7d618e3801f1ecdb49f0c3b1a5afb" and "e65e98754d49bdf922f53166c1cd82a9e1bd0998" have entirely different histories.
3c1dfb3f55
...
e65e98754d
|
|
@ -1,6 +0,0 @@
|
||||||
extends DropsBase
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
uid://bewhtchahb2sy
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
[gd_scene format=3 uid="uid://dm6d2jg52vi41"]
|
[gd_scene format=3 uid="uid://dm6d2jg52vi41"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://bewhtchahb2sy" path="res://scenes/apple.gd" id="1_7vr8k"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://d2pinnrigixnp" path="res://assets/16x16 Pixelart Food Icons/Pixel_Foods(ARTLİNE).png" id="1_h071m"]
|
[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"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_7vr8k"]
|
||||||
|
|
@ -12,7 +11,6 @@ radius = 9.0
|
||||||
height = 18.0
|
height = 18.0
|
||||||
|
|
||||||
[node name="Apple" type="Area2D" unique_id=1121088527]
|
[node name="Apple" type="Area2D" unique_id=1121088527]
|
||||||
script = ExtResource("1_7vr8k")
|
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=1596918550]
|
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=1596918550]
|
||||||
texture_filter = 1
|
texture_filter = 1
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
[sub_resource type="Resource" id="Resource_gstla"]
|
[sub_resource type="Resource" id="Resource_gstla"]
|
||||||
script = ExtResource("2_2npkn")
|
script = ExtResource("2_2npkn")
|
||||||
drop = ExtResource("3_fd6lc")
|
drop = ExtResource("3_fd6lc")
|
||||||
chance = 1.0
|
chance = 0.3
|
||||||
metadata/_custom_type_script = "uid://cjkaw7wqw4e30"
|
metadata/_custom_type_script = "uid://cjkaw7wqw4e30"
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_v5wyi"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_v5wyi"]
|
||||||
|
|
|
||||||
|
|
@ -1,51 +0,0 @@
|
||||||
extends Area2D
|
|
||||||
class_name DropsBase
|
|
||||||
|
|
||||||
var witch
|
|
||||||
var player
|
|
||||||
var is_spawning = true
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready() -> void:
|
|
||||||
body_entered.connect(_on_body_entered)
|
|
||||||
witch = get_node("/root/Game/Witch")
|
|
||||||
player = get_node("/root/Game/Player")
|
|
||||||
_animate_spawn()
|
|
||||||
pass # Replace with function body.
|
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
func _process(delta: float) -> void:
|
|
||||||
pass
|
|
||||||
|
|
||||||
func _get_random_landing_position() -> Vector2:
|
|
||||||
var offset_x = randf_range(-20,20)
|
|
||||||
var offset_y = randf_range(-20,20)
|
|
||||||
offset_x += global_position.x
|
|
||||||
offset_y += global_position.y
|
|
||||||
return Vector2(offset_x,offset_y)
|
|
||||||
|
|
||||||
func _animate_spawn() -> void:
|
|
||||||
var jump = create_tween()
|
|
||||||
var landing = _get_random_landing_position()
|
|
||||||
jump.tween_property(self, "global_position:x", landing.x, 0.2).set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_QUAD)
|
|
||||||
jump.parallel()
|
|
||||||
jump.tween_property(self, "global_position:y", global_position.y - 20, 0.2).set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_QUAD)
|
|
||||||
jump.tween_property(self, "global_position:y", landing.y, 0.2).set_ease(Tween.EASE_IN).set_trans(Tween.TRANS_QUAD)
|
|
||||||
await jump.finished
|
|
||||||
is_spawning = false
|
|
||||||
|
|
||||||
func _on_body_entered(body: Node2D) -> void:
|
|
||||||
if body == player and not is_spawning:
|
|
||||||
collect()
|
|
||||||
pass
|
|
||||||
|
|
||||||
func collect():
|
|
||||||
var position_drop = create_tween()
|
|
||||||
var target = witch.global_position
|
|
||||||
position_drop.tween_property(self, "global_position:y", global_position.y - 20, 0.2).set_ease(Tween.EASE_IN).set_trans(Tween.TRANS_QUAD)
|
|
||||||
position_drop.tween_property(self, "global_position:y", target.y, 0.5).set_ease(Tween.EASE_IN).set_trans(Tween.TRANS_QUAD)
|
|
||||||
position_drop.parallel()
|
|
||||||
position_drop.tween_property(self, "global_position:x", target.x, 0.5).set_ease(Tween.EASE_IN).set_trans(Tween.TRANS_QUAD)
|
|
||||||
await position_drop.finished
|
|
||||||
var scale_tween = create_tween()
|
|
||||||
scale_tween.tween_property(self, "scale", Vector2.ZERO,0.2)
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
uid://cwp7q24t3nxly
|
|
||||||
|
|
@ -12,7 +12,7 @@ func _process(delta: float) -> void:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
func on_enemy_died(enemy):
|
func on_enemy_died(enemy):
|
||||||
call_deferred("drop_item", enemy)
|
drop_item(enemy)
|
||||||
|
|
||||||
func drop_item(enemy):
|
func drop_item(enemy):
|
||||||
for entry in enemy.drop_table:
|
for entry in enemy.drop_table:
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,8 @@ func _die():
|
||||||
player.stream = death_sound
|
player.stream = death_sound
|
||||||
player.bus = "SFX"
|
player.bus = "SFX"
|
||||||
player.play()
|
player.play()
|
||||||
died.emit(self)
|
|
||||||
await animated_sprite_2d.animation_finished
|
await animated_sprite_2d.animation_finished
|
||||||
|
died.emit(self)
|
||||||
queue_free()
|
queue_free()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue