Added Map; Added Spawners; Changed Decorations; Cleaned up Code and some Settings; Added Enemy
This commit is contained in:
parent
e82438139f
commit
e18beb6c4c
160 changed files with 4674 additions and 182 deletions
55
scenes/game/Door/door.gd
Normal file
55
scenes/game/Door/door.gd
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
extends StaticBody2D
|
||||
|
||||
var isOpen = false
|
||||
|
||||
@onready var collision = $CollisionShape
|
||||
@onready var lightOccluder = $LightOccluder
|
||||
@onready var animatedSprite = $AnimatedSprite
|
||||
@onready var interactIcon = $InteractIcon
|
||||
@onready var interactionRadius = $InteractionRadius
|
||||
|
||||
func _ready() -> void:
|
||||
interactIcon.hide()
|
||||
interactIcon.rotation_degrees -= rotation_degrees
|
||||
collision.disabled = false
|
||||
|
||||
func toggle():
|
||||
if isOpen:
|
||||
close()
|
||||
else:
|
||||
open()
|
||||
|
||||
func open():
|
||||
await get_tree().physics_frame
|
||||
isOpen = true
|
||||
collision.disabled = true
|
||||
lightOccluder.visible = false
|
||||
animatedSprite.play("open")
|
||||
|
||||
func close():
|
||||
await get_tree().physics_frame
|
||||
isOpen = false
|
||||
collision.disabled = false
|
||||
lightOccluder.visible = true
|
||||
animatedSprite.play_backwards("open")
|
||||
|
||||
|
||||
func _on_interaction_radius_area_entered(area: Area2D) -> void:
|
||||
if area.is_in_group("Player"):
|
||||
interactIcon.show()
|
||||
|
||||
|
||||
func _on_interaction_radius_area_exited(area: Area2D) -> void:
|
||||
if area.is_in_group("Player") :
|
||||
interactIcon.hide()
|
||||
|
||||
|
||||
func _on_interaction_radius_body_entered(body: Node2D) -> void:
|
||||
if body.is_in_group("Entity"):
|
||||
if not isOpen:
|
||||
open()
|
||||
|
||||
func _on_interaction_radius_body_exited(body: Node2D) -> void:
|
||||
if body.is_in_group("Entity") and interactionRadius.get_overlapping_bodies() == []:
|
||||
if isOpen:
|
||||
close()
|
||||
159
scenes/game/Door/door.tscn
Normal file
159
scenes/game/Door/door.tscn
Normal file
|
|
@ -0,0 +1,159 @@
|
|||
[gd_scene load_steps=20 format=3 uid="uid://bh72njcvmuhfk"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/game/Door/door.gd" id="1_ti3af"]
|
||||
[ext_resource type="Texture2D" uid="uid://f6e5v3hda1wt" path="res://Assets/Door/Door.png" id="2_pj8k7"]
|
||||
[ext_resource type="Texture2D" uid="uid://f6615qeewbpg" path="res://Assets/Icons/OenDoor.png" id="3_lkqj0"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_7nrw6"]
|
||||
size = Vector2(32, 8)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ec8wo"]
|
||||
size = Vector2(16, 16)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_gcwtp"]
|
||||
size = Vector2(32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_xtm5g"]
|
||||
atlas = ExtResource("2_pj8k7")
|
||||
region = Rect2(0, 0, 58, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_lxext"]
|
||||
atlas = ExtResource("2_pj8k7")
|
||||
region = Rect2(58, 0, 58, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_nmsgj"]
|
||||
atlas = ExtResource("2_pj8k7")
|
||||
region = Rect2(116, 0, 58, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_11ufk"]
|
||||
atlas = ExtResource("2_pj8k7")
|
||||
region = Rect2(174, 0, 58, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_yb8el"]
|
||||
atlas = ExtResource("2_pj8k7")
|
||||
region = Rect2(232, 0, 58, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_h56qt"]
|
||||
atlas = ExtResource("2_pj8k7")
|
||||
region = Rect2(290, 0, 58, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_6newm"]
|
||||
atlas = ExtResource("2_pj8k7")
|
||||
region = Rect2(348, 0, 58, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_1r2eb"]
|
||||
atlas = ExtResource("2_pj8k7")
|
||||
region = Rect2(406, 0, 58, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_afbr5"]
|
||||
atlas = ExtResource("2_pj8k7")
|
||||
region = Rect2(464, 0, 58, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_m6qoc"]
|
||||
atlas = ExtResource("2_pj8k7")
|
||||
region = Rect2(522, 0, 58, 16)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_sitog"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_xtm5g")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_lxext")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_nmsgj")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_11ufk")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_yb8el")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_h56qt")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_6newm")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_1r2eb")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_afbr5")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_m6qoc")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"open",
|
||||
"speed": 25.0
|
||||
}]
|
||||
|
||||
[sub_resource type="OccluderPolygon2D" id="OccluderPolygon2D_sqi44"]
|
||||
polygon = PackedVector2Array(-24, -4, 4, -4, 24, -4, 24, 4, -24, 4)
|
||||
|
||||
[sub_resource type="OccluderPolygon2D" id="OccluderPolygon2D_1pn5v"]
|
||||
polygon = PackedVector2Array(-32, -8, -16, -8, -16, 8, -32, 8)
|
||||
|
||||
[node name="Door" type="StaticBody2D" groups=["Door"]]
|
||||
light_mask = 8
|
||||
visibility_layer = 8
|
||||
collision_layer = 12
|
||||
collision_mask = 512
|
||||
script = ExtResource("1_ti3af")
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("RectangleShape2D_7nrw6")
|
||||
|
||||
[node name="CollisionShape2" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(24, 0)
|
||||
shape = SubResource("RectangleShape2D_ec8wo")
|
||||
|
||||
[node name="CollisionShape3" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(-24, 0)
|
||||
shape = SubResource("RectangleShape2D_ec8wo")
|
||||
|
||||
[node name="InteractionRadius" type="Area2D" parent="." groups=["Door"]]
|
||||
collision_layer = 8
|
||||
collision_mask = 576
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="InteractionRadius"]
|
||||
shape = SubResource("RectangleShape2D_gcwtp")
|
||||
|
||||
[node name="AnimatedSprite" type="AnimatedSprite2D" parent="."]
|
||||
light_mask = 8
|
||||
visibility_layer = 8
|
||||
sprite_frames = SubResource("SpriteFrames_sitog")
|
||||
animation = &"open"
|
||||
|
||||
[node name="LightOccluder" type="LightOccluder2D" parent="."]
|
||||
light_mask = 8
|
||||
visibility_layer = 8
|
||||
occluder = SubResource("OccluderPolygon2D_sqi44")
|
||||
occluder_light_mask = 8
|
||||
|
||||
[node name="LightOccluder2" type="LightOccluder2D" parent="."]
|
||||
light_mask = 8
|
||||
visibility_layer = 8
|
||||
occluder = SubResource("OccluderPolygon2D_1pn5v")
|
||||
occluder_light_mask = 8
|
||||
|
||||
[node name="LightOccluder3" type="LightOccluder2D" parent="."]
|
||||
light_mask = 8
|
||||
visibility_layer = 8
|
||||
position = Vector2(48, 0)
|
||||
occluder = SubResource("OccluderPolygon2D_1pn5v")
|
||||
occluder_light_mask = 8
|
||||
|
||||
[node name="InteractIcon" type="Sprite2D" parent="."]
|
||||
z_index = 5
|
||||
position = Vector2(4.76837e-07, -6.55651e-07)
|
||||
scale = Vector2(0.5, 0.5)
|
||||
texture = ExtResource("3_lkqj0")
|
||||
|
||||
[connection signal="area_entered" from="InteractionRadius" to="." method="_on_interaction_radius_area_entered"]
|
||||
[connection signal="area_exited" from="InteractionRadius" to="." method="_on_interaction_radius_area_exited"]
|
||||
[connection signal="body_entered" from="InteractionRadius" to="." method="_on_interaction_radius_body_entered"]
|
||||
[connection signal="body_exited" from="InteractionRadius" to="." method="_on_interaction_radius_body_exited"]
|
||||
7
scenes/game/Hitbox/damage_area.gd
Normal file
7
scenes/game/Hitbox/damage_area.gd
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
extends Area2D
|
||||
|
||||
signal hit(entity: int)
|
||||
|
||||
func attack(damage):
|
||||
for i in get_overlapping_areas():
|
||||
i.hit(damage)
|
||||
11
scenes/game/Hitbox/damage_area.tscn
Normal file
11
scenes/game/Hitbox/damage_area.tscn
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://cwirujaquehfc"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/game/Hitbox/damage_area.gd" id="1_bd1uk"]
|
||||
|
||||
[node name="DamageArea" type="Area2D"]
|
||||
collision_layer = 128
|
||||
collision_mask = 256
|
||||
script = ExtResource("1_bd1uk")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
debug_color = Color(0.984314, 0, 0, 0.419608)
|
||||
6
scenes/game/Hitbox/hit_box.gd
Normal file
6
scenes/game/Hitbox/hit_box.gd
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
extends Area2D
|
||||
|
||||
signal signalHit(damage)
|
||||
|
||||
func hit(damage):
|
||||
signalHit.emit(damage)
|
||||
11
scenes/game/Hitbox/hit_box.tscn
Normal file
11
scenes/game/Hitbox/hit_box.tscn
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://c2lwkqoigo128"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/game/Hitbox/hit_box.gd" id="1_nu2k7"]
|
||||
|
||||
[node name="HitBox" type="Area2D"]
|
||||
collision_layer = 256
|
||||
collision_mask = 128
|
||||
script = ExtResource("1_nu2k7")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
debug_color = Color(0, 0.0784314, 0.0980392, 0.572549)
|
||||
8
scenes/game/Rooms/room.tscn
Normal file
8
scenes/game/Rooms/room.tscn
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://dilvwpnqg5ybw"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dd11tyc47c3oy" path="res://scenes/game/map/tilemap.tscn" id="1_yg08r"]
|
||||
|
||||
[node name="Room" type="Node2D"]
|
||||
|
||||
[node name="Tilemap" parent="." instance=ExtResource("1_yg08r")]
|
||||
tile_map_data = PackedByteArray()
|
||||
|
|
@ -1,14 +1,25 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://sgnp11xty7i1"]
|
||||
[gd_scene load_steps=4 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"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_1qvdj"]
|
||||
size = Vector2(96, 96)
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_e58ei"]
|
||||
size = Vector2(136, 136)
|
||||
|
||||
[node name="CollectionArea" type="Area2D"]
|
||||
collision_layer = 8
|
||||
collision_mask = 4
|
||||
light_mask = 32
|
||||
visibility_layer = 32
|
||||
collision_layer = 32
|
||||
collision_mask = 16
|
||||
script = ExtResource("1_c4amf")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("RectangleShape2D_1qvdj")
|
||||
shape = SubResource("RectangleShape2D_e58ei")
|
||||
|
||||
[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")
|
||||
|
|
|
|||
98
scenes/game/entities/Enemy/enemy.gd
Normal file
98
scenes/game/entities/Enemy/enemy.gd
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
extends "res://scenes/game/entities/entity.gd"
|
||||
|
||||
@export_range(1,10) var damage = 1
|
||||
@export_range(0.1,1) var attackCooldown = 1
|
||||
|
||||
@onready var navigationAgent = $NavigationAgent
|
||||
@onready var targetRaycast = $Radius/RayCast2D
|
||||
@onready var attackCooldownTimer = $AttackCooldown
|
||||
|
||||
@onready var damageArea = $DamageArea
|
||||
|
||||
@onready var focusedPlayer = null
|
||||
|
||||
func focusPlayer(player):
|
||||
focusedPlayer = player
|
||||
|
||||
func unfocusPlayer():
|
||||
focusedPlayer = null
|
||||
|
||||
func _ready() -> void:
|
||||
navigationAgent.velocity_computed.connect(Callable(_on_navigation_agent_velocity_computed))
|
||||
|
||||
func set_movement_target(movement_target: Vector2):
|
||||
navigationAgent.set_target_position(movement_target)
|
||||
|
||||
func moveTowardsPlayer():
|
||||
if $Radius.get_overlapping_bodies() != [] and not targetRaycast.is_colliding():
|
||||
navigationAgent.target_position = focusedPlayer.global_position
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
if focusedPlayer != null:
|
||||
#targetRaycast.target_position = focusedPlayer.global_position - global_position
|
||||
if $Radius.get_overlapping_bodies() != [] and not targetRaycast.is_colliding():
|
||||
navigationAgent.target_position = focusedPlayer.global_position
|
||||
if focusedPlayer != null:
|
||||
targetRaycast.target_position = focusedPlayer.global_position - global_position
|
||||
else:
|
||||
targetRaycast.target_position = Vector2(global_position.x-1000,global_position.y-1000)
|
||||
#if $Radius.get_overlapping_bodies() != [] and not targetRaycast.is_colliding():
|
||||
# navigationAgent.target_position = focusedPlayer.global_position
|
||||
#if global_position.distance_squared_to(focusedPlayer.global_position) > speed *10:
|
||||
|
||||
#moveTowardsPlayer()
|
||||
var currentAgentPosition = global_position
|
||||
|
||||
|
||||
if NavigationServer2D.map_get_iteration_id(navigationAgent.get_navigation_map()) == 0:
|
||||
return
|
||||
if navigationAgent.is_navigation_finished():
|
||||
return
|
||||
|
||||
var nextPathPosition = navigationAgent.get_next_path_position()
|
||||
var newVelocity = currentAgentPosition.direction_to(nextPathPosition)
|
||||
if navigationAgent.avoidance_enabled:
|
||||
navigationAgent.set_velocity(newVelocity * speed)
|
||||
else:
|
||||
_on_navigation_agent_velocity_computed(newVelocity)
|
||||
|
||||
|
||||
func _on_navigation_agent_velocity_computed(safe_velocity: Vector2) -> void:
|
||||
|
||||
velocity = safe_velocity
|
||||
move_and_slide()
|
||||
|
||||
|
||||
func _on_radius_body_entered(body: Node2D) -> void:
|
||||
if body.is_in_group("Player"):
|
||||
focusPlayer(body)
|
||||
|
||||
|
||||
func _on_radius_body_exited(body: Node2D) -> void:
|
||||
|
||||
if body.is_in_group("Player"):
|
||||
unfocusPlayer()
|
||||
|
||||
func attack():
|
||||
damageArea.attack(damage)
|
||||
|
||||
|
||||
func _on_damage_area_area_entered(area: Area2D) -> void:
|
||||
attackCooldownTimer.start(attackCooldown)
|
||||
|
||||
|
||||
|
||||
func _on_attack_cooldown_timeout() -> void:
|
||||
attack()
|
||||
attackCooldownTimer.start(attackCooldown)
|
||||
|
||||
|
||||
func _on_damage_area_area_exited(area: Area2D) -> void:
|
||||
#attackCooldownTimer.time_left = attackCooldown
|
||||
attackCooldownTimer.stop()
|
||||
|
||||
#func _on_ray_cast_2d_draw() -> void:
|
||||
#if focusedPlayer != null:
|
||||
##targetRaycast.target_position = focusedPlayer.global_position - global_position
|
||||
#if $Radius.get_overlapping_bodies() != [] and not targetRaycast.is_colliding():
|
||||
#navigationAgent.target_position = focusedPlayer.global_position
|
||||
91
scenes/game/entities/Enemy/enemy.tscn
Normal file
91
scenes/game/entities/Enemy/enemy.tscn
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
[gd_scene load_steps=11 format=3 uid="uid://bnxx7nnifjica"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://b18cf4i8v6a1" path="res://scenes/game/entities/entity.tscn" id="1_bf5v6"]
|
||||
[ext_resource type="Script" path="res://scenes/game/entities/Enemy/enemy.gd" id="2_4vapd"]
|
||||
[ext_resource type="Texture2D" uid="uid://dh14dje1066et" path="res://icon.svg" id="3_jenk6"]
|
||||
[ext_resource type="PackedScene" uid="uid://cwirujaquehfc" path="res://scenes/game/Hitbox/damage_area.tscn" id="4_mr72k"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_xq7op"]
|
||||
radius = 8.0
|
||||
|
||||
[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_c882v"]
|
||||
light_mode = 2
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_rdbks"]
|
||||
atlas = ExtResource("3_jenk6")
|
||||
region = Rect2(0, 0, 128, 128)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_i6h2x"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_rdbks")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_w20ih"]
|
||||
radius = 128.0
|
||||
height = 384.0
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_eto3a"]
|
||||
radius = 16.0
|
||||
|
||||
[node name="Enemy" groups=["Enemy"] instance=ExtResource("1_bf5v6")]
|
||||
collision_layer = 2560
|
||||
script = ExtResource("2_4vapd")
|
||||
damage = 1
|
||||
attackCooldown = 1
|
||||
normalSpeed = 80
|
||||
|
||||
[node name="CollisionShape2D" parent="." index="0"]
|
||||
shape = SubResource("CircleShape2D_xq7op")
|
||||
|
||||
[node name="AnimatedSprite2D" parent="." index="1"]
|
||||
material = SubResource("CanvasItemMaterial_c882v")
|
||||
position = Vector2(2.38419e-07, 2.38419e-07)
|
||||
scale = Vector2(0.125, 0.125)
|
||||
sprite_frames = SubResource("SpriteFrames_i6h2x")
|
||||
|
||||
[node name="NavigationAgent" type="NavigationAgent2D" parent="." index="2"]
|
||||
path_postprocessing = 1
|
||||
simplify_path = true
|
||||
avoidance_enabled = true
|
||||
avoidance_layers = 2560
|
||||
avoidance_mask = 3630
|
||||
debug_enabled = true
|
||||
debug_use_custom = true
|
||||
debug_path_custom_color = Color(1, 0, 0, 1)
|
||||
|
||||
[node name="Radius" type="Area2D" parent="." index="3" groups=["Enemy"]]
|
||||
collision_layer = 3687
|
||||
collision_mask = 1024
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Radius" index="0"]
|
||||
rotation = -1.57079
|
||||
shape = SubResource("CapsuleShape2D_w20ih")
|
||||
|
||||
[node name="RayCast2D" type="RayCast2D" parent="Radius" index="1"]
|
||||
target_position = Vector2(-12.48, 16)
|
||||
collision_mask = 14
|
||||
hit_from_inside = true
|
||||
|
||||
[node name="DamageArea" parent="." index="4" instance=ExtResource("4_mr72k")]
|
||||
|
||||
[node name="CollisionShape2D" parent="DamageArea" index="0"]
|
||||
shape = SubResource("CircleShape2D_eto3a")
|
||||
|
||||
[node name="AttackCooldown" type="Timer" parent="." index="5"]
|
||||
one_shot = true
|
||||
|
||||
[connection signal="velocity_computed" from="NavigationAgent" to="." method="_on_navigation_agent_velocity_computed"]
|
||||
[connection signal="body_entered" from="Radius" to="." method="_on_radius_body_entered"]
|
||||
[connection signal="body_exited" from="Radius" to="." method="_on_radius_body_exited"]
|
||||
[connection signal="draw" from="Radius/RayCast2D" to="." method="_on_ray_cast_2d_draw"]
|
||||
[connection signal="area_entered" from="DamageArea" to="." method="_on_damage_area_area_entered"]
|
||||
[connection signal="area_exited" from="DamageArea" to="." method="_on_damage_area_area_exited"]
|
||||
[connection signal="timeout" from="AttackCooldown" to="." method="_on_attack_cooldown_timeout"]
|
||||
|
||||
[editable path="DamageArea"]
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
extends CharacterBody2D
|
||||
|
||||
@onready var animatedSprite = $AnimatedSprite2D
|
||||
|
||||
## Signal for when the entity dies
|
||||
signal death
|
||||
## Signal for when the entity gets damaged
|
||||
|
|
@ -11,11 +13,11 @@ signal healed
|
|||
@export_range(1,100) var maxHealth = 10
|
||||
|
||||
## The maximal possible Speed of the Entity
|
||||
@export_range(100,500) var maxSpeed = 200
|
||||
@export_range(10,500) var maxSpeed = 200
|
||||
## The normal Speed between Min and Max
|
||||
@export_range(100,500) var normalSpeed = 100
|
||||
@export_range(10,500) var normalSpeed = 100
|
||||
## The lowest possible Speed of the Entity
|
||||
@export_range(100,500) var minSpeed = 50
|
||||
@export_range(10,500) var minSpeed = 50
|
||||
|
||||
## Acceleration of the Entity
|
||||
@export_range(100,500) var acceleration = 10
|
||||
|
|
|
|||
|
|
@ -3,11 +3,12 @@
|
|||
[ext_resource type="Script" path="res://scenes/game/entities/entity.gd" id="1_s7hj7"]
|
||||
|
||||
[node name="Entity" type="CharacterBody2D" groups=["Entity"]]
|
||||
light_mask = 4
|
||||
visibility_layer = 4
|
||||
light_mask = 512
|
||||
visibility_layer = 512
|
||||
z_index = 1
|
||||
y_sort_enabled = true
|
||||
collision_layer = 2
|
||||
collision_layer = 512
|
||||
collision_mask = 14
|
||||
script = ExtResource("1_s7hj7")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
|
|
|
|||
26
scenes/game/entities/player/camera.gd
Normal file
26
scenes/game/entities/player/camera.gd
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
extends Camera2D
|
||||
|
||||
@export var INTENSITY = 2.0
|
||||
@export var DURATION = 1000.0
|
||||
@export var STARTTIME = 0
|
||||
|
||||
var currentStrength = 1
|
||||
|
||||
func _ready() -> void:
|
||||
randomize()
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
var decreaser = (DURATION - (Time.get_ticks_msec() - STARTTIME)) / DURATION
|
||||
|
||||
var randX = randf_range(-1,1) * currentStrength * decreaser
|
||||
var randY = randf_range(-1,1) * currentStrength * decreaser
|
||||
offset = Vector2(randX, randY)
|
||||
|
||||
if decreaser < 0:
|
||||
offset = Vector2.ZERO
|
||||
|
||||
func shake(strength : float = 1, duration : float = 1):
|
||||
currentStrength = float(strength)
|
||||
DURATION = float(duration*1000)
|
||||
STARTTIME = Time.get_ticks_msec()
|
||||
|
||||
|
|
@ -3,14 +3,16 @@ extends "res://scenes/game/entities/entity.gd"
|
|||
@onready var rollTimer = $RollTimer
|
||||
@onready var rollCooldownTimer = $RollCooldownTimer
|
||||
|
||||
@onready var animatedSprite = $AnimatedSprite2D
|
||||
|
||||
@onready var pickupArea = $PickupArea
|
||||
@onready var interactionArea = $InteractionArea
|
||||
|
||||
@onready var healthBar = $Camera2D/CanvasLayer/Control/VBoxContainer/HealthBar
|
||||
@onready var rollCooldownBar = $Camera2D/CanvasLayer/Control/VBoxContainer/RollCooldownBar
|
||||
@onready var healthBar = $Camera2D/CanvasLayer/Control/VBoxContainer/HBoxContainer/HealthBar
|
||||
@onready var rollCooldownBar = $Camera2D/CanvasLayer/Control/VBoxContainer/HBoxContainer2/RollCooldownBar
|
||||
@onready var moneyValueLabel = $Camera2D/CanvasLayer/Control/HBoxContainer/MoneyValue
|
||||
@onready var objectValue = $Camera2D/CanvasLayer/Control/ObjectValues/ObjectMoneyValue
|
||||
@onready var objectValues = $Camera2D/CanvasLayer/Control/ObjectValues
|
||||
|
||||
@onready var camera = $Camera2D
|
||||
|
||||
var rollSpeed = maxSpeed * 5
|
||||
|
||||
|
|
@ -33,12 +35,18 @@ func _ready():
|
|||
healthBar.min_value = 0
|
||||
healthBar.max_value = health
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
func setHudValues():
|
||||
rollCooldownBar.value = rollCooldownTimer.time_left
|
||||
healthBar.value = health
|
||||
moneyValueLabel.text = str(G.money)
|
||||
|
||||
if object != null:
|
||||
objectValues.show()
|
||||
objectValue.text = str(object.getValue())
|
||||
else:
|
||||
objectValues.hide()
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
setHudValues()
|
||||
var direction : Vector2 = Input.get_vector("MOVE_LEFT", "MOVE_RIGHT", "MOVE_UP", "MOVE_DOWN").normalized()
|
||||
#var direction : Vector2 = Vector2(
|
||||
#Input.get_action_strength("MOVE_RIGHT") - Input.get_action_strength("MOVE_LEFT"),
|
||||
|
|
@ -51,12 +59,15 @@ func _physics_process(delta: float) -> void:
|
|||
lastdirectionVector = directionVector
|
||||
if Input.is_action_just_pressed("ROLL") and lastDirection != Vector2.ZERO:
|
||||
roll()
|
||||
if Input.is_action_just_pressed("INTERACT"):
|
||||
if Input.is_action_just_pressed("ROLL") and lastDirection != Vector2.ZERO:
|
||||
roll()
|
||||
if Input.is_action_just_pressed("DOOR"):
|
||||
openDoor()
|
||||
if Input.is_action_just_pressed("Pickup"):
|
||||
match carrying:
|
||||
false:
|
||||
|
||||
|
||||
pickup(getNearestObject(pickupArea.get_overlapping_areas()))
|
||||
pickup(getNearestObject(interactionArea.get_overlapping_areas()))
|
||||
true:
|
||||
dropObject()
|
||||
#pickupArea.get_overlapping_areas()[0].pickup(self)
|
||||
|
|
@ -118,7 +129,7 @@ func _on_roll_cooldown_timer_timeout() -> void:
|
|||
canRoll = true
|
||||
|
||||
func pickup(newObject):
|
||||
if newObject != null:
|
||||
if newObject != null and newObject.is_in_group("Object"):
|
||||
if newObject.player == null and not rolling:
|
||||
carrying = true
|
||||
object = newObject
|
||||
|
|
@ -137,10 +148,25 @@ func getNearestObject(list):
|
|||
var shortestDistance = 0
|
||||
if list != []:
|
||||
for i in list:
|
||||
if nearestObject == null:
|
||||
shortestDistance = global_position.distance_to(i.global_position)
|
||||
nearestObject = i
|
||||
elif shortestDistance > global_position.distance_to(i.global_position):
|
||||
shortestDistance = global_position.distance_to(i.global_position)
|
||||
nearestObject = i
|
||||
if i.is_in_group("Object"):
|
||||
if nearestObject == null:
|
||||
shortestDistance = global_position.distance_to(i.global_position)
|
||||
nearestObject = i
|
||||
elif shortestDistance > global_position.distance_to(i.global_position):
|
||||
shortestDistance = global_position.distance_to(i.global_position)
|
||||
nearestObject = i
|
||||
return nearestObject
|
||||
|
||||
|
||||
func openDoor():
|
||||
for door in interactionArea.get_overlapping_areas():
|
||||
if door.is_in_group("Door"):
|
||||
door.get_parent().toggle()
|
||||
|
||||
func _on_hit_box_signal_hit(damage: Variant) -> void:
|
||||
hit(damage)
|
||||
camera.shake(2,0.5)
|
||||
|
||||
|
||||
func _on_death() -> void:
|
||||
print("HOHO")
|
||||
|
|
|
|||
|
|
@ -1,30 +1,45 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://0duodsosmfpq"]
|
||||
[gd_scene load_steps=17 format=3 uid="uid://0duodsosmfpq"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://b18cf4i8v6a1" path="res://scenes/game/entities/entity.tscn" id="1_kmfws"]
|
||||
[ext_resource type="Script" path="res://scenes/game/entities/player/player.gd" id="2_s0pfn"]
|
||||
[ext_resource type="SpriteFrames" uid="uid://dv18sf3aj0n1h" path="res://scenes/game/entities/player/player.tres" id="3_mlsai"]
|
||||
[ext_resource type="Texture2D" uid="uid://drjv0kpcfubr0" path="res://Assets/Icons/Dollar.png" id="4_6t857"]
|
||||
[ext_resource type="Theme" uid="uid://brft526ygjv2u" path="res://Theme/Hud.tres" id="4_pkh7x"]
|
||||
[ext_resource type="Script" path="res://scenes/game/entities/player/camera.gd" id="4_pm6vd"]
|
||||
[ext_resource type="Texture2D" uid="uid://doeb4tgupsuhn" path="res://Assets/LightRadius.png" id="4_rgjff"]
|
||||
[ext_resource type="PackedScene" uid="uid://c2lwkqoigo128" path="res://scenes/game/Hitbox/hit_box.tscn" id="5_al0qa"]
|
||||
[ext_resource type="Texture2D" uid="uid://b27g8eulkxvyr" path="res://Assets/Icons/Health.png" id="6_4smqb"]
|
||||
[ext_resource type="StyleBox" uid="uid://cicm0nqh0g7fd" path="res://Theme/RollBar.tres" id="7_0w6mh"]
|
||||
[ext_resource type="StyleBox" uid="uid://31r7sc1edews" path="res://Theme/Empty.tres" id="7_luccy"]
|
||||
[ext_resource type="StyleBox" uid="uid://6x7dblrcglcl" path="res://Theme/HealthBar.tres" id="8_kgbvc"]
|
||||
[ext_resource type="Texture2D" uid="uid://c2o4115sewunm" path="res://Assets/Icons/Roll.png" id="10_1rhoe"]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_ihc0q"]
|
||||
radius = 4.0
|
||||
height = 16.0
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_7ukjs"]
|
||||
radius = 8.94427
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_8u3aq"]
|
||||
radius = 8.94427
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_bjveg"]
|
||||
radius = 8.94427
|
||||
|
||||
[node name="Player" groups=["Player"] instance=ExtResource("1_kmfws")]
|
||||
light_mask = 1536
|
||||
visibility_layer = 1536
|
||||
collision_layer = 1536
|
||||
script = ExtResource("2_s0pfn")
|
||||
|
||||
[node name="CollisionShape2D" parent="." index="0"]
|
||||
position = Vector2(0, 8)
|
||||
position = Vector2(0, 4)
|
||||
rotation = 1.57079
|
||||
shape = SubResource("CapsuleShape2D_ihc0q")
|
||||
shape = SubResource("CircleShape2D_7ukjs")
|
||||
|
||||
[node name="AnimatedSprite2D" parent="." index="1"]
|
||||
visibility_layer = 4
|
||||
light_mask = 1024
|
||||
visibility_layer = 1024
|
||||
scale = Vector2(1.5, 1.5)
|
||||
sprite_frames = ExtResource("3_mlsai")
|
||||
animation = &"IDLE"
|
||||
frame_progress = 0.904526
|
||||
animation = &"DOWN"
|
||||
metadata/_aseprite_wizard_config_ = {
|
||||
"layer": "",
|
||||
"o_ex_p": "",
|
||||
|
|
@ -43,6 +58,8 @@ metadata/_aseprite_wizard_interface_config_ = {
|
|||
zoom = Vector2(4, 4)
|
||||
limit_smoothed = true
|
||||
position_smoothing_enabled = true
|
||||
drag_horizontal_enabled = true
|
||||
script = ExtResource("4_pm6vd")
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="Camera2D" index="0"]
|
||||
|
||||
|
|
@ -55,54 +72,134 @@ grow_horizontal = 2
|
|||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
theme = ExtResource("4_pkh7x")
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Camera2D/CanvasLayer/Control" index="0"]
|
||||
layout_mode = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
|
||||
[node name="MoneyLabel" type="Label" parent="Camera2D/CanvasLayer/Control/HBoxContainer" index="0"]
|
||||
[node name="TextureRect" type="TextureRect" parent="Camera2D/CanvasLayer/Control/HBoxContainer" index="0"]
|
||||
layout_mode = 2
|
||||
texture = ExtResource("4_6t857")
|
||||
|
||||
[node name="MoneyLabel" type="Label" parent="Camera2D/CanvasLayer/Control/HBoxContainer" index="1"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
text = "MONEY"
|
||||
|
||||
[node name="MoneyValue" type="Label" parent="Camera2D/CanvasLayer/Control/HBoxContainer" index="1"]
|
||||
[node name="MoneyValue" type="Label" parent="Camera2D/CanvasLayer/Control/HBoxContainer" index="2"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Camera2D/CanvasLayer/Control" index="1"]
|
||||
modulate = Color(1, 1, 1, 0.901961)
|
||||
layout_mode = 1
|
||||
anchors_preset = 2
|
||||
anchor_top = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 16.0
|
||||
offset_top = -63.9999
|
||||
offset_right = 312.0
|
||||
offset_bottom = -29.0
|
||||
offset_top = -120.0
|
||||
offset_right = 517.0
|
||||
offset_bottom = -49.0
|
||||
grow_vertical = 0
|
||||
scale = Vector2(1.5, 1.5)
|
||||
size_flags_horizontal = 3
|
||||
alignment = 1
|
||||
|
||||
[node name="RollCooldownBar" type="ProgressBar" parent="Camera2D/CanvasLayer/Control/VBoxContainer" index="0"]
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="Camera2D/CanvasLayer/Control/VBoxContainer" index="0"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="Camera2D/CanvasLayer/Control/VBoxContainer/HBoxContainer2" index="0"]
|
||||
layout_mode = 2
|
||||
texture = ExtResource("10_1rhoe")
|
||||
expand_mode = 2
|
||||
|
||||
[node name="RollCooldownBar" type="ProgressBar" parent="Camera2D/CanvasLayer/Control/VBoxContainer/HBoxContainer2" index="1"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
theme_override_font_sizes/font_size = 16
|
||||
theme_override_styles/background = ExtResource("7_0w6mh")
|
||||
theme_override_styles/fill = ExtResource("7_luccy")
|
||||
fill_mode = 1
|
||||
show_percentage = false
|
||||
|
||||
[node name="HealthBar" type="ProgressBar" parent="Camera2D/CanvasLayer/Control/VBoxContainer" index="1"]
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Camera2D/CanvasLayer/Control/VBoxContainer" index="1"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="Camera2D/CanvasLayer/Control/VBoxContainer/HBoxContainer" index="0"]
|
||||
layout_mode = 2
|
||||
texture = ExtResource("6_4smqb")
|
||||
expand_mode = 2
|
||||
|
||||
[node name="HealthBar" type="ProgressBar" parent="Camera2D/CanvasLayer/Control/VBoxContainer/HBoxContainer" index="1"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_font_sizes/font_size = 16
|
||||
theme_override_styles/background = ExtResource("7_luccy")
|
||||
theme_override_styles/fill = ExtResource("8_kgbvc")
|
||||
rounded = true
|
||||
|
||||
[node name="ObjectValues" type="HBoxContainer" parent="Camera2D/CanvasLayer/Control" index="2"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 3
|
||||
anchor_left = 1.0
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -288.0
|
||||
offset_top = -112.0
|
||||
offset_right = -22.0
|
||||
offset_bottom = -12.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 0
|
||||
alignment = 2
|
||||
|
||||
[node name="MoneyLabel" type="Label" parent="Camera2D/CanvasLayer/Control/ObjectValues" index="0"]
|
||||
layout_mode = 2
|
||||
text = "+"
|
||||
|
||||
[node name="ObjectMoneyValue" type="Label" parent="Camera2D/CanvasLayer/Control/ObjectValues" index="1"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="Camera2D/CanvasLayer/Control/ObjectValues" index="2"]
|
||||
layout_mode = 2
|
||||
texture = ExtResource("4_6t857")
|
||||
|
||||
[node name="RollTimer" type="Timer" parent="." index="3"]
|
||||
one_shot = true
|
||||
|
||||
[node name="RollCooldownTimer" type="Timer" parent="." index="4"]
|
||||
one_shot = true
|
||||
|
||||
[node name="PickupArea" type="Area2D" parent="." index="5" groups=["Player"]]
|
||||
collision_layer = 8
|
||||
collision_mask = 4
|
||||
[node name="InteractionArea" type="Area2D" parent="." index="5" groups=["Player"]]
|
||||
collision_layer = 64
|
||||
collision_mask = 24
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="PickupArea" index="0"]
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="InteractionArea" index="0"]
|
||||
position = Vector2(0, 4)
|
||||
shape = SubResource("CircleShape2D_8u3aq")
|
||||
|
||||
[node name="PointLight2D" type="PointLight2D" parent="." index="6"]
|
||||
position = Vector2(0, 4)
|
||||
color = Color(0.74978, 0.74978, 0.74978, 1)
|
||||
energy = 0.5
|
||||
range_item_cull_mask = 3647
|
||||
shadow_enabled = true
|
||||
shadow_item_cull_mask = 10
|
||||
texture = ExtResource("4_rgjff")
|
||||
texture_scale = 2.0
|
||||
|
||||
[node name="HitBox" parent="." index="7" instance=ExtResource("5_al0qa")]
|
||||
|
||||
[node name="CollisionShape2D" parent="HitBox" index="0"]
|
||||
position = Vector2(0, 4)
|
||||
shape = SubResource("CircleShape2D_bjveg")
|
||||
|
||||
[connection signal="death" from="." to="." method="_on_death"]
|
||||
[connection signal="timeout" from="RollTimer" to="." method="_on_roll_timeout"]
|
||||
[connection signal="timeout" from="RollCooldownTimer" to="." method="_on_roll_cooldown_timer_timeout"]
|
||||
[connection signal="signalHit" from="HitBox" to="." method="_on_hit_box_signal_hit"]
|
||||
|
||||
[editable path="HitBox"]
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ extends Node2D
|
|||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
$Map.spawnObjects()
|
||||
$Map.spawnEnemies()
|
||||
stormTimer.start(randi_range(G.GAMETIME.MIN, G.GAMETIME.MAX))
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
|
|
|
|||
|
|
@ -1,32 +1,18 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://dgxw2n4ei2ahe"]
|
||||
[gd_scene load_steps=4 format=3 uid="uid://dgxw2n4ei2ahe"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/game/mainGame/main_game.gd" id="1_napbe"]
|
||||
[ext_resource type="PackedScene" uid="uid://0duodsosmfpq" path="res://scenes/game/entities/player/player.tscn" id="3_sjgkj"]
|
||||
[ext_resource type="PackedScene" uid="uid://br7eqr6jomsg4" path="res://scenes/game/map/map.tscn" id="3_vpriv"]
|
||||
[ext_resource type="PackedScene" uid="uid://41ksceqosqq2" path="res://scenes/game/objects/Vase/vase.tscn" id="4_mot7l"]
|
||||
[ext_resource type="PackedScene" uid="uid://sgnp11xty7i1" path="res://scenes/game/collectionArea/collectionArea.tscn" id="5_8c8da"]
|
||||
|
||||
[node name="mainGame" type="Node2D"]
|
||||
script = ExtResource("1_napbe")
|
||||
|
||||
[node name="Map" parent="." instance=ExtResource("3_vpriv")]
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource("3_sjgkj")]
|
||||
light_mask = 1
|
||||
visibility_layer = 1
|
||||
z_index = 0
|
||||
y_sort_enabled = false
|
||||
position = Vector2(-24, 0)
|
||||
|
||||
[node name="Vase" parent="." instance=ExtResource("4_mot7l")]
|
||||
position = Vector2(32, 24)
|
||||
|
||||
[node name="Vase2" parent="." instance=ExtResource("4_mot7l")]
|
||||
position = Vector2(-8, 24)
|
||||
[node name="Map" parent="." instance=ExtResource("3_vpriv")]
|
||||
|
||||
[node name="StormTimer" type="Timer" parent="."]
|
||||
one_shot = true
|
||||
|
||||
[node name="CollectionArea" parent="." instance=ExtResource("5_8c8da")]
|
||||
position = Vector2(-272, -16)
|
||||
|
||||
[connection signal="timeout" from="StormTimer" to="." method="_on_storm_timer_timeout"]
|
||||
|
|
|
|||
25
scenes/game/map/map.gd
Normal file
25
scenes/game/map/map.gd
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
extends Node2D
|
||||
|
||||
|
||||
@onready var enemySpawners = $Spawner/Enemy
|
||||
@onready var objectSpawners = $Spawner/Object
|
||||
|
||||
func _ready() -> void:
|
||||
var enemySpawnersArray = enemySpawners.get_children()
|
||||
for i in enemySpawners.get_children():
|
||||
i.enabled = false
|
||||
enemySpawnersArray.shuffle()
|
||||
|
||||
enemySpawnersArray[0].enabled = true
|
||||
enemySpawnersArray[1].enabled = true
|
||||
#for i in enemySpawnersArray:
|
||||
#i.enabled = true
|
||||
|
||||
|
||||
func spawnEnemies():
|
||||
for spawner in enemySpawners.get_children():
|
||||
spawner.spawn($Enemys)
|
||||
|
||||
func spawnObjects():
|
||||
for spawner in objectSpawners.get_children():
|
||||
spawner.spawn($Objects)
|
||||
File diff suppressed because one or more lines are too long
8
scenes/game/map/tilemap.tscn
Normal file
8
scenes/game/map/tilemap.tscn
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -2,12 +2,28 @@ extends Area2D
|
|||
|
||||
@export_range(10,1000) var value = 10
|
||||
@export_range(1,70) var weight = 1
|
||||
@onready var interactIcon = $InteractIcon
|
||||
|
||||
const heavy = 50
|
||||
|
||||
var player = null
|
||||
|
||||
func _ready() -> void:
|
||||
interactIcon.hide()
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
for i in get_overlapping_areas():
|
||||
if i.is_in_group("Player"):
|
||||
if isCarryied():
|
||||
interactIcon.hide()
|
||||
elif not isCarryied():
|
||||
interactIcon.show()
|
||||
|
||||
#if isCarryied():
|
||||
#interactIcon.hide()
|
||||
#elif not isCarryied():
|
||||
#interactIcon.show()
|
||||
|
||||
if player != null:
|
||||
global_position.y = move_toward(global_position.y, player.global_position.y, 3)
|
||||
global_position.x = move_toward(global_position.x, player.global_position.x, 3)
|
||||
|
|
@ -29,3 +45,14 @@ func getValue():
|
|||
|
||||
func isCarryied():
|
||||
return player != null
|
||||
|
||||
|
||||
#func _on_area_entered(area: Area2D) -> void:
|
||||
#if area.is_in_group("Player"):
|
||||
#interactIcon.show()
|
||||
#
|
||||
#
|
||||
#
|
||||
func _on_area_exited(area: Area2D) -> void:
|
||||
if area.is_in_group("Player"):
|
||||
interactIcon.hide()
|
||||
|
|
|
|||
|
|
@ -1,12 +1,35 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://dxpd1pq7v6ing"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://dxpd1pq7v6ing"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/game/objects/object.gd" id="1_3y27f"]
|
||||
[ext_resource type="Texture2D" uid="uid://c4h5dodgulduy" path="res://Assets/Icons/Pickup.png" id="2_pqvu2"]
|
||||
|
||||
[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_n7gny"]
|
||||
light_mode = 2
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_vvfu1"]
|
||||
radius = 8.0
|
||||
|
||||
[node name="Object" type="Area2D" groups=["Object"]]
|
||||
collision_layer = 4
|
||||
collision_mask = 8
|
||||
light_mask = 16
|
||||
visibility_layer = 16
|
||||
material = SubResource("CanvasItemMaterial_n7gny")
|
||||
collision_layer = 16
|
||||
collision_mask = 96
|
||||
script = ExtResource("1_3y27f")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0, -4)
|
||||
shape = SubResource("CircleShape2D_vvfu1")
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
use_parent_material = true
|
||||
position = Vector2(0, -4)
|
||||
|
||||
[node name="InteractIcon" type="Sprite2D" parent="."]
|
||||
z_index = 5
|
||||
position = Vector2(5.68434e-14, -16)
|
||||
scale = Vector2(0.625, 0.625)
|
||||
texture = ExtResource("2_pqvu2")
|
||||
|
||||
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
||||
[connection signal="area_exited" from="." to="." method="_on_area_exited"]
|
||||
|
|
|
|||
17
scenes/game/objects/objects/computer.tscn
Normal file
17
scenes/game/objects/objects/computer.tscn
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://b6drcvlucpvxi"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dxpd1pq7v6ing" path="res://scenes/game/objects/object.tscn" id="1_ahjmy"]
|
||||
[ext_resource type="Texture2D" uid="uid://d0bdyo2e6axq2" path="res://Assets/Objects/Computer.png" id="2_3c460"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_fkh3i"]
|
||||
radius = 8.0
|
||||
|
||||
[node name="Computer" instance=ExtResource("1_ahjmy")]
|
||||
value = 100
|
||||
weight = 40
|
||||
|
||||
[node name="CollisionShape2D" parent="." index="0"]
|
||||
shape = SubResource("CircleShape2D_fkh3i")
|
||||
|
||||
[node name="Sprite2D" parent="." index="1"]
|
||||
texture = ExtResource("2_3c460")
|
||||
10
scenes/game/objects/objects/controller.tscn
Normal file
10
scenes/game/objects/objects/controller.tscn
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://dvpc4jiifu08u"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dxpd1pq7v6ing" path="res://scenes/game/objects/object.tscn" id="1_2gi3p"]
|
||||
[ext_resource type="Texture2D" uid="uid://4qj6kf6qfwhv" path="res://Assets/Objects/Controller.png" id="2_agabt"]
|
||||
|
||||
[node name="Controller" instance=ExtResource("1_2gi3p")]
|
||||
|
||||
[node name="Sprite2D" parent="." index="1"]
|
||||
position = Vector2(0, -4)
|
||||
texture = ExtResource("2_agabt")
|
||||
10
scenes/game/objects/objects/food_tin_can.tscn
Normal file
10
scenes/game/objects/objects/food_tin_can.tscn
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://c2p2latnc2jof"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dxpd1pq7v6ing" path="res://scenes/game/objects/object.tscn" id="1_5c6qq"]
|
||||
[ext_resource type="Texture2D" uid="uid://br853cx0laqjr" path="res://Assets/Objects/FoodTinCan.png" id="2_ywu5t"]
|
||||
|
||||
[node name="FoodTinCan" instance=ExtResource("1_5c6qq")]
|
||||
|
||||
[node name="Sprite2D" parent="." index="1"]
|
||||
position = Vector2(0, -4)
|
||||
texture = ExtResource("2_ywu5t")
|
||||
12
scenes/game/objects/objects/game_console.tscn
Normal file
12
scenes/game/objects/objects/game_console.tscn
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://di0048xukocpa"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dxpd1pq7v6ing" path="res://scenes/game/objects/object.tscn" id="1_uy3sa"]
|
||||
[ext_resource type="Texture2D" uid="uid://4dcme0lv0gs3" path="res://Assets/Objects/GameConsole.png" id="2_8xb0y"]
|
||||
|
||||
[node name="GameConsole" instance=ExtResource("1_uy3sa")]
|
||||
value = 60
|
||||
weight = 30
|
||||
|
||||
[node name="Sprite2D" parent="." index="1"]
|
||||
position = Vector2(0, -4)
|
||||
texture = ExtResource("2_8xb0y")
|
||||
18
scenes/game/objects/objects/gold_bar.tscn
Normal file
18
scenes/game/objects/objects/gold_bar.tscn
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://cox2h4fjawq0t"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dxpd1pq7v6ing" path="res://scenes/game/objects/object.tscn" id="1_iouty"]
|
||||
[ext_resource type="Texture2D" uid="uid://b5no68c7akp00" path="res://Assets/Objects/GoldBar.png" id="2_q4tnr"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_772ct"]
|
||||
radius = 8.0
|
||||
|
||||
[node name="GoldBar" instance=ExtResource("1_iouty")]
|
||||
value = 800
|
||||
weight = 50
|
||||
|
||||
[node name="CollisionShape2D" parent="." index="0"]
|
||||
shape = SubResource("CircleShape2D_772ct")
|
||||
|
||||
[node name="Sprite2D" parent="." index="1"]
|
||||
position = Vector2(0, -8)
|
||||
texture = ExtResource("2_q4tnr")
|
||||
10
scenes/game/objects/objects/hammer.tscn
Normal file
10
scenes/game/objects/objects/hammer.tscn
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://b7aqeqc4i4aw4"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dxpd1pq7v6ing" path="res://scenes/game/objects/object.tscn" id="1_x0fak"]
|
||||
[ext_resource type="Texture2D" uid="uid://brbshxkillo2g" path="res://Assets/Objects/Hammer.png" id="2_1akxm"]
|
||||
|
||||
[node name="Hammer" instance=ExtResource("1_x0fak")]
|
||||
|
||||
[node name="Sprite2D" parent="." index="1"]
|
||||
position = Vector2(0, -4)
|
||||
texture = ExtResource("2_1akxm")
|
||||
12
scenes/game/objects/objects/helmet.tscn
Normal file
12
scenes/game/objects/objects/helmet.tscn
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://5sajq051qfa7"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dxpd1pq7v6ing" path="res://scenes/game/objects/object.tscn" id="1_ft6b2"]
|
||||
[ext_resource type="Texture2D" uid="uid://dycry3xe2kkuv" path="res://Assets/Objects/helmet.png" id="2_afdlx"]
|
||||
|
||||
[node name="Helmet" instance=ExtResource("1_ft6b2")]
|
||||
value = 55
|
||||
weight = 10
|
||||
|
||||
[node name="Sprite2D" parent="." index="1"]
|
||||
position = Vector2(0, -4)
|
||||
texture = ExtResource("2_afdlx")
|
||||
18
scenes/game/objects/objects/monitor.tscn
Normal file
18
scenes/game/objects/objects/monitor.tscn
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://b2o3rtatwhfgn"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dxpd1pq7v6ing" path="res://scenes/game/objects/object.tscn" id="1_8hfxh"]
|
||||
[ext_resource type="Texture2D" uid="uid://deid7map2xc4g" path="res://Assets/Objects/Monitor.png" id="2_7s1fc"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_rhwnp"]
|
||||
radius = 8.0
|
||||
|
||||
[node name="Monitor" instance=ExtResource("1_8hfxh")]
|
||||
value = 50
|
||||
weight = 10
|
||||
|
||||
[node name="CollisionShape2D" parent="." index="0"]
|
||||
shape = SubResource("CircleShape2D_rhwnp")
|
||||
|
||||
[node name="Sprite2D" parent="." index="1"]
|
||||
position = Vector2(0, -4)
|
||||
texture = ExtResource("2_7s1fc")
|
||||
5
scenes/game/objects/objects/mystery_box.tscn
Normal file
5
scenes/game/objects/objects/mystery_box.tscn
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://bhpgpfub6mqe3"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dxpd1pq7v6ing" path="res://scenes/game/objects/object.tscn" id="1_0a370"]
|
||||
|
||||
[node name="MysteryBox" instance=ExtResource("1_0a370")]
|
||||
10
scenes/game/objects/objects/mystery_briefcase.tscn
Normal file
10
scenes/game/objects/objects/mystery_briefcase.tscn
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://cchj2ofoy1po1"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dxpd1pq7v6ing" path="res://scenes/game/objects/object.tscn" id="1_h8wmp"]
|
||||
[ext_resource type="Texture2D" uid="uid://ddaedsbebomx5" path="res://Assets/Objects/MysteryBriefcase.png" id="2_2j5i0"]
|
||||
|
||||
[node name="MysteryBriefcase" instance=ExtResource("1_h8wmp")]
|
||||
|
||||
[node name="Sprite2D" parent="." index="1"]
|
||||
position = Vector2(0, -4)
|
||||
texture = ExtResource("2_2j5i0")
|
||||
10
scenes/game/objects/objects/mystery_liquid.tscn
Normal file
10
scenes/game/objects/objects/mystery_liquid.tscn
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://cabge4sd2hqci"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dxpd1pq7v6ing" path="res://scenes/game/objects/object.tscn" id="1_nnm1b"]
|
||||
[ext_resource type="Texture2D" uid="uid://cyjlwsdf51v8b" path="res://Assets/Objects/MyteryLiquid.png" id="2_nkcej"]
|
||||
|
||||
[node name="MysteryLiquid" instance=ExtResource("1_nnm1b")]
|
||||
|
||||
[node name="Sprite2D" parent="." index="1"]
|
||||
position = Vector2(0, -4)
|
||||
texture = ExtResource("2_nkcej")
|
||||
5
scenes/game/objects/objects/mystery_remote.tscn
Normal file
5
scenes/game/objects/objects/mystery_remote.tscn
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://lmstim1w7qt5"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dxpd1pq7v6ing" path="res://scenes/game/objects/object.tscn" id="1_hg782"]
|
||||
|
||||
[node name="MysteryRemote" instance=ExtResource("1_hg782")]
|
||||
10
scenes/game/objects/objects/screwdriver.tscn
Normal file
10
scenes/game/objects/objects/screwdriver.tscn
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://cqg6c8o7mrxdq"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dxpd1pq7v6ing" path="res://scenes/game/objects/object.tscn" id="1_uny6r"]
|
||||
[ext_resource type="Texture2D" uid="uid://dq8lm6a4tyoss" path="res://Assets/Objects/Screwdriver.png" id="2_14dxu"]
|
||||
|
||||
[node name="Screwdriver" instance=ExtResource("1_uny6r")]
|
||||
|
||||
[node name="Sprite2D" parent="." index="1"]
|
||||
position = Vector2(0, -4)
|
||||
texture = ExtResource("2_14dxu")
|
||||
10
scenes/game/objects/objects/soda_can.tscn
Normal file
10
scenes/game/objects/objects/soda_can.tscn
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://dtkbn42sua6bd"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dxpd1pq7v6ing" path="res://scenes/game/objects/object.tscn" id="1_prdq3"]
|
||||
[ext_resource type="Texture2D" uid="uid://cxpy70verc74h" path="res://Assets/Objects/SodaCan.png" id="2_1yknj"]
|
||||
|
||||
[node name="SodaCan" instance=ExtResource("1_prdq3")]
|
||||
|
||||
[node name="Sprite2D" parent="." index="1"]
|
||||
position = Vector2(0, -4)
|
||||
texture = ExtResource("2_1yknj")
|
||||
10
scenes/game/objects/objects/speaker.tscn
Normal file
10
scenes/game/objects/objects/speaker.tscn
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://bg0d4g8srx3ql"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dxpd1pq7v6ing" path="res://scenes/game/objects/object.tscn" id="1_jlw2l"]
|
||||
[ext_resource type="Texture2D" uid="uid://bmlb8b00cro1f" path="res://Assets/Objects/Speaker.png" id="2_t3xrn"]
|
||||
|
||||
[node name="Speaker" instance=ExtResource("1_jlw2l")]
|
||||
|
||||
[node name="Sprite2D" parent="." index="1"]
|
||||
position = Vector2(0, -4)
|
||||
texture = ExtResource("2_t3xrn")
|
||||
10
scenes/game/objects/objects/teddy_bear.tscn
Normal file
10
scenes/game/objects/objects/teddy_bear.tscn
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://2kdpile8qbj8"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dxpd1pq7v6ing" path="res://scenes/game/objects/object.tscn" id="1_g3qoc"]
|
||||
[ext_resource type="Texture2D" uid="uid://bwl8v34qo8pif" path="res://Assets/Objects/TeddyBear.png" id="2_xa3pj"]
|
||||
|
||||
[node name="TeddyBear" instance=ExtResource("1_g3qoc")]
|
||||
|
||||
[node name="Sprite2D" parent="." index="1"]
|
||||
position = Vector2(0, -4)
|
||||
texture = ExtResource("2_xa3pj")
|
||||
10
scenes/game/objects/objects/telephone.tscn
Normal file
10
scenes/game/objects/objects/telephone.tscn
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://0sivf5pahvkp"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dxpd1pq7v6ing" path="res://scenes/game/objects/object.tscn" id="1_wpn0g"]
|
||||
[ext_resource type="Texture2D" uid="uid://cug6xc65ak64a" path="res://Assets/Objects/Telephone.png" id="2_1w0uo"]
|
||||
|
||||
[node name="Telephone" instance=ExtResource("1_wpn0g")]
|
||||
|
||||
[node name="Sprite2D" parent="." index="1"]
|
||||
position = Vector2(0, -4)
|
||||
texture = ExtResource("2_1w0uo")
|
||||
10
scenes/game/objects/objects/toolbox.tscn
Normal file
10
scenes/game/objects/objects/toolbox.tscn
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://dep5yy0j8u34g"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dxpd1pq7v6ing" path="res://scenes/game/objects/object.tscn" id="1_fk7ja"]
|
||||
[ext_resource type="Texture2D" uid="uid://bo803pp8gtg5y" path="res://Assets/Objects/Toolbox.png" id="2_co5u1"]
|
||||
|
||||
[node name="Toolbox" instance=ExtResource("1_fk7ja")]
|
||||
|
||||
[node name="Sprite2D" parent="." index="1"]
|
||||
position = Vector2(0, -4)
|
||||
texture = ExtResource("2_co5u1")
|
||||
|
|
@ -1,17 +1,17 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://41ksceqosqq2"]
|
||||
[gd_scene load_steps=4 format=3 uid="uid://41ksceqosqq2"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dxpd1pq7v6ing" path="res://scenes/game/objects/object.tscn" id="1_fkdlr"]
|
||||
[ext_resource type="Texture2D" uid="uid://cj70dguhwi83a" path="res://Assets/Objects/Vase.png" id="2_vxdei"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_pmiic"]
|
||||
radius = 12.0
|
||||
radius = 8.0
|
||||
|
||||
[node name="Vase" instance=ExtResource("1_fkdlr")]
|
||||
light_mask = 8
|
||||
visibility_layer = 8
|
||||
y_sort_enabled = true
|
||||
|
||||
[node name="CollisionShape2D" parent="." index="0"]
|
||||
shape = SubResource("CircleShape2D_pmiic")
|
||||
|
||||
[node name="AnimatedSprite2D" parent="." index="1"]
|
||||
animation = &""
|
||||
[node name="Sprite2D" parent="." index="1"]
|
||||
position = Vector2(0, -4)
|
||||
texture = ExtResource("2_vxdei")
|
||||
Loading…
Add table
Add a link
Reference in a new issue