From cdc9b4b543590a7a12a71773a4f38b48124324fd Mon Sep 17 00:00:00 2001 From: "charlie.aylott" Date: Sun, 3 Mar 2024 03:12:18 +0000 Subject: [PATCH 1/6] feat: commit for leo --- game-source/WebSockets.gd | 79 +++++++++++++++++++ game-source/icon.svg | 1 - game-source/icon.svg.import | 37 --------- game-source/main.tscn | 22 ------ game-source/player_character.gd | 15 ---- game-source/project.godot | 11 ++- game-source/{ => scenes/box}/box.tscn | 4 +- game-source/scenes/main/main.gd | 16 ++++ game-source/scenes/main/main.tscn | 11 +++ .../player_character/player_character.gd | 32 ++++++++ .../player_character}/player_character.tscn | 13 +-- 11 files changed, 156 insertions(+), 85 deletions(-) create mode 100644 game-source/WebSockets.gd delete mode 100644 game-source/icon.svg delete mode 100644 game-source/icon.svg.import delete mode 100644 game-source/main.tscn delete mode 100644 game-source/player_character.gd rename game-source/{ => scenes/box}/box.tscn (93%) create mode 100644 game-source/scenes/main/main.gd create mode 100644 game-source/scenes/main/main.tscn create mode 100644 game-source/scenes/player_character/player_character.gd rename game-source/{ => scenes/player_character}/player_character.tscn (70%) diff --git a/game-source/WebSockets.gd b/game-source/WebSockets.gd new file mode 100644 index 0000000..9090089 --- /dev/null +++ b/game-source/WebSockets.gd @@ -0,0 +1,79 @@ +extends Node +class_name WebSocketClient + +@export var handshake_headers : PackedStringArray +@export var supported_protocols : PackedStringArray +@export var tls_trusted_certificate : X509Certificate +@export var tls_verify := true + + +var socket = WebSocketPeer.new() +var last_state = WebSocketPeer.STATE_CLOSED + + +signal connected_to_server() +signal connection_closed() +signal message_received(message: Variant) + + +func connect_to_url(url) -> int: + socket.supported_protocols = supported_protocols + socket.handshake_headers = handshake_headers + var tls_options = TLSOptions.client(tls_trusted_certificate) + var err = socket.connect_to_url(url, tls_options) + if err != OK: + print("i tried :(", err) + return err + last_state = socket.get_ready_state() + return OK + + +func send(message) -> int: + print(socket.get_ready_state()) + if typeof(message) == TYPE_STRING: + return socket.send_text(message) + return socket.send(var_to_bytes(message)) + + +func get_message() -> Variant: + if socket.get_available_packet_count() < 1: + return null + var pkt = socket.get_packet() + if socket.was_string_packet(): + return pkt.get_string_from_utf8() + return bytes_to_var(pkt) + + +func close(code := 1000, reason := "") -> void: + socket.close(code, reason) + last_state = socket.get_ready_state() + + +func clear() -> void: + socket = WebSocketPeer.new() + last_state = socket.get_ready_state() + + +func get_socket() -> WebSocketPeer: + return socket + + +func poll() -> void: + if socket.get_ready_state() != socket.STATE_CLOSED: + socket.poll() + var state = socket.get_ready_state() + if last_state != state: + last_state = state + if state == socket.STATE_OPEN: + connected_to_server.emit() + elif state == socket.STATE_CLOSED: + connection_closed.emit() + while socket.get_ready_state() == socket.STATE_OPEN and socket.get_available_packet_count(): + message_received.emit(get_message()) + + +func _ready(): + connect_to_url("ws://localhost:8000/ws") + +func _process(delta): + poll() diff --git a/game-source/icon.svg b/game-source/icon.svg deleted file mode 100644 index b370ceb..0000000 --- a/game-source/icon.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/game-source/icon.svg.import b/game-source/icon.svg.import deleted file mode 100644 index 672e88c..0000000 --- a/game-source/icon.svg.import +++ /dev/null @@ -1,37 +0,0 @@ -[remap] - -importer="texture" -type="CompressedTexture2D" -uid="uid://bay85nk58yj5e" -path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://icon.svg" -dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.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 -svg/scale=1.0 -editor/scale_with_editor_scale=false -editor/convert_colors_with_editor_theme=false diff --git a/game-source/main.tscn b/game-source/main.tscn deleted file mode 100644 index 5761a76..0000000 --- a/game-source/main.tscn +++ /dev/null @@ -1,22 +0,0 @@ -[gd_scene load_steps=3 format=3 uid="uid://2t2nbl4hrw8b"] - -[ext_resource type="PackedScene" uid="uid://xqoiyxrn10js" path="res://player_character.tscn" id="1_j2rm2"] -[ext_resource type="PackedScene" uid="uid://cv6rvnsd8jc4u" path="res://box.tscn" id="2_n627q"] - -[node name="GameLevel" type="Node2D"] - -[node name="PlayerCharacter" parent="." instance=ExtResource("1_j2rm2")] -position = Vector2(607, 323) -move_speed = 1000.0 - -[node name="box" parent="." instance=ExtResource("2_n627q")] -position = Vector2(986, 524) - -[node name="box2" parent="." instance=ExtResource("2_n627q")] -position = Vector2(140, -16) - -[node name="box3" parent="." instance=ExtResource("2_n627q")] -position = Vector2(189, 538) - -[node name="box4" parent="." instance=ExtResource("2_n627q")] -position = Vector2(1120, -33) diff --git a/game-source/player_character.gd b/game-source/player_character.gd deleted file mode 100644 index 2bff2fd..0000000 --- a/game-source/player_character.gd +++ /dev/null @@ -1,15 +0,0 @@ -extends CharacterBody2D - - -@export var move_speed: float = 400 - - -func _physics_process(delta): - var input_dir = Vector2( - Input.get_action_strength("right") - Input. get_action_strength("left"), - Input.get_action_strength("down") - Input.get_action_strength("up") - ) - - velocity = input_dir*move_speed - - move_and_slide() diff --git a/game-source/project.godot b/game-source/project.godot index d939711..40c2a89 100644 --- a/game-source/project.godot +++ b/game-source/project.godot @@ -11,9 +11,16 @@ config_version=5 [application] config/name="Cosmic Kube" -run/main_scene="res://main.tscn" +run/main_scene="res://scenes/main/main.tscn" config/features=PackedStringArray("4.2", "GL Compatibility") -config/icon="res://icon.svg" + +[autoload] + +WebSockets="*res://WebSockets.gd" + +[display] + +window/stretch/mode="viewport" [input] diff --git a/game-source/box.tscn b/game-source/scenes/box/box.tscn similarity index 93% rename from game-source/box.tscn rename to game-source/scenes/box/box.tscn index c27965b..1354980 100644 --- a/game-source/box.tscn +++ b/game-source/scenes/box/box.tscn @@ -1,12 +1,12 @@ [gd_scene load_steps=2 format=3 uid="uid://cv6rvnsd8jc4u"] -[ext_resource type="Texture2D" uid="uid://c6jm42o02gsfr" path="res://assets/box.png" id="1_q4dmh"] +[ext_resource type="Texture2D" uid="uid://c6jm42o02gsfr" path="res://assets/box.png" id="1_blfj8"] [node name="CharacterBody2D" type="CharacterBody2D"] [node name="Box" type="Sprite2D" parent="."] position = Vector2(33, 52) -texture = ExtResource("1_q4dmh") +texture = ExtResource("1_blfj8") [node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."] visible = false diff --git a/game-source/scenes/main/main.gd b/game-source/scenes/main/main.gd new file mode 100644 index 0000000..e70a280 --- /dev/null +++ b/game-source/scenes/main/main.gd @@ -0,0 +1,16 @@ +extends Node2D +@export var on = true +@export var tile_size = 100 + +func _draw(): + var camera: Camera2D = get_tree().current_scene.find_child('PlayerCharacter').find_child('Camera2D') + + if !on: + pass + var size = get_viewport_rect().size * camera.zoom / 2 + var cam = camera.position + for i in range(int((cam.x - size.x) / tile_size) - 1, int((size.x + cam.x) / tile_size) + 1): + draw_line(Vector2(i * tile_size, cam.y + size.y + 100), Vector2(i * tile_size, cam.y - size.y - 100), "000000") + for i in range(int((cam.y - size.y) / tile_size) - 1, int((size.y + cam.y) / tile_size) + 1): + draw_line(Vector2(cam.x + size.x + 100, i * tile_size), Vector2(cam.x - size.x - 100, i * tile_size), "000000") + diff --git a/game-source/scenes/main/main.tscn b/game-source/scenes/main/main.tscn new file mode 100644 index 0000000..b56a0e3 --- /dev/null +++ b/game-source/scenes/main/main.tscn @@ -0,0 +1,11 @@ +[gd_scene load_steps=3 format=3 uid="uid://2t2nbl4hrw8b"] + +[ext_resource type="PackedScene" uid="uid://xqoiyxrn10js" path="res://scenes/player_character/player_character.tscn" id="1_1c02b"] +[ext_resource type="Script" path="res://scenes/main/main.gd" id="1_47q2m"] + +[node name="GameLevel" type="Node2D"] +script = ExtResource("1_47q2m") + +[node name="PlayerCharacter" parent="." instance=ExtResource("1_1c02b")] +position = Vector2(581, 325) +animation_speed = 3.0 diff --git a/game-source/scenes/player_character/player_character.gd b/game-source/scenes/player_character/player_character.gd new file mode 100644 index 0000000..3033199 --- /dev/null +++ b/game-source/scenes/player_character/player_character.gd @@ -0,0 +1,32 @@ +extends CharacterBody2D + + +@export var tile_size: float = 100 +@export var is_moving: bool = false +@export var animation_speed: float = 4 + +func _process(delta): + queue_redraw() + +func _ready(): + position = position.snapped(Vector2.ONE * tile_size) + position += Vector2.ONE * tile_size / 2 + + +func _input(event): + if is_moving: + pass + var tween = get_tree().create_tween() + + var input_vec = Vector2( + event.get_action_strength("right") - event. get_action_strength("left"), + event.get_action_strength("down") - event.get_action_strength("up") + ) + + tween.tween_property(self, 'position', position + (input_vec*tile_size),1.0/animation_speed).set_trans(Tween.TRANS_SINE) + is_moving = true + await tween.finished + is_moving = false + + + move_and_slide() diff --git a/game-source/player_character.tscn b/game-source/scenes/player_character/player_character.tscn similarity index 70% rename from game-source/player_character.tscn rename to game-source/scenes/player_character/player_character.tscn index eadb214..2119c32 100644 --- a/game-source/player_character.tscn +++ b/game-source/scenes/player_character/player_character.tscn @@ -1,20 +1,21 @@ [gd_scene load_steps=3 format=3 uid="uid://xqoiyxrn10js"] [ext_resource type="Texture2D" uid="uid://cf7mjmudnjchn" path="res://assets/lil_guy.png" id="1_rfqfo"] -[ext_resource type="Script" path="res://player_character.gd" id="1_rmbqt"] +[ext_resource type="Script" path="res://scenes/player_character/player_character.gd" id="1_rmbqt"] [node name="PlayerCharacter" type="CharacterBody2D"] script = ExtResource("1_rmbqt") [node name="Sprite2D" type="Sprite2D" parent="."] -position = Vector2(-0.5, 3) -scale = Vector2(1.002, 1.008) +scale = Vector2(0.458, 0.368) texture = ExtResource("1_rfqfo") [node name="Camera2D" type="Camera2D" parent="."] [node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."] -visible = false -position = Vector2(-0.5, 3) -scale = Vector2(1.002, 1.008) +scale = Vector2(0.458, 0.368) polygon = PackedVector2Array(52, -166.9, 52, -165.3, 63, -160.3, 63, -158.7, 71, -148.7, 71, -145.4, 74, -137.4, 74, -120, 77, -96.1, 77, -78, 82, 49, 80.9, 49, 78.9, 124, 77.5, 124, 74.6, 136, 73, 136, 68, 143, 65.4, 143, 47.4, 150, 40, 150, -60, 149, -60, 147.8, -72, 146.8, -72, 144.7, -79, 136.8, -79, 132.4, -83, 123.4, -83, 121, -80, 56, -80, -49, -80.8, -49, -84, -84.9, -84, -90, -82, -139, -80.5, -139, -78.6, -147, -76.9, -147, -62.8, -160, -60.4, -160, -49.4, -165, -39.4, -165, -26, -167.7, -26, -169.1) + +[node name="CollisionPolygon2D2" type="CollisionPolygon2D" parent="."] +scale = Vector2(0.458, 0.368) +polygon = PackedVector2Array(84, 152.9, 84, 156.8, 80.8, 160, 76.9, 160, 73.7, 155.1, 74.8, 153, 76.2, 153, 77, 152.2, 77, 150.8, 79.1, 149.7) From 605ed5667fc8c2ecd318dc5cc210b0824af4aa3d Mon Sep 17 00:00:00 2001 From: "charlie.aylott" Date: Sun, 3 Mar 2024 03:45:03 +0000 Subject: [PATCH 2/6] feat: no stuttery movement --- game-source/assets/Illustration95.png | Bin 0 -> 3495 bytes game-source/assets/Illustration95.png.import | 34 ++++++++++++++++++ game-source/scenes/main/main.gd | 9 +++-- game-source/scenes/main/main.tscn | 4 +-- .../player_character/player_character.gd | 29 ++++++++------- .../player_character/player_character.tscn | 23 ++++++------ 6 files changed, 70 insertions(+), 29 deletions(-) create mode 100644 game-source/assets/Illustration95.png create mode 100644 game-source/assets/Illustration95.png.import diff --git a/game-source/assets/Illustration95.png b/game-source/assets/Illustration95.png new file mode 100644 index 0000000000000000000000000000000000000000..8a60264c4910f4266d14f9c43a07e1d1dc6b7b79 GIT binary patch literal 3495 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 B&L{u? literal 0 HcmV?d00001 diff --git a/game-source/assets/Illustration95.png.import b/game-source/assets/Illustration95.png.import new file mode 100644 index 0000000..c54a4ec --- /dev/null +++ b/game-source/assets/Illustration95.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bdap4f6w37byq" +path="res://.godot/imported/Illustration95.png-83b3dbf36a7985d78f181801efd673ad.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/Illustration95.png" +dest_files=["res://.godot/imported/Illustration95.png-83b3dbf36a7985d78f181801efd673ad.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 diff --git a/game-source/scenes/main/main.gd b/game-source/scenes/main/main.gd index e70a280..0eb2721 100644 --- a/game-source/scenes/main/main.gd +++ b/game-source/scenes/main/main.gd @@ -2,13 +2,18 @@ extends Node2D @export var on = true @export var tile_size = 100 -func _draw(): - var camera: Camera2D = get_tree().current_scene.find_child('PlayerCharacter').find_child('Camera2D') +func _process(delta): + queue_redraw() +func _draw(): if !on: pass + + var camera: Camera2D = get_tree().current_scene.find_child('PlayerCharacter').find_child('Camera2D') + var size = get_viewport_rect().size * camera.zoom / 2 var cam = camera.position + for i in range(int((cam.x - size.x) / tile_size) - 1, int((size.x + cam.x) / tile_size) + 1): draw_line(Vector2(i * tile_size, cam.y + size.y + 100), Vector2(i * tile_size, cam.y - size.y - 100), "000000") for i in range(int((cam.y - size.y) / tile_size) - 1, int((size.y + cam.y) / tile_size) + 1): diff --git a/game-source/scenes/main/main.tscn b/game-source/scenes/main/main.tscn index b56a0e3..a3372c6 100644 --- a/game-source/scenes/main/main.tscn +++ b/game-source/scenes/main/main.tscn @@ -7,5 +7,5 @@ script = ExtResource("1_47q2m") [node name="PlayerCharacter" parent="." instance=ExtResource("1_1c02b")] -position = Vector2(581, 325) -animation_speed = 3.0 +position = Vector2(577, 325) +scale = Vector2(2.9, 2.9) diff --git a/game-source/scenes/player_character/player_character.gd b/game-source/scenes/player_character/player_character.gd index 3033199..4532422 100644 --- a/game-source/scenes/player_character/player_character.gd +++ b/game-source/scenes/player_character/player_character.gd @@ -5,8 +5,13 @@ extends CharacterBody2D @export var is_moving: bool = false @export var animation_speed: float = 4 -func _process(delta): - queue_redraw() +var inputs = { + "right": Vector2.RIGHT, + "left": Vector2.LEFT, + "up": Vector2.UP, + "down": Vector2.DOWN +} + func _ready(): position = position.snapped(Vector2.ONE * tile_size) @@ -16,17 +21,11 @@ func _ready(): func _input(event): if is_moving: pass - var tween = get_tree().create_tween() - - var input_vec = Vector2( - event.get_action_strength("right") - event. get_action_strength("left"), - event.get_action_strength("down") - event.get_action_strength("up") - ) - - tween.tween_property(self, 'position', position + (input_vec*tile_size),1.0/animation_speed).set_trans(Tween.TRANS_SINE) - is_moving = true - await tween.finished - is_moving = false - + for dir in inputs.keys(): + if event.is_action_pressed(dir): + var tween = get_tree().create_tween() + tween.tween_property(self, "position", position + (inputs[dir] * tile_size), 1.0/animation_speed).set_trans(Tween.TRANS_SINE) + is_moving = true + await tween.finished + is_moving = false - move_and_slide() diff --git a/game-source/scenes/player_character/player_character.tscn b/game-source/scenes/player_character/player_character.tscn index 2119c32..4cb70da 100644 --- a/game-source/scenes/player_character/player_character.tscn +++ b/game-source/scenes/player_character/player_character.tscn @@ -1,21 +1,24 @@ -[gd_scene load_steps=3 format=3 uid="uid://xqoiyxrn10js"] +[gd_scene load_steps=4 format=3 uid="uid://xqoiyxrn10js"] -[ext_resource type="Texture2D" uid="uid://cf7mjmudnjchn" path="res://assets/lil_guy.png" id="1_rfqfo"] [ext_resource type="Script" path="res://scenes/player_character/player_character.gd" id="1_rmbqt"] +[ext_resource type="Texture2D" uid="uid://bdap4f6w37byq" path="res://assets/Illustration95.png" id="2_0gsa3"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_nrvy8"] +size = Vector2(14, 15.5) [node name="PlayerCharacter" type="CharacterBody2D"] script = ExtResource("1_rmbqt") [node name="Sprite2D" type="Sprite2D" parent="."] scale = Vector2(0.458, 0.368) -texture = ExtResource("1_rfqfo") +texture = ExtResource("2_0gsa3") +hframes = 3 +vframes = 3 +frame = 3 [node name="Camera2D" type="Camera2D" parent="."] -[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."] -scale = Vector2(0.458, 0.368) -polygon = PackedVector2Array(52, -166.9, 52, -165.3, 63, -160.3, 63, -158.7, 71, -148.7, 71, -145.4, 74, -137.4, 74, -120, 77, -96.1, 77, -78, 82, 49, 80.9, 49, 78.9, 124, 77.5, 124, 74.6, 136, 73, 136, 68, 143, 65.4, 143, 47.4, 150, 40, 150, -60, 149, -60, 147.8, -72, 146.8, -72, 144.7, -79, 136.8, -79, 132.4, -83, 123.4, -83, 121, -80, 56, -80, -49, -80.8, -49, -84, -84.9, -84, -90, -82, -139, -80.5, -139, -78.6, -147, -76.9, -147, -62.8, -160, -60.4, -160, -49.4, -165, -39.4, -165, -26, -167.7, -26, -169.1) - -[node name="CollisionPolygon2D2" type="CollisionPolygon2D" parent="."] -scale = Vector2(0.458, 0.368) -polygon = PackedVector2Array(84, 152.9, 84, 156.8, 80.8, 160, 76.9, 160, 73.7, 155.1, 74.8, 153, 76.2, 153, 77, 152.2, 77, 150.8, 79.1, 149.7) +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2(0, 2.38419e-07) +scale = Vector2(-0.811343, 1.12881) +shape = SubResource("RectangleShape2D_nrvy8") From 4adc22a00dc4b47918cb5cae958c94e37444d74f Mon Sep 17 00:00:00 2001 From: Leo Durrant Date: Sun, 3 Mar 2024 03:55:55 +0000 Subject: [PATCH 3/6] fix: grid drawing --- game-source/assets/tileset.png | Bin 0 -> 780 bytes game-source/assets/tileset.png.import | 34 +++++++++++++++++++++ game-source/scenes/main/main.gd | 4 +-- game-source/scenes/main/tileset.png | Bin 0 -> 780 bytes game-source/scenes/main/tileset.png.import | 34 +++++++++++++++++++++ 5 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 game-source/assets/tileset.png create mode 100644 game-source/assets/tileset.png.import create mode 100644 game-source/scenes/main/tileset.png create mode 100644 game-source/scenes/main/tileset.png.import diff --git a/game-source/assets/tileset.png b/game-source/assets/tileset.png new file mode 100644 index 0000000000000000000000000000000000000000..cfbcf10d8a1e3dbab0d545080bdb580ba67e0698 GIT binary patch literal 780 zcmeAS@N?(olHy`uVBq!ia0vp^CxAGGgAGU?ZmZ{JU|?*{baoE#baqxKD9TUE%t>Wn z(3n^|(bnUzgGAf?WnQjYO=SXwCjyQh)YEztu{xlIYhhT%)q_ti*=Jmuuw;h?*E&}A zda>1fdgpdo?ci#9z~8aCdGey}DL-O^G6WyX9=F}|eXoA`eMYCnhfG#$^JVPHT{fB1 zaCWq)^Lmb5#WKuBn|mxhy$+Vw+*LmCeYeE>;vCOqwR;NlZf@Z{ z_xp%o*rd=$#g8~A>v{Y+QF`>T`8n6=tn(xdjbBzi;@BARCShrF^Z$eI??tt)^wig!!>}t}=6SLR$6KbeyB^obTl;-x;jm*4ueu$d z%dmO=lIyplzHq#_&!)HT_N-0pG4B|h{o8U*trJu2_)6&q4+JE%gTC!Lzq{J%_qTlC)%Er+FN&r(PLxyx#tK`Kx4R3&e-K=-cll(X z2xoyuWHAGSo-znCRxGtI0}8U2c>21szhGu&)>M(asw@N)k}PqJC~?lu%}vcKVQ?-= zO)N=GQ7F$W$xv|j^bH7al_;t(gka_&slpIK*a}yLMMwxk ei~;Q450{xGc$gmY9QFpKdj?NeKbLh*2~7ZXNE>tj literal 0 HcmV?d00001 diff --git a/game-source/assets/tileset.png.import b/game-source/assets/tileset.png.import new file mode 100644 index 0000000..c65d9f4 --- /dev/null +++ b/game-source/assets/tileset.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dmpr81denwqld" +path="res://.godot/imported/tileset.png-c50288acd069fa293d7940a084811264.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/tileset.png" +dest_files=["res://.godot/imported/tileset.png-c50288acd069fa293d7940a084811264.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 diff --git a/game-source/scenes/main/main.gd b/game-source/scenes/main/main.gd index 0eb2721..093d424 100644 --- a/game-source/scenes/main/main.gd +++ b/game-source/scenes/main/main.gd @@ -9,9 +9,9 @@ func _draw(): if !on: pass - var camera: Camera2D = get_tree().current_scene.find_child('PlayerCharacter').find_child('Camera2D') + var camera: CharacterBody2D = get_tree().current_scene.find_child('PlayerCharacter') - var size = get_viewport_rect().size * camera.zoom / 2 + var size = get_viewport_rect().size / 2 var cam = camera.position for i in range(int((cam.x - size.x) / tile_size) - 1, int((size.x + cam.x) / tile_size) + 1): diff --git a/game-source/scenes/main/tileset.png b/game-source/scenes/main/tileset.png new file mode 100644 index 0000000000000000000000000000000000000000..cfbcf10d8a1e3dbab0d545080bdb580ba67e0698 GIT binary patch literal 780 zcmeAS@N?(olHy`uVBq!ia0vp^CxAGGgAGU?ZmZ{JU|?*{baoE#baqxKD9TUE%t>Wn z(3n^|(bnUzgGAf?WnQjYO=SXwCjyQh)YEztu{xlIYhhT%)q_ti*=Jmuuw;h?*E&}A zda>1fdgpdo?ci#9z~8aCdGey}DL-O^G6WyX9=F}|eXoA`eMYCnhfG#$^JVPHT{fB1 zaCWq)^Lmb5#WKuBn|mxhy$+Vw+*LmCeYeE>;vCOqwR;NlZf@Z{ z_xp%o*rd=$#g8~A>v{Y+QF`>T`8n6=tn(xdjbBzi;@BARCShrF^Z$eI??tt)^wig!!>}t}=6SLR$6KbeyB^obTl;-x;jm*4ueu$d z%dmO=lIyplzHq#_&!)HT_N-0pG4B|h{o8U*trJu2_)6&q4+JE%gTC!Lzq{J%_qTlC)%Er+FN&r(PLxyx#tK`Kx4R3&e-K=-cll(X z2xoyuWHAGSo-znCRxGtI0}8U2c>21szhGu&)>M(asw@N)k}PqJC~?lu%}vcKVQ?-= zO)N=GQ7F$W$xv|j^bH7al_;t(gka_&slpIK*a}yLMMwxk ei~;Q450{xGc$gmY9QFpKdj?NeKbLh*2~7ZXNE>tj literal 0 HcmV?d00001 diff --git a/game-source/scenes/main/tileset.png.import b/game-source/scenes/main/tileset.png.import new file mode 100644 index 0000000..9636a11 --- /dev/null +++ b/game-source/scenes/main/tileset.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://y4ighq1hmfes" +path="res://.godot/imported/tileset.png-cb2f89c77c0d8231eced7af442399850.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://scenes/main/tileset.png" +dest_files=["res://.godot/imported/tileset.png-cb2f89c77c0d8231eced7af442399850.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 From bff6e47812dc005dbcacd1b5b561baaccb10c996 Mon Sep 17 00:00:00 2001 From: "charlie.aylott" Date: Sun, 3 Mar 2024 04:16:05 +0000 Subject: [PATCH 4/6] fix: diag movement was BANNED --- .../scenes/player_character/player_character.gd | 14 +++++--------- .../scenes/player_character/player_character.tscn | 1 + 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/game-source/scenes/player_character/player_character.gd b/game-source/scenes/player_character/player_character.gd index 4532422..753fad2 100644 --- a/game-source/scenes/player_character/player_character.gd +++ b/game-source/scenes/player_character/player_character.gd @@ -16,16 +16,12 @@ var inputs = { func _ready(): position = position.snapped(Vector2.ONE * tile_size) position += Vector2.ONE * tile_size / 2 + func _input(event): - if is_moving: - pass - for dir in inputs.keys(): - if event.is_action_pressed(dir): - var tween = get_tree().create_tween() - tween.tween_property(self, "position", position + (inputs[dir] * tile_size), 1.0/animation_speed).set_trans(Tween.TRANS_SINE) - is_moving = true - await tween.finished - is_moving = false + var vec = Input.get_vector("left","right","up","down") + + if !is_moving and vec.length()==1: + position += vec*100 diff --git a/game-source/scenes/player_character/player_character.tscn b/game-source/scenes/player_character/player_character.tscn index 4cb70da..5a5fb90 100644 --- a/game-source/scenes/player_character/player_character.tscn +++ b/game-source/scenes/player_character/player_character.tscn @@ -17,6 +17,7 @@ vframes = 3 frame = 3 [node name="Camera2D" type="Camera2D" parent="."] +position_smoothing_enabled = true [node name="CollisionShape2D" type="CollisionShape2D" parent="."] position = Vector2(0, 2.38419e-07) From bc8910119a930742925164186b77db4231f2d5fd Mon Sep 17 00:00:00 2001 From: "charlie.aylott" Date: Sun, 3 Mar 2024 04:18:26 +0000 Subject: [PATCH 5/6] task: newlined were removed in this commit --- game-source/scenes/player_character/player_character.gd | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/game-source/scenes/player_character/player_character.gd b/game-source/scenes/player_character/player_character.gd index 753fad2..862fad9 100644 --- a/game-source/scenes/player_character/player_character.gd +++ b/game-source/scenes/player_character/player_character.gd @@ -3,7 +3,6 @@ extends CharacterBody2D @export var tile_size: float = 100 @export var is_moving: bool = false -@export var animation_speed: float = 4 var inputs = { "right": Vector2.RIGHT, @@ -12,16 +11,12 @@ var inputs = { "down": Vector2.DOWN } - func _ready(): position = position.snapped(Vector2.ONE * tile_size) position += Vector2.ONE * tile_size / 2 - - func _input(event): - var vec = Input.get_vector("left","right","up","down") - + var vec = Input.get_vector("left", "right", "up", "down") if !is_moving and vec.length()==1: position += vec*100 From 4da4d83e54a372e4ac386027ab1660b2c6156758 Mon Sep 17 00:00:00 2001 From: "charlie.aylott" Date: Sun, 3 Mar 2024 05:00:40 +0000 Subject: [PATCH 6/6] feat: added walking animation --- game-source/assets/tileset.png | Bin 780 -> 0 bytes game-source/assets/tileset.png.import | 34 --------- game-source/project.godot | 2 +- game-source/scenes/main/tileset.png | Bin 780 -> 0 bytes game-source/scenes/main/tileset.png.import | 34 --------- .../player_character/player_character.gd | 10 ++- .../player_character/player_character.tscn | 72 +++++++++++++++++- 7 files changed, 80 insertions(+), 72 deletions(-) delete mode 100644 game-source/assets/tileset.png delete mode 100644 game-source/assets/tileset.png.import delete mode 100644 game-source/scenes/main/tileset.png delete mode 100644 game-source/scenes/main/tileset.png.import diff --git a/game-source/assets/tileset.png b/game-source/assets/tileset.png deleted file mode 100644 index cfbcf10d8a1e3dbab0d545080bdb580ba67e0698..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 780 zcmeAS@N?(olHy`uVBq!ia0vp^CxAGGgAGU?ZmZ{JU|?*{baoE#baqxKD9TUE%t>Wn z(3n^|(bnUzgGAf?WnQjYO=SXwCjyQh)YEztu{xlIYhhT%)q_ti*=Jmuuw;h?*E&}A zda>1fdgpdo?ci#9z~8aCdGey}DL-O^G6WyX9=F}|eXoA`eMYCnhfG#$^JVPHT{fB1 zaCWq)^Lmb5#WKuBn|mxhy$+Vw+*LmCeYeE>;vCOqwR;NlZf@Z{ z_xp%o*rd=$#g8~A>v{Y+QF`>T`8n6=tn(xdjbBzi;@BARCShrF^Z$eI??tt)^wig!!>}t}=6SLR$6KbeyB^obTl;-x;jm*4ueu$d z%dmO=lIyplzHq#_&!)HT_N-0pG4B|h{o8U*trJu2_)6&q4+JE%gTC!Lzq{J%_qTlC)%Er+FN&r(PLxyx#tK`Kx4R3&e-K=-cll(X z2xoyuWHAGSo-znCRxGtI0}8U2c>21szhGu&)>M(asw@N)k}PqJC~?lu%}vcKVQ?-= zO)N=GQ7F$W$xv|j^bH7al_;t(gka_&slpIK*a}yLMMwxk ei~;Q450{xGc$gmY9QFpKdj?NeKbLh*2~7ZXNE>tj diff --git a/game-source/assets/tileset.png.import b/game-source/assets/tileset.png.import deleted file mode 100644 index c65d9f4..0000000 --- a/game-source/assets/tileset.png.import +++ /dev/null @@ -1,34 +0,0 @@ -[remap] - -importer="texture" -type="CompressedTexture2D" -uid="uid://dmpr81denwqld" -path="res://.godot/imported/tileset.png-c50288acd069fa293d7940a084811264.ctex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://assets/tileset.png" -dest_files=["res://.godot/imported/tileset.png-c50288acd069fa293d7940a084811264.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 diff --git a/game-source/project.godot b/game-source/project.godot index 40c2a89..ea3ff37 100644 --- a/game-source/project.godot +++ b/game-source/project.godot @@ -20,7 +20,7 @@ WebSockets="*res://WebSockets.gd" [display] -window/stretch/mode="viewport" +window/stretch/mode="canvas_items" [input] diff --git a/game-source/scenes/main/tileset.png b/game-source/scenes/main/tileset.png deleted file mode 100644 index cfbcf10d8a1e3dbab0d545080bdb580ba67e0698..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 780 zcmeAS@N?(olHy`uVBq!ia0vp^CxAGGgAGU?ZmZ{JU|?*{baoE#baqxKD9TUE%t>Wn z(3n^|(bnUzgGAf?WnQjYO=SXwCjyQh)YEztu{xlIYhhT%)q_ti*=Jmuuw;h?*E&}A zda>1fdgpdo?ci#9z~8aCdGey}DL-O^G6WyX9=F}|eXoA`eMYCnhfG#$^JVPHT{fB1 zaCWq)^Lmb5#WKuBn|mxhy$+Vw+*LmCeYeE>;vCOqwR;NlZf@Z{ z_xp%o*rd=$#g8~A>v{Y+QF`>T`8n6=tn(xdjbBzi;@BARCShrF^Z$eI??tt)^wig!!>}t}=6SLR$6KbeyB^obTl;-x;jm*4ueu$d z%dmO=lIyplzHq#_&!)HT_N-0pG4B|h{o8U*trJu2_)6&q4+JE%gTC!Lzq{J%_qTlC)%Er+FN&r(PLxyx#tK`Kx4R3&e-K=-cll(X z2xoyuWHAGSo-znCRxGtI0}8U2c>21szhGu&)>M(asw@N)k}PqJC~?lu%}vcKVQ?-= zO)N=GQ7F$W$xv|j^bH7al_;t(gka_&slpIK*a}yLMMwxk ei~;Q450{xGc$gmY9QFpKdj?NeKbLh*2~7ZXNE>tj diff --git a/game-source/scenes/main/tileset.png.import b/game-source/scenes/main/tileset.png.import deleted file mode 100644 index 9636a11..0000000 --- a/game-source/scenes/main/tileset.png.import +++ /dev/null @@ -1,34 +0,0 @@ -[remap] - -importer="texture" -type="CompressedTexture2D" -uid="uid://y4ighq1hmfes" -path="res://.godot/imported/tileset.png-cb2f89c77c0d8231eced7af442399850.ctex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://scenes/main/tileset.png" -dest_files=["res://.godot/imported/tileset.png-cb2f89c77c0d8231eced7af442399850.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 diff --git a/game-source/scenes/player_character/player_character.gd b/game-source/scenes/player_character/player_character.gd index 862fad9..0aec7e5 100644 --- a/game-source/scenes/player_character/player_character.gd +++ b/game-source/scenes/player_character/player_character.gd @@ -11,12 +11,20 @@ var inputs = { "down": Vector2.DOWN } +var inputs_rev = { + Vector2.RIGHT:"right", + Vector2.LEFT: "left", + Vector2.UP: "up", + Vector2.DOWN: "down" +} + func _ready(): position = position.snapped(Vector2.ONE * tile_size) position += Vector2.ONE * tile_size / 2 func _input(event): var vec = Input.get_vector("left", "right", "up", "down") - if !is_moving and vec.length()==1: + if vec.length() == 1: position += vec*100 + $AnimationPlayer.play(inputs_rev[vec]) diff --git a/game-source/scenes/player_character/player_character.tscn b/game-source/scenes/player_character/player_character.tscn index 5a5fb90..6406c42 100644 --- a/game-source/scenes/player_character/player_character.tscn +++ b/game-source/scenes/player_character/player_character.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=4 format=3 uid="uid://xqoiyxrn10js"] +[gd_scene load_steps=8 format=3 uid="uid://xqoiyxrn10js"] [ext_resource type="Script" path="res://scenes/player_character/player_character.gd" id="1_rmbqt"] [ext_resource type="Texture2D" uid="uid://bdap4f6w37byq" path="res://assets/Illustration95.png" id="2_0gsa3"] @@ -6,20 +6,88 @@ [sub_resource type="RectangleShape2D" id="RectangleShape2D_nrvy8"] size = Vector2(14, 15.5) +[sub_resource type="Animation" id="Animation_17yri"] +resource_name = "walk" +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("../Sprite2D:frame") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0.00177135, 0.297301, 0.529481, 0.858887), +"transitions": PackedFloat32Array(1, 1, 1, 1), +"update": 1, +"values": [0, 1, 2, 0] +} + +[sub_resource type="Animation" id="Animation_sndo4"] +resource_name = "up" +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("../Sprite2D:frame") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0.00553417, 0.15295, 0.32358), +"transitions": PackedFloat32Array(1, 1, 1), +"update": 1, +"values": [3, 4, 5] +} + +[sub_resource type="Animation" id="Animation_v72g0"] +resource_name = "left" +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("../Sprite2D:frame") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0.0161553, 0.319068, 0.69064), +"transitions": PackedFloat32Array(1, 1, 1), +"update": 1, +"values": [6, 7, 8] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_hbknw"] +_data = { +"down": SubResource("Animation_17yri"), +"right": SubResource("Animation_v72g0"), +"up": SubResource("Animation_sndo4") +} + [node name="PlayerCharacter" type="CharacterBody2D"] script = ExtResource("1_rmbqt") +[node name="RayCast2D" type="RayCast2D" parent="."] +scale = Vector2(1, 1) +target_position = Vector2(0, 19) + [node name="Sprite2D" type="Sprite2D" parent="."] scale = Vector2(0.458, 0.368) texture = ExtResource("2_0gsa3") hframes = 3 vframes = 3 -frame = 3 [node name="Camera2D" type="Camera2D" parent="."] position_smoothing_enabled = true +position_smoothing_speed = 10.0 [node name="CollisionShape2D" type="CollisionShape2D" parent="."] position = Vector2(0, 2.38419e-07) scale = Vector2(-0.811343, 1.12881) shape = SubResource("RectangleShape2D_nrvy8") + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +root_node = NodePath("../RayCast2D") +libraries = { +"": SubResource("AnimationLibrary_hbknw") +} + +[node name="AnimationPlayer" type="AnimationPlayer" parent="AnimationPlayer"] +root_node = NodePath("../RayCast2D") +libraries = { +"": SubResource("AnimationLibrary_hbknw") +}