First Prototype
This commit is contained in:
parent
e18beb6c4c
commit
9e3349eec3
40 changed files with 1100 additions and 48 deletions
|
|
@ -1,25 +1,75 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://sgnp11xty7i1"]
|
||||
[gd_scene load_steps=10 format=3 uid="uid://sgnp11xty7i1"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/game/collectionArea/collection_area.gd" id="1_c4amf"]
|
||||
[ext_resource type="Texture2D" uid="uid://caaj6cyrfglu5" path="res://Assets/CollectionZone.png" id="2_4nokb"]
|
||||
[ext_resource type="Texture2D" uid="uid://c3o6hrpc0fim2" path="res://Assets/Portal.png" id="2_s7bky"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_e58ei"]
|
||||
size = Vector2(136, 136)
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_7mwpw"]
|
||||
radius = 72.0
|
||||
|
||||
[node name="CollectionArea" type="Area2D"]
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_f6w8f"]
|
||||
radius = 12.0
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_7rm1e"]
|
||||
atlas = ExtResource("2_s7bky")
|
||||
region = Rect2(0, 0, 128, 128)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ubxxq"]
|
||||
atlas = ExtResource("2_s7bky")
|
||||
region = Rect2(128, 0, 128, 128)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_dv0w3"]
|
||||
atlas = ExtResource("2_s7bky")
|
||||
region = Rect2(256, 0, 128, 128)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_vxmh6"]
|
||||
atlas = ExtResource("2_s7bky")
|
||||
region = Rect2(384, 0, 128, 128)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_g6wmf"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_7rm1e")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ubxxq")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_dv0w3")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_vxmh6")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[node name="Portal" type="Area2D"]
|
||||
light_mask = 32
|
||||
visibility_layer = 32
|
||||
collision_layer = 32
|
||||
collision_mask = 16
|
||||
collision_mask = 1040
|
||||
script = ExtResource("1_c4amf")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("RectangleShape2D_e58ei")
|
||||
shape = SubResource("CircleShape2D_7mwpw")
|
||||
|
||||
[node name="NavigationObstacle2D" type="NavigationObstacle2D" parent="."]
|
||||
scale = Vector2(0.997855, 1)
|
||||
vertices = PackedVector2Array(-32.0688, -32, 32.0688, -32, 32.0688, 32, -32.0688, 32)
|
||||
avoidance_layers = 32
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
texture = ExtResource("2_4nokb")
|
||||
[node name="CollectArea" type="Area2D" parent="."]
|
||||
collision_layer = 32
|
||||
collision_mask = 1040
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="CollectArea"]
|
||||
shape = SubResource("CircleShape2D_f6w8f")
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
sprite_frames = SubResource("SpriteFrames_g6wmf")
|
||||
frame_progress = 0.634411
|
||||
|
||||
[connection signal="area_entered" from="CollectArea" to="." method="_on_collect_area_area_entered"]
|
||||
[connection signal="body_entered" from="CollectArea" to="." method="_on_collect_area_body_entered"]
|
||||
|
|
|
|||
|
|
@ -1,10 +1,50 @@
|
|||
extends Area2D
|
||||
|
||||
@onready var collectArea = $CollectArea
|
||||
@onready var animatedSprite = $AnimatedSprite2D
|
||||
|
||||
func _ready() -> void:
|
||||
animatedSprite.play("default")
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
cashInObject()
|
||||
for i in get_overlapping_bodies():
|
||||
if i.is_in_group("Player"):
|
||||
if G.isStormThreshold():
|
||||
moveTowardsCenter(i)
|
||||
for i in get_overlapping_areas():
|
||||
if i.is_in_group("Object"):
|
||||
if not i.isCarryied():
|
||||
moveTowardsCenter(i)
|
||||
else:
|
||||
scale = Vector2(1,1)
|
||||
#cashInObject()
|
||||
|
||||
func cashInObject():
|
||||
for i in get_overlapping_areas():
|
||||
for i in collectArea.get_overlapping_areas():
|
||||
if not i.isCarryied():
|
||||
G.addMoney(i.getValue())
|
||||
i.queue_free()
|
||||
|
||||
|
||||
func moveTowardsCenter(object : Node2D):
|
||||
object.global_position.y = move_toward(object.global_position.y, global_position.y, 2)
|
||||
|
||||
object.global_position.x = move_toward(object.global_position.x, global_position.x, 2)
|
||||
|
||||
object.scale.y -= 0.01
|
||||
object.scale.x -= 0.01
|
||||
|
||||
func extractPlayer():
|
||||
G.extractPlayer()
|
||||
|
||||
|
||||
func _on_collect_area_area_entered(area: Area2D) -> void:
|
||||
if area.is_in_group("Object"):
|
||||
cashInObject()
|
||||
|
||||
|
||||
func _on_collect_area_body_entered(body: Node2D) -> void:
|
||||
|
||||
if G.isStormThreshold():
|
||||
if body.is_in_group("Player"):
|
||||
extractPlayer()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue