Added basic movement, and dialoge

This commit is contained in:
root 2024-10-05 00:18:11 -07:00
parent 66606e2160
commit 57fbbbf0cf
19 changed files with 451 additions and 0 deletions

4
etc/default_theme.tres Normal file
View file

@ -0,0 +1,4 @@
[gd_resource type="Theme" format=3 uid="uid://d0ir0t347wqv7"]
[resource]
default_font_size = 48

View file

@ -11,9 +11,46 @@ config_version=5
[application]
config/name="Courier"
run/main_scene="res://scenes/world.tscn"
config/features=PackedStringArray("4.3", "GL Compatibility")
config/icon="res://icon.svg"
[display]
window/stretch/mode="canvas_items"
window/stretch/aspect="expand"
[global_group]
player=""
[input]
up={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
left={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
down={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
right={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
[rendering]
renderer/rendering_method="gl_compatibility"

45
scenes/contract.tscn Normal file
View file

@ -0,0 +1,45 @@
[gd_scene load_steps=5 format=3 uid="uid://cn41xqc3lwaxy"]
[ext_resource type="Texture2D" uid="uid://bnqe06njx2agc" path="res://sprites/contract.png" id="1_jwp1o"]
[ext_resource type="Theme" uid="uid://d0ir0t347wqv7" path="res://etc/default_theme.tres" id="1_m2twt"]
[ext_resource type="PackedScene" uid="uid://dpwqurhly8osd" path="res://scenes/interactible_manager.tscn" id="3_khqae"]
[sub_resource type="CircleShape2D" id="CircleShape2D_mxuxo"]
radius = 217.993
[node name="Contract" type="Area2D"]
[node name="LabelPanel" type="Panel" parent="."]
z_index = 10
offset_left = -313.0
offset_top = -342.0
offset_right = 369.0
offset_bottom = -242.0
theme = ExtResource("1_m2twt")
[node name="Label" type="Label" parent="LabelPanel"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("1_m2twt")
text = "20th Burnaby Lane - $300"
horizontal_alignment = 1
vertical_alignment = 1
clip_text = true
uppercase = true
metadata/_edit_lock_ = true
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1_jwp1o")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_mxuxo")
[node name="InteractibleManager" parent="." node_paths=PackedStringArray("ItemShown") instance=ExtResource("3_khqae")]
ItemShown = NodePath("../LabelPanel")
[connection signal="body_entered" from="." to="InteractibleManager" method="_on_body_entered"]
[connection signal="body_exited" from="." to="InteractibleManager" method="_on_body_exited"]

View file

@ -0,0 +1,68 @@
[gd_scene load_steps=7 format=3 uid="uid://cpxco37ip15ev"]
[ext_resource type="Texture2D" uid="uid://ci3yxj63e5u8f" path="res://sprites/contractgiver.png" id="1_awtl7"]
[ext_resource type="PackedScene" uid="uid://cn41xqc3lwaxy" path="res://scenes/contract.tscn" id="2_kh0dp"]
[ext_resource type="Theme" uid="uid://d0ir0t347wqv7" path="res://etc/default_theme.tres" id="2_v5tdy"]
[ext_resource type="PackedScene" uid="uid://dpwqurhly8osd" path="res://scenes/interactible_manager.tscn" id="4_1m1bm"]
[sub_resource type="CircleShape2D" id="CircleShape2D_put5l"]
radius = 389.155
[sub_resource type="RectangleShape2D" id="RectangleShape2D_sdg4f"]
size = Vector2(409, 181)
[node name="ContractGiver" type="Area2D"]
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1_awtl7")
metadata/_edit_lock_ = true
[node name="LabelPanel" type="Panel" parent="."]
z_index = 10
offset_left = -313.0
offset_top = -342.0
offset_right = 369.0
offset_bottom = -242.0
theme = ExtResource("2_v5tdy")
[node name="Label" type="Label" parent="LabelPanel"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("2_v5tdy")
text = "HeLLO DEAR EMPLOYEE"
horizontal_alignment = 1
vertical_alignment = 1
clip_text = true
uppercase = true
metadata/_edit_lock_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(8, 150)
shape = SubResource("CircleShape2D_put5l")
[node name="Wall" type="StaticBody2D" parent="."]
position = Vector2(-4, 149)
[node name="CollisionShape2D" type="CollisionShape2D" parent="Wall"]
position = Vector2(7.5, 15.5)
shape = SubResource("RectangleShape2D_sdg4f")
metadata/_edit_lock_ = true
[node name="Contract" parent="." instance=ExtResource("2_kh0dp")]
position = Vector2(-498, 747)
[node name="Contract2" parent="." instance=ExtResource("2_kh0dp")]
position = Vector2(113, 753)
[node name="Contract3" parent="." instance=ExtResource("2_kh0dp")]
position = Vector2(710, 753)
[node name="InteractibleManager" parent="." node_paths=PackedStringArray("ItemShown") instance=ExtResource("4_1m1bm")]
ItemShown = NodePath("../LabelPanel")
[connection signal="body_entered" from="." to="InteractibleManager" method="_on_body_entered"]
[connection signal="body_exited" from="." to="InteractibleManager" method="_on_body_exited"]

View file

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://dpwqurhly8osd"]
[ext_resource type="Script" path="res://scripts/interactable.gd" id="1_dp1qs"]
[node name="InteractibleManager" type="Node"]
script = ExtResource("1_dp1qs")

24
scenes/player.tscn Normal file
View file

@ -0,0 +1,24 @@
[gd_scene load_steps=4 format=3 uid="uid://bjy3gfpx6h1w5"]
[ext_resource type="Script" path="res://scripts/player.gd" id="1_a7huw"]
[ext_resource type="Texture2D" uid="uid://dnxdkwa1krlv" path="res://sprites/ant.png" id="2_5v6iy"]
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_f3qr4"]
radius = 25.0
height = 100.0
[node name="Player" type="CharacterBody2D" node_paths=PackedStringArray("Sprite") groups=["player"]]
z_index = 1
script = ExtResource("1_a7huw")
Sprite = NodePath("Sprite2D")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("2_5v6iy")
metadata/_edit_lock_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
rotation = 1.5708
shape = SubResource("CapsuleShape2D_f3qr4")
[node name="Camera2D" type="Camera2D" parent="."]
zoom = Vector2(0.3, 0.3)

37
scenes/world.tscn Normal file
View file

@ -0,0 +1,37 @@
[gd_scene load_steps=7 format=4 uid="uid://72e8cy3uuy8m"]
[ext_resource type="Texture2D" uid="uid://tqbjd6io6qfa" path="res://sprites/ground.jpg" id="1_deahv"]
[ext_resource type="PackedScene" uid="uid://bjy3gfpx6h1w5" path="res://scenes/player.tscn" id="2_jm6jq"]
[ext_resource type="Texture2D" uid="uid://dih2wjgfl4do" path="res://sprites/tiles/groundtile.jpg" id="3_3e26l"]
[ext_resource type="PackedScene" uid="uid://cpxco37ip15ev" path="res://scenes/contract_giver.tscn" id="4_0h7cx"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_knvup"]
texture = ExtResource("3_3e26l")
texture_region_size = Vector2i(128, 128)
0:0/0 = 0
0:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-64, -64, 64, -64, 64, 64, -64, 64)
[sub_resource type="TileSet" id="TileSet_g3b4o"]
tile_size = Vector2i(128, 128)
physics_layer_0/collision_layer = 1
sources/0 = SubResource("TileSetAtlasSource_knvup")
[node name="World" type="Node2D"]
metadata/_edit_lock_ = true
[node name="background" type="Sprite2D" parent="."]
texture_repeat = 2
texture = ExtResource("1_deahv")
region_enabled = true
region_rect = Rect2(0, 0, 10000, 10000)
metadata/_edit_lock_ = true
[node name="Player" parent="." instance=ExtResource("2_jm6jq")]
[node name="walls" type="TileMapLayer" parent="."]
modulate = Color(0.687215, 0.687215, 0.687215, 1)
tile_map_data = PackedByteArray("AAACAP7/AAAAAAAAAAACAP//AAAAAAAAAAACAAAAAAAAAAAAAAACAAEAAAAAAAAAAAACAAIAAAAAAAAAAAACAAMAAAAAAAAAAAABAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAD//wMAAAAAAAAAAAD+/wMAAAAAAAAAAAA=")
tile_set = SubResource("TileSet_g3b4o")
[node name="ContractGiver" parent="." instance=ExtResource("4_0h7cx")]
position = Vector2(779, -1420)

22
scripts/interactable.gd Normal file
View file

@ -0,0 +1,22 @@
extends Node
@export var ItemShown : Control
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
ItemShown.hide()
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
#assign signals from the area2D that you want to show something when player steps
func _on_body_entered(body: Node2D) -> void:
if body.is_in_group("player"):
ItemShown.show()
func _on_body_exited(body: Node2D) -> void:
if body.is_in_group("player"):
ItemShown.hide()

38
scripts/player.gd Normal file
View file

@ -0,0 +1,38 @@
extends CharacterBody2D
@export var Speed = 2500
@export var FrictionMult = 5
@export var Sprite : Sprite2D
var SpriteTurningSpeed = 5
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _physics_process(delta: float) -> void:
var direction = Vector2(0,0)
if Input.is_action_pressed("up"):
direction.y -= 1
if Input.is_action_pressed("down"):
direction.y += 1
if Input.is_action_pressed("left"):
direction.x -= 1
if Input.is_action_pressed("right"):
direction.x += 1
direction = direction.normalized()
velocity += direction * Speed * delta
velocity = velocity.move_toward(Vector2(0,0), delta * clamp(velocity.length() * FrictionMult, 1000, 10000))
if velocity.length() > 0.1:
Sprite.rotation = rotate_toward(Sprite.rotation,velocity.angle(),delta*SpriteTurningSpeed)
move_and_slide()

BIN
sprites/ant.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

34
sprites/ant.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dnxdkwa1krlv"
path="res://.godot/imported/ant.png-c056720ea3c0c94a92da847471959a79.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/ant.png"
dest_files=["res://.godot/imported/ant.png-c056720ea3c0c94a92da847471959a79.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
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/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=128
detect_3d/compress_to=1

BIN
sprites/contract.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bnqe06njx2agc"
path="res://.godot/imported/contract.png-009bf45fa4c16b73151877fabfff3dd9.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/contract.png"
dest_files=["res://.godot/imported/contract.png-009bf45fa4c16b73151877fabfff3dd9.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
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/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

BIN
sprites/contractgiver.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://ci3yxj63e5u8f"
path="res://.godot/imported/contractgiver.png-5e0c83e51d609609b6a6cf6677ca37f9.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/contractgiver.png"
dest_files=["res://.godot/imported/contractgiver.png-5e0c83e51d609609b6a6cf6677ca37f9.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
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/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

BIN
sprites/ground.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

34
sprites/ground.jpg.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://tqbjd6io6qfa"
path="res://.godot/imported/ground.jpg-d42b15e5a87e3323c2d96453e98aaa3b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/ground.jpg"
dest_files=["res://.godot/imported/ground.jpg-d42b15e5a87e3323c2d96453e98aaa3b.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
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/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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dih2wjgfl4do"
path="res://.godot/imported/groundtile.jpg-91753d86441ea8b77f12ec0eeba2df7a.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/tiles/groundtile.jpg"
dest_files=["res://.godot/imported/groundtile.jpg-91753d86441ea8b77f12ec0eeba2df7a.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
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/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=128
detect_3d/compress_to=1