added enemy area, final build for jam
This commit is contained in:
parent
f51c6aed7c
commit
b9a6bef961
41
export_presets.cfg
Normal file
41
export_presets.cfg
Normal file
|
@ -0,0 +1,41 @@
|
|||
[preset.0]
|
||||
|
||||
name="Web"
|
||||
platform="Web"
|
||||
runnable=true
|
||||
advanced_options=false
|
||||
dedicated_server=false
|
||||
custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
export_path="../courierexport/index.html"
|
||||
encryption_include_filters=""
|
||||
encryption_exclude_filters=""
|
||||
encrypt_pck=false
|
||||
encrypt_directory=false
|
||||
script_export_mode=2
|
||||
|
||||
[preset.0.options]
|
||||
|
||||
custom_template/debug=""
|
||||
custom_template/release=""
|
||||
variant/extensions_support=false
|
||||
variant/thread_support=false
|
||||
vram_texture_compression/for_desktop=true
|
||||
vram_texture_compression/for_mobile=false
|
||||
html/export_icon=true
|
||||
html/custom_html_shell=""
|
||||
html/head_include=""
|
||||
html/canvas_resize_policy=2
|
||||
html/focus_canvas_on_start=true
|
||||
html/experimental_virtual_keyboard=false
|
||||
progressive_web_app/enabled=false
|
||||
progressive_web_app/ensure_cross_origin_isolation_headers=true
|
||||
progressive_web_app/offline_page=""
|
||||
progressive_web_app/display=1
|
||||
progressive_web_app/orientation=0
|
||||
progressive_web_app/icon_144x144=""
|
||||
progressive_web_app/icon_180x180=""
|
||||
progressive_web_app/icon_512x512=""
|
||||
progressive_web_app/background_color=Color(0, 0, 0, 1)
|
|
@ -1,11 +1,15 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://d2w5qydbu4alc"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://d2w5qydbu4alc"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/enemy.gd" id="1_1svwr"]
|
||||
[ext_resource type="Texture2D" uid="uid://cqjv6gj3aanf5" path="res://sprites/antred.png" id="2_75flp"]
|
||||
[ext_resource type="Texture2D" uid="uid://bne2wm00djjjq" path="res://sprites/antred.png" id="2_75flp"]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_w4m25"]
|
||||
radius = 30.0
|
||||
height = 278.0
|
||||
radius = 59.0
|
||||
height = 325.333
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_nfokl"]
|
||||
radius = 39.0
|
||||
height = 272.0
|
||||
|
||||
[node name="enemy" type="CharacterBody2D" node_paths=PackedStringArray("nav", "patrolpoints")]
|
||||
script = ExtResource("1_1svwr")
|
||||
|
@ -13,7 +17,7 @@ nav = NodePath("NavigationAgent2D")
|
|||
patrolpoints = [null]
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
scale = Vector2(0.3, 0.3)
|
||||
scale = Vector2(0.06, 0.06)
|
||||
texture = ExtResource("2_75flp")
|
||||
|
||||
[node name="colltion" type="Area2D" parent="."]
|
||||
|
@ -31,9 +35,20 @@ collision_layer = 2
|
|||
collision_mask = 2
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="dictection"]
|
||||
polygon = PackedVector2Array(9, 2, 2883, -934, 2919, 1070)
|
||||
polygon = PackedVector2Array(-526, 174, -526, -196, 2883, -934, 2919, 1070)
|
||||
|
||||
[node name="NavigationAgent2D" type="NavigationAgent2D" parent="."]
|
||||
|
||||
[node name="CollisionShape2D2" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(-10.2, 3.3)
|
||||
rotation = 1.5708
|
||||
scale = Vector2(0.3, 0.3)
|
||||
shape = SubResource("CapsuleShape2D_nfokl")
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
wait_time = 5.0
|
||||
one_shot = true
|
||||
|
||||
[connection signal="body_entered" from="colltion" to="." method="_on_colltion_body_entered"]
|
||||
[connection signal="body_entered" from="dictection" to="." method="_on_dictection_body_entered"]
|
||||
[connection signal="body_exited" from="dictection" to="." method="_on_dictection_body_exited"]
|
||||
|
|
|
@ -8,25 +8,70 @@
|
|||
script = ExtResource("1_42w6u")
|
||||
ItemCounter = ExtResource("3_3e23f")
|
||||
|
||||
[node name="List" type="VBoxContainer" parent="."]
|
||||
[node name="Panel" type="PanelContainer" parent="."]
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
|
||||
[node name="MoneyCounter" type="Label" parent="List"]
|
||||
[node name="List" type="VBoxContainer" parent="Panel"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="MoneyCounter" type="Label" parent="Panel/List"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("2_54lln")
|
||||
text = "$100"
|
||||
|
||||
[node name="CurrentAddress" type="Label" parent="List"]
|
||||
[node name="CurrentAddress" type="Label" parent="Panel/List"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("2_54lln")
|
||||
text = "No Contract"
|
||||
|
||||
[node name="Items" type="GridContainer" parent="."]
|
||||
anchors_preset = 1
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
offset_left = -102.0
|
||||
offset_bottom = 40.0
|
||||
grow_horizontal = 0
|
||||
[node name="TimeLeft" type="Label" parent="Panel/List"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Items" type="GridContainer" parent="Panel"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
wait_time = 600.0
|
||||
one_shot = true
|
||||
autostart = true
|
||||
|
||||
[node name="EndGame" type="PanelContainer" parent="."]
|
||||
visible = false
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -331.0
|
||||
offset_top = -68.5
|
||||
offset_right = 331.0
|
||||
offset_bottom = 68.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Label" type="Label" parent="EndGame"]
|
||||
layout_mode = 2
|
||||
text = "Congratulations!
|
||||
You Finished The Game With"
|
||||
|
||||
[node name="StartGame" type="PanelContainer" parent="."]
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -331.0
|
||||
offset_top = -68.5
|
||||
offset_right = 331.0
|
||||
offset_bottom = 68.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Label" type="Label" parent="StartGame"]
|
||||
layout_mode = 2
|
||||
text = "Move with Arrow Keys, Space to Interact
|
||||
Press Space to Continue"
|
||||
|
||||
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]
|
||||
|
|
|
@ -13,6 +13,8 @@ radius = 22.0
|
|||
|
||||
[node name="Player" type="CharacterBody2D" groups=["player"]]
|
||||
z_index = 1
|
||||
collision_layer = 3
|
||||
collision_mask = 3
|
||||
motion_mode = 1
|
||||
script = ExtResource("1_a7huw")
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
|||
extends CharacterBody2D;
|
||||
|
||||
@export var speed = 300
|
||||
@export var speed = 600
|
||||
var ac = 7;
|
||||
var SpriteTurningSpeed = 5
|
||||
@export var FrictionMult = 0
|
||||
|
@ -10,15 +10,20 @@ var patrolpoint_cur = 0;
|
|||
var player = null;
|
||||
@onready var Player = get_tree().get_first_node_in_group("player")
|
||||
@export var patrolpoints: Array[Node2D];
|
||||
|
||||
@onready var timer = $Timer
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
|
||||
var direction = Vector2(0,0)
|
||||
|
||||
if (player_chase):
|
||||
nav.target_position = player.position;
|
||||
nav.target_position = player.global_position;
|
||||
else:
|
||||
if(patrolpoints[patrolpoint_cur] != null):
|
||||
nav.target_position = patrolpoints[patrolpoint_cur].position;
|
||||
nav.target_position = patrolpoints[patrolpoint_cur].global_position;
|
||||
else:
|
||||
print("wot")
|
||||
nav.target_position = Vector2(0,0)
|
||||
|
||||
direction = nav.get_next_path_position() - global_position;
|
||||
|
@ -26,8 +31,10 @@ func _physics_process(delta: float) -> void:
|
|||
velocity = velocity.lerp(direction * speed, ac * delta)
|
||||
if velocity.length() > 0.1:
|
||||
rotation = rotate_toward(rotation,velocity.angle(),delta*SpriteTurningSpeed)
|
||||
|
||||
#print("PlayerChase: " + str(player_chase))
|
||||
if(patrolpoints[patrolpoint_cur] != null):
|
||||
if(position.distance_to(patrolpoints[patrolpoint_cur].position) < 10):
|
||||
if(position.distance_to(patrolpoints[patrolpoint_cur].global_position) < 10):
|
||||
print(patrolpoint_cur)
|
||||
patrolpoint_cur += 1
|
||||
if(patrolpoint_cur == patrolpoints.size()):
|
||||
|
@ -37,10 +44,18 @@ func _physics_process(delta: float) -> void:
|
|||
|
||||
move_and_slide();
|
||||
func _on_dictection_body_entered(body: Node2D) -> void:
|
||||
if(body.is_in_group("player")):
|
||||
timer.start(5)
|
||||
player = body;
|
||||
player_chase = true;
|
||||
|
||||
|
||||
func _on_dictection_body_exited(body: Node2D) -> void:
|
||||
if(body.is_in_group("player")) && timer.is_stopped():
|
||||
player = null;
|
||||
player_chase = false;
|
||||
|
||||
|
||||
func _on_colltion_body_entered(body: Node2D) -> void:
|
||||
if(body.is_in_group("player")):
|
||||
body.kill()
|
||||
|
|
|
@ -2,16 +2,25 @@ extends CanvasLayer
|
|||
|
||||
@export var Player : Node2D
|
||||
|
||||
@onready var MoneyCounter = $List/MoneyCounter
|
||||
@onready var MoneyCounter = $Panel/List/MoneyCounter
|
||||
|
||||
@onready var CurrentAddress = $List/CurrentAddress
|
||||
@onready var CurrentAddress = $Panel/List/CurrentAddress
|
||||
|
||||
@onready var TimeLeft = $Panel/List/TimeLeft
|
||||
|
||||
@onready var MatchTimer = $Timer
|
||||
|
||||
@onready var ItemTextures = {"Shoes" : preload("res://sprites/runningshoes.png"), "Drill" : preload("res://sprites/drill.png")}
|
||||
|
||||
@onready var ItemGrid = $Items
|
||||
@onready var ItemGrid = $Panel/Items
|
||||
|
||||
@export var ItemCounter : PackedScene
|
||||
|
||||
@onready var EndGame = $EndGame
|
||||
@onready var EndGameLabel = $EndGame/Label
|
||||
|
||||
@onready var StartGame = $StartGame
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
@ -19,8 +28,19 @@ func _ready() -> void:
|
|||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
if Input.is_action_just_pressed("interact"):
|
||||
if(StartGame.visible == true):
|
||||
Player.Frozen = false
|
||||
StartGame.hide()
|
||||
|
||||
|
||||
MoneyCounter.text = "$" + str(Player.Money)
|
||||
|
||||
if roundi(MatchTimer.time_left)%60 < 10:
|
||||
TimeLeft.text = str(roundi(MatchTimer.time_left)/60) + ":0" + str(roundi(MatchTimer.time_left)%60)
|
||||
else:
|
||||
TimeLeft.text = str(roundi(MatchTimer.time_left)/60) + ":" + str(roundi(MatchTimer.time_left)%60)
|
||||
|
||||
if Player.ActiveContract:
|
||||
CurrentAddress.text = Player.ActiveContract.get_address()
|
||||
else:
|
||||
|
@ -46,3 +66,10 @@ func remove_item(name: String, number : int = 1):
|
|||
if item.Count <= 0:
|
||||
item.queue_free()
|
||||
|
||||
|
||||
|
||||
func _on_timer_timeout() -> void:
|
||||
Player.Frozen = true
|
||||
EndGame.show()
|
||||
EndGameLabel.text += " $" + str(Player.Money)
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ var ActiveContract : Node2D
|
|||
|
||||
@export var Money : int = 0
|
||||
|
||||
var Frozen = false
|
||||
var Frozen = true
|
||||
|
||||
@onready var PackageSprite = $PackageSprite
|
||||
|
||||
|
@ -58,5 +58,8 @@ func _physics_process(delta: float) -> void:
|
|||
|
||||
func _on_hitbox_body_entered(body: Node2D) -> void:
|
||||
if body.is_in_group("hurt"):
|
||||
Money -= 500
|
||||
kill()
|
||||
|
||||
func kill():
|
||||
Money -= 2000
|
||||
position = Vector2(0,0)
|
||||
|
|
Loading…
Reference in a new issue