added npc to chat with
This commit is contained in:
parent
eaeed156cb
commit
588ced0110
@ -1,2 +1,4 @@
|
|||||||
# Description
|
# Description
|
||||||
Working on this while sitting in the Game Design class. Let's see how far I get!
|
Working on this while sitting in the Game Design class. Let's see how far I get!
|
||||||
|
|
||||||
|
# Changelog
|
||||||
|
|||||||
5
ToDoList.txt
Normal file
5
ToDoList.txt
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
List of things to do in the 'game'
|
||||||
|
- Create an NPC to talk to
|
||||||
|
- Have an inventory for the player
|
||||||
|
- Allow player to pick up items
|
||||||
|
- Give an option to select a different player style
|
||||||
BIN
assets/npc_sprite.png
Normal file
BIN
assets/npc_sprite.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
40
assets/npc_sprite.png.import
Normal file
40
assets/npc_sprite.png.import
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://cgvt6p3a875tl"
|
||||||
|
path="res://.godot/imported/npc_sprite.png-0d3bd557fab31234994ccfe9289fc5fd.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/npc_sprite.png"
|
||||||
|
dest_files=["res://.godot/imported/npc_sprite.png-0d3bd557fab31234994ccfe9289fc5fd.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
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/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
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
|
||||||
@ -47,6 +47,11 @@ moveRight={
|
|||||||
"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)
|
"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)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
select={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
[physics]
|
[physics]
|
||||||
|
|
||||||
|
|||||||
44
scenes/NPC.tscn
Normal file
44
scenes/NPC.tscn
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
[gd_scene format=3 uid="uid://civli2tqcjiwh"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://bief2jignsvig" path="res://scripts/npcController.gd" id="1_6xvi5"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://cgvt6p3a875tl" path="res://assets/npc_sprite.png" id="1_mhefn"]
|
||||||
|
|
||||||
|
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_t62y5"]
|
||||||
|
radius = 6.0
|
||||||
|
height = 14.0
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_6xvi5"]
|
||||||
|
atlas = ExtResource("1_mhefn")
|
||||||
|
region = Rect2(16, 1, 14, 14)
|
||||||
|
|
||||||
|
[sub_resource type="SpriteFrames" id="SpriteFrames_ktgr7"]
|
||||||
|
animations = [{
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_6xvi5")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"default",
|
||||||
|
"speed": 5.0
|
||||||
|
}]
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_6xvi5"]
|
||||||
|
radius = 18.027756
|
||||||
|
|
||||||
|
[node name="Npc" type="CharacterBody2D" unique_id=218098716]
|
||||||
|
script = ExtResource("1_6xvi5")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1128661188]
|
||||||
|
shape = SubResource("CapsuleShape2D_t62y5")
|
||||||
|
|
||||||
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." unique_id=1048929834]
|
||||||
|
sprite_frames = SubResource("SpriteFrames_ktgr7")
|
||||||
|
|
||||||
|
[node name="Area2D" type="Area2D" parent="." unique_id=77830484]
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D" unique_id=747257472]
|
||||||
|
shape = SubResource("CircleShape2D_6xvi5")
|
||||||
|
debug_color = Color(0.714968, 0.26936808, 0.9850318, 0.41960785)
|
||||||
|
|
||||||
|
[connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"]
|
||||||
|
[connection signal="body_exited" from="Area2D" to="." method="_on_area_2d_body_exited"]
|
||||||
178
scenes/game.tscn
178
scenes/game.tscn
@ -1,159 +1,8 @@
|
|||||||
[gd_scene format=4 uid="uid://co3jigcci1u6c"]
|
[gd_scene format=4 uid="uid://co3jigcci1u6c"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://433o2c0j2ci7" path="res://scripts/playerController.gd" id="1_uwrxv"]
|
|
||||||
[ext_resource type="TileSet" uid="uid://bfr5rwsxuf38k" path="res://resources/terrain.tres" id="1_yqjtg"]
|
[ext_resource type="TileSet" uid="uid://bfr5rwsxuf38k" path="res://resources/terrain.tres" id="1_yqjtg"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cw64cil0fdk45" path="res://assets/player_sprite.png" id="3_lnu2h"]
|
[ext_resource type="PackedScene" uid="uid://dhe3138du1cy" path="res://scenes/player.tscn" id="2_yqjtg"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://civli2tqcjiwh" path="res://scenes/NPC.tscn" id="3_lnu2h"]
|
||||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_8cj0n"]
|
|
||||||
radius = 5.0
|
|
||||||
height = 14.0
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_lnu2h"]
|
|
||||||
atlas = ExtResource("3_lnu2h")
|
|
||||||
region = Rect2(17, 0, 12, 16)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_lbhrr"]
|
|
||||||
atlas = ExtResource("3_lnu2h")
|
|
||||||
region = Rect2(17, 0, 12, 16)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_iywne"]
|
|
||||||
atlas = ExtResource("3_lnu2h")
|
|
||||||
region = Rect2(17, 16, 12, 16)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ssvqc"]
|
|
||||||
atlas = ExtResource("3_lnu2h")
|
|
||||||
region = Rect2(17, 0, 12, 16)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_264po"]
|
|
||||||
atlas = ExtResource("3_lnu2h")
|
|
||||||
region = Rect2(17, 32, 12, 16)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_p57ef"]
|
|
||||||
atlas = ExtResource("3_lnu2h")
|
|
||||||
region = Rect2(1, 0, 12, 16)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_u5sy4"]
|
|
||||||
atlas = ExtResource("3_lnu2h")
|
|
||||||
region = Rect2(1, 16, 12, 16)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_gee14"]
|
|
||||||
atlas = ExtResource("3_lnu2h")
|
|
||||||
region = Rect2(1, 0, 12, 16)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_0tnpc"]
|
|
||||||
atlas = ExtResource("3_lnu2h")
|
|
||||||
region = Rect2(1, 32, 12, 16)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_vtaks"]
|
|
||||||
atlas = ExtResource("3_lnu2h")
|
|
||||||
region = Rect2(49, 0, 12, 16)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_kvpfn"]
|
|
||||||
atlas = ExtResource("3_lnu2h")
|
|
||||||
region = Rect2(49, 16, 12, 16)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_dinhu"]
|
|
||||||
atlas = ExtResource("3_lnu2h")
|
|
||||||
region = Rect2(49, 0, 12, 16)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_kvuet"]
|
|
||||||
atlas = ExtResource("3_lnu2h")
|
|
||||||
region = Rect2(49, 32, 12, 16)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ir15t"]
|
|
||||||
atlas = ExtResource("3_lnu2h")
|
|
||||||
region = Rect2(33, 0, 12, 16)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_trtic"]
|
|
||||||
atlas = ExtResource("3_lnu2h")
|
|
||||||
region = Rect2(33, 32, 12, 16)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_rysoc"]
|
|
||||||
atlas = ExtResource("3_lnu2h")
|
|
||||||
region = Rect2(33, 0, 12, 16)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ca42v"]
|
|
||||||
atlas = ExtResource("3_lnu2h")
|
|
||||||
region = Rect2(33, 16, 12, 16)
|
|
||||||
|
|
||||||
[sub_resource type="SpriteFrames" id="SpriteFrames_lnu2h"]
|
|
||||||
animations = [{
|
|
||||||
"frames": [{
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_lnu2h")
|
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"default",
|
|
||||||
"speed": 5.0
|
|
||||||
}, {
|
|
||||||
"frames": [{
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_lbhrr")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_iywne")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_ssvqc")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_264po")
|
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"walk_down",
|
|
||||||
"speed": 8.0
|
|
||||||
}, {
|
|
||||||
"frames": [{
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_p57ef")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_u5sy4")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_gee14")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_0tnpc")
|
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"walk_left",
|
|
||||||
"speed": 8.0
|
|
||||||
}, {
|
|
||||||
"frames": [{
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_vtaks")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_kvpfn")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_dinhu")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_kvuet")
|
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"walk_right",
|
|
||||||
"speed": 8.0
|
|
||||||
}, {
|
|
||||||
"frames": [{
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_ir15t")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_trtic")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_rysoc")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_ca42v")
|
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"walk_up",
|
|
||||||
"speed": 8.0
|
|
||||||
}]
|
|
||||||
|
|
||||||
[node name="game" type="Node2D" unique_id=609076121]
|
[node name="game" type="Node2D" unique_id=609076121]
|
||||||
|
|
||||||
@ -161,24 +10,7 @@ animations = [{
|
|||||||
tile_map_data = PackedByteArray("AAAAAP//AAABAAEAAAD/////AAABAAEAAAD//wAAAAABAAEAAAAAAAAAAAABAAEAAAAAAP7/AAABAAEAAAD///7/AAABAAEAAAD+//7/AAABAAEAAAD+////AAABAAEAAAD+/wAAAAABAAEAAAD+/wEAAAABAAEAAAD//wEAAAABAAEAAAAAAAEAAAABAAEAAAABAAEAAAABAAEAAAABAAAAAAABAAEAAAABAP//AAABAAEAAAABAP7/AAABAAEAAAD9//3/AAAAAAEAAAD+//3/AAABAAEAAAD///3/AAABAAEAAAAAAP3/AAABAAEAAAABAP3/AAABAAEAAAACAP3/AAAFAAAAAAACAP7/AAACAAEAAAACAP//AAACAAEAAAACAAAAAAACAAEAAAACAAEAAAACAAEAAAACAAIAAAACAAEAAAABAAIAAAABAAEAAAAAAAIAAAABAAEAAAD//wIAAAABAAEAAAD+/wIAAAABAAEAAAD9/wIAAAAAAAEAAAD9//7/AAAAAAEAAAD9////AAAAAAEAAAD9/wAAAAAAAAEAAAD9/wEAAAAAAAEAAAD8/wMAAAABAAAAAAD9/wMAAAAGAAEAAAD+/wMAAAABAAEAAAD//wMAAAABAAEAAAAAAAMAAAABAAEAAAABAAMAAAABAAEAAAACAAMAAAACAAEAAAADAP3/AAABAAIAAAADAPz/AAABAAEAAAD9//z/AAAAAAEAAAD+//z/AAABAAEAAAD///z/AAABAAEAAAAAAPz/AAABAAEAAAABAPz/AAABAAEAAAACAPz/AAABAAEAAAD9//v/AAAAAAEAAAD+//v/AAABAAEAAAD///v/AAABAAEAAAAAAPv/AAABAAEAAAABAPv/AAABAAEAAAACAPv/AAABAAEAAAADAPv/AAABAAEAAAAEAPv/AAABAAEAAAAEAPz/AAABAAEAAAAEAP3/AAABAAIAAAACAAQAAAACAAEAAAABAAQAAAABAAEAAAAAAAQAAAABAAEAAAD//wQAAAABAAEAAAD+/wQAAAABAAEAAAD9/wQAAAABAAEAAAD8/wQAAAABAAEAAAD7/wQAAAABAAEAAAD7/wMAAAABAAAAAAAHAP3/AAACAAIAAAAHAPz/AAACAAEAAAAHAPv/AAACAAEAAAAHAPr/AAACAAAAAAAGAP3/AAABAAIAAAAGAPz/AAABAAEAAAAGAPv/AAABAAEAAAAGAPr/AAABAAAAAAAFAP3/AAABAAIAAAAFAPz/AAABAAEAAAAFAPv/AAABAAEAAAAFAPr/AAABAAAAAAAEAPr/AAABAAAAAAADAPr/AAABAAAAAAACAAUAAAACA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AAABAAEAAAD+////AAABAAEAAAD+/wAAAAABAAEAAAD+/wEAAAABAAEAAAD//wEAAAABAAEAAAAAAAEAAAABAAEAAAABAAEAAAABAAEAAAABAAAAAAABAAEAAAABAP//AAABAAEAAAABAP7/AAABAAEAAAD9//3/AAAAAAEAAAD+//3/AAABAAEAAAD///3/AAABAAEAAAAAAP3/AAABAAEAAAABAP3/AAABAAEAAAACAP3/AAAFAAAAAAACAP7/AAACAAEAAAACAP//AAACAAEAAAACAAAAAAACAAEAAAACAAEAAAACAAEAAAACAAIAAAACAAEAAAABAAIAAAABAAEAAAAAAAIAAAABAAEAAAD//wIAAAABAAEAAAD+/wIAAAABAAEAAAD9/wIAAAAAAAEAAAD9//7/AAAAAAEAAAD9////AAAAAAEAAAD9/wAAAAAAAAEAAAD9/wEAAAAAAAEAAAD8/wMAAAABAAAAAAD9/wMAAAAGAAEAAAD+/wMAAAABAAEAAAD//wMAAAABAAEAAAAAAAMAAAABAAEAAAABAAMAAAABAAEAAAACAAMAAAACAAEAAAADAP3/AAABAAIAAAADAPz/AAABAAEAAAD9//z/AAAAAAEAAAD+//z/AAABAAEAAAD///z/AAABAAEAAAAAAPz/AAABAAEAAAABAPz/AAABAAEAAAACAPz/AAABAAEAAAD9//v/AAAAAAEAAAD+//v/AAABAAEAAAD///v/AAABAAEAAAAAAPv/AAABAAEAAAABAPv/AAABAAEAAAACAPv/AAABAAEAAAADAPv/AAABAAEAAAAEAPv/AAABAAEAAAAEAPz/AAABAAEAAAAEAP3/AAABAAIAAAACAAQAAAACAAEAAAABAAQAAAABAAEAAAAAAAQAAAABAAEAAAD//wQAAAABAAEAAAD+/wQAAAABAAEAAAD9/wQAAAABAAEAAAD8/wQAAAABAAEAAAD7/wQAAAABAAEAAAD7/wMAAAABAAAAAAAHAP3/AAACAAIAAAAHAPz/AAACAAEAAAAHAPv/AAACAAEAAAAHAPr/AAACAAAAAAAGAP3/AAABAAIAAAAGAPz/AAABAAEAAAAGAPv/AAABAAEAAAAGA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=")
|
||||||
tile_set = ExtResource("1_yqjtg")
|
tile_set = ExtResource("1_yqjtg")
|
||||||
|
|
||||||
[node name="player" type="CharacterBody2D" parent="." unique_id=51683594]
|
[node name="player" parent="." unique_id=151121176 instance=ExtResource("2_yqjtg")]
|
||||||
script = ExtResource("1_uwrxv")
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="player" unique_id=850198874]
|
[node name="Npc" parent="." unique_id=218098716 instance=ExtResource("3_lnu2h")]
|
||||||
shape = SubResource("CapsuleShape2D_8cj0n")
|
position = Vector2(88, 20)
|
||||||
|
|
||||||
[node name="Camera2D" type="Camera2D" parent="player" unique_id=589371709]
|
|
||||||
zoom = Vector2(10, 10)
|
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="player" unique_id=2116637545]
|
|
||||||
visible = false
|
|
||||||
texture_filter = 1
|
|
||||||
texture = ExtResource("3_lnu2h")
|
|
||||||
hframes = 4
|
|
||||||
vframes = 3
|
|
||||||
frame = 1
|
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="player" unique_id=896440593]
|
|
||||||
sprite_frames = SubResource("SpriteFrames_lnu2h")
|
|
||||||
animation = &"walk_up"
|
|
||||||
frame_progress = 0.04671712
|
|
||||||
|
|||||||
169
scenes/player.tscn
Normal file
169
scenes/player.tscn
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
[gd_scene format=3 uid="uid://dhe3138du1cy"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://433o2c0j2ci7" path="res://scripts/playerController.gd" id="1_g2els"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://cw64cil0fdk45" path="res://assets/player_sprite.png" id="2_qhqgy"]
|
||||||
|
|
||||||
|
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_8cj0n"]
|
||||||
|
radius = 5.0
|
||||||
|
height = 14.0
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_lnu2h"]
|
||||||
|
atlas = ExtResource("2_qhqgy")
|
||||||
|
region = Rect2(17, 0, 12, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_lbhrr"]
|
||||||
|
atlas = ExtResource("2_qhqgy")
|
||||||
|
region = Rect2(17, 0, 12, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_iywne"]
|
||||||
|
atlas = ExtResource("2_qhqgy")
|
||||||
|
region = Rect2(17, 16, 12, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_ssvqc"]
|
||||||
|
atlas = ExtResource("2_qhqgy")
|
||||||
|
region = Rect2(17, 0, 12, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_264po"]
|
||||||
|
atlas = ExtResource("2_qhqgy")
|
||||||
|
region = Rect2(17, 32, 12, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_p57ef"]
|
||||||
|
atlas = ExtResource("2_qhqgy")
|
||||||
|
region = Rect2(1, 0, 12, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_u5sy4"]
|
||||||
|
atlas = ExtResource("2_qhqgy")
|
||||||
|
region = Rect2(1, 16, 12, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_gee14"]
|
||||||
|
atlas = ExtResource("2_qhqgy")
|
||||||
|
region = Rect2(1, 0, 12, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_0tnpc"]
|
||||||
|
atlas = ExtResource("2_qhqgy")
|
||||||
|
region = Rect2(1, 32, 12, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_vtaks"]
|
||||||
|
atlas = ExtResource("2_qhqgy")
|
||||||
|
region = Rect2(49, 0, 12, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_kvpfn"]
|
||||||
|
atlas = ExtResource("2_qhqgy")
|
||||||
|
region = Rect2(49, 16, 12, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_dinhu"]
|
||||||
|
atlas = ExtResource("2_qhqgy")
|
||||||
|
region = Rect2(49, 0, 12, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_kvuet"]
|
||||||
|
atlas = ExtResource("2_qhqgy")
|
||||||
|
region = Rect2(49, 32, 12, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_ir15t"]
|
||||||
|
atlas = ExtResource("2_qhqgy")
|
||||||
|
region = Rect2(33, 0, 12, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_trtic"]
|
||||||
|
atlas = ExtResource("2_qhqgy")
|
||||||
|
region = Rect2(33, 32, 12, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_rysoc"]
|
||||||
|
atlas = ExtResource("2_qhqgy")
|
||||||
|
region = Rect2(33, 0, 12, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_ca42v"]
|
||||||
|
atlas = ExtResource("2_qhqgy")
|
||||||
|
region = Rect2(33, 16, 12, 16)
|
||||||
|
|
||||||
|
[sub_resource type="SpriteFrames" id="SpriteFrames_lnu2h"]
|
||||||
|
animations = [{
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_lnu2h")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"default",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_lbhrr")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_iywne")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_ssvqc")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_264po")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"walk_down",
|
||||||
|
"speed": 8.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_p57ef")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_u5sy4")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_gee14")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_0tnpc")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"walk_left",
|
||||||
|
"speed": 8.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_vtaks")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_kvpfn")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_dinhu")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_kvuet")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"walk_right",
|
||||||
|
"speed": 8.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_ir15t")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_trtic")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_rysoc")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_ca42v")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"walk_up",
|
||||||
|
"speed": 8.0
|
||||||
|
}]
|
||||||
|
|
||||||
|
[node name="player" type="CharacterBody2D" unique_id=151121176]
|
||||||
|
script = ExtResource("1_g2els")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1008512841]
|
||||||
|
shape = SubResource("CapsuleShape2D_8cj0n")
|
||||||
|
|
||||||
|
[node name="Camera2D" type="Camera2D" parent="." unique_id=1569990257]
|
||||||
|
zoom = Vector2(10, 10)
|
||||||
|
|
||||||
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." unique_id=2090459176]
|
||||||
|
sprite_frames = SubResource("SpriteFrames_lnu2h")
|
||||||
|
animation = &"walk_up"
|
||||||
|
frame_progress = 0.04671712
|
||||||
@ -4,8 +4,3 @@ extends Node
|
|||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
pass # Replace with function body.
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
func _process(delta):
|
|
||||||
pass
|
|
||||||
|
|||||||
18
scripts/npcController.gd
Normal file
18
scripts/npcController.gd
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
extends CharacterBody2D
|
||||||
|
|
||||||
|
var playerInArea = false
|
||||||
|
|
||||||
|
func _input(event):
|
||||||
|
if playerInArea && Input.is_action_pressed('select'):
|
||||||
|
talk()
|
||||||
|
|
||||||
|
func talk():
|
||||||
|
print('Hi friend!')
|
||||||
|
|
||||||
|
func _on_area_2d_body_entered(body):
|
||||||
|
if body.name == 'player':
|
||||||
|
playerInArea = true
|
||||||
|
|
||||||
|
func _on_area_2d_body_exited(body):
|
||||||
|
if body.name == 'player':
|
||||||
|
playerInArea = false
|
||||||
1
scripts/npcController.gd.uid
Normal file
1
scripts/npcController.gd.uid
Normal file
@ -0,0 +1 @@
|
|||||||
|
uid://bief2jignsvig
|
||||||
@ -1,19 +1,19 @@
|
|||||||
extends CharacterBody2D
|
extends CharacterBody2D
|
||||||
|
|
||||||
@onready var animationPlayer = $AnimatedSprite2D
|
@onready var animationPlayer = $AnimatedSprite2D
|
||||||
const SPEED = 175
|
const SPEED = 150
|
||||||
|
|
||||||
func _process(_delta):
|
func _process(_delta):
|
||||||
velocity = Input.get_vector("moveLeft", "moveRight", "moveUp", "moveDown") * SPEED
|
velocity = Input.get_vector('moveLeft', 'moveRight', 'moveUp', 'moveDown') * SPEED
|
||||||
move_and_slide()
|
move_and_slide()
|
||||||
|
|
||||||
if Input.is_action_pressed("moveUp"):
|
if Input.is_action_pressed('moveUp'):
|
||||||
animationPlayer.play("walk_up")
|
animationPlayer.play('walk_up')
|
||||||
elif Input.is_action_pressed("moveDown"):
|
elif Input.is_action_pressed('moveDown'):
|
||||||
animationPlayer.play("walk_down")
|
animationPlayer.play('walk_down')
|
||||||
elif Input.is_action_pressed("moveLeft"):
|
elif Input.is_action_pressed('moveLeft'):
|
||||||
animationPlayer.play("walk_left")
|
animationPlayer.play('walk_left')
|
||||||
elif Input.is_action_pressed("moveRight"):
|
elif Input.is_action_pressed('moveRight'):
|
||||||
animationPlayer.play("walk_right")
|
animationPlayer.play('walk_right')
|
||||||
else:
|
else:
|
||||||
animationPlayer.stop()
|
animationPlayer.stop()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user