diff --git a/PlayerCharacter.png b/PlayerCharacter.png deleted file mode 100644 index f00b824..0000000 Binary files a/PlayerCharacter.png and /dev/null differ diff --git a/assets/export/stage1.png b/assets/export/stage1.png new file mode 100644 index 0000000..ab0cb7c Binary files /dev/null and b/assets/export/stage1.png differ diff --git a/PlayerCharacter.png.import b/assets/export/stage1.png.import similarity index 68% rename from PlayerCharacter.png.import rename to assets/export/stage1.png.import index 0350adb..4258827 100644 --- a/PlayerCharacter.png.import +++ b/assets/export/stage1.png.import @@ -2,16 +2,16 @@ importer="texture" type="CompressedTexture2D" -uid="uid://dvnohr8gjh56t" -path="res://.godot/imported/PlayerCharacter.png-ab2ae3be5ec39b25693dfd99826d05ab.ctex" +uid="uid://bynsxkfd4t4cn" +path="res://.godot/imported/stage1.png-c3fb8862b9a844ae4f643a865fe729ba.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://PlayerCharacter.png" -dest_files=["res://.godot/imported/PlayerCharacter.png-ab2ae3be5ec39b25693dfd99826d05ab.ctex"] +source_file="res://assets/export/stage1.png" +dest_files=["res://.godot/imported/stage1.png-c3fb8862b9a844ae4f643a865fe729ba.ctex"] [params] diff --git a/assets/stage1.aseprite b/assets/stage1.aseprite new file mode 100644 index 0000000..1dbb6f1 Binary files /dev/null and b/assets/stage1.aseprite differ diff --git a/assets/stage1.aseprite.import b/assets/stage1.aseprite.import new file mode 100644 index 0000000..58215d7 --- /dev/null +++ b/assets/stage1.aseprite.import @@ -0,0 +1,16 @@ +[remap] + +importer="aseprite_wizard.plugin.static-texture" +type="AtlasTexture" +uid="uid://fju2p8ssaled" +path="res://.godot/imported/stage1.aseprite-4be92de9d6e8d30b990f34fbdce9c3c1.res" + +[deps] + +source_file="res://assets/stage1.aseprite" +dest_files=["res://.godot/imported/stage1.aseprite-4be92de9d6e8d30b990f34fbdce9c3c1.res"] + +[params] + +exclude_layers_pattern="" +only_visible_layers=true diff --git a/Borders.tscn b/components/Borders.tscn similarity index 70% rename from Borders.tscn rename to components/Borders.tscn index a2ad457..bb3b816 100644 --- a/Borders.tscn +++ b/components/Borders.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=4 format=3 uid="uid://bab4ac3s2n0o1"] +[gd_scene load_steps=3 format=3 uid="uid://bab4ac3s2n0o1"] [sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_j1bt6"] normal = Vector2(1, 0) @@ -8,10 +8,6 @@ distance = -184.0 normal = Vector2(-1, 0) distance = -208.0 -[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_ogsi3"] -normal = Vector2(0, 1) -distance = -240.0 - [node name="Borders" type="Node2D"] [node name="Left" type="StaticBody2D" parent="."] @@ -33,10 +29,3 @@ position = Vector2(0, 72) [node name="CollisionShape2D" type="CollisionShape2D" parent="Right/Trigger"] position = Vector2(272, 264) shape = SubResource("WorldBoundaryShape2D_wodb0") - -[node name="Top" type="StaticBody2D" parent="."] -position = Vector2(-40, 0) - -[node name="CollisionShape2D" type="CollisionShape2D" parent="Top"] -position = Vector2(272, 240) -shape = SubResource("WorldBoundaryShape2D_ogsi3") diff --git a/Player.tscn b/components/Player.tscn similarity index 99% rename from Player.tscn rename to components/Player.tscn index 6b60317..145b3e1 100644 --- a/Player.tscn +++ b/components/Player.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=37 format=3 uid="uid://cjiuycwqqxaxn"] -[ext_resource type="Script" path="res://player.gd" id="1_oy25y"] +[ext_resource type="Script" path="res://scripts/player.gd" id="1_oy25y"] [ext_resource type="Texture2D" uid="uid://cownabyc1p26u" path="res://assets/export/playerLayer 3.png" id="2_5c6qp"] [sub_resource type="AtlasTexture" id="AtlasTexture_unh28"] diff --git a/export_presets.cfg b/export_presets.cfg new file mode 100644 index 0000000..2c16fb9 --- /dev/null +++ b/export_presets.cfg @@ -0,0 +1,64 @@ +[preset.0] + +name="Windows Desktop" +platform="Windows Desktop" +runnable=true +advanced_options=false +dedicated_server=false +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="./claustrophemia.exe" +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="" +debug/export_console_wrapper=0 +binary_format/embed_pck=false +texture_format/s3tc_bptc=true +texture_format/etc2_astc=false +binary_format/architecture="x86_64" +codesign/enable=false +codesign/timestamp=true +codesign/timestamp_server_url="" +codesign/digest_algorithm=1 +codesign/description="" +codesign/custom_options=PackedStringArray() +application/modify_resources=true +application/icon="" +application/console_wrapper_icon="" +application/icon_interpolation=4 +application/file_version="" +application/product_version="" +application/company_name="" +application/product_name="" +application/file_description="" +application/copyright="" +application/trademarks="" +application/export_angle=0 +application/export_d3d12=0 +application/d3d12_agility_sdk_multiarch=true +ssh_remote_deploy/enabled=false +ssh_remote_deploy/host="user@host_ip" +ssh_remote_deploy/port="22" +ssh_remote_deploy/extra_args_ssh="" +ssh_remote_deploy/extra_args_scp="" +ssh_remote_deploy/run_script="Expand-Archive -LiteralPath '{temp_dir}\\{archive_name}' -DestinationPath '{temp_dir}' +$action = New-ScheduledTaskAction -Execute '{temp_dir}\\{exe_name}' -Argument '{cmd_args}' +$trigger = New-ScheduledTaskTrigger -Once -At 00:00 +$settings = New-ScheduledTaskSettingsSet +$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings +Register-ScheduledTask godot_remote_debug -InputObject $task -Force:$true +Start-ScheduledTask -TaskName godot_remote_debug +while (Get-ScheduledTask -TaskName godot_remote_debug | ? State -eq running) { Start-Sleep -Milliseconds 100 } +Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue" +ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue +Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue +Remove-Item -Recurse -Force '{temp_dir}'" diff --git a/levels/level1/stage1.tscn b/levels/level1/stage1.tscn index f195f5c..0a11c60 100644 --- a/levels/level1/stage1.tscn +++ b/levels/level1/stage1.tscn @@ -1,32 +1,49 @@ -[gd_scene load_steps=6 format=3 uid="uid://cei5gjgfoginb"] +[gd_scene load_steps=7 format=3 uid="uid://cei5gjgfoginb"] -[ext_resource type="Script" path="res://stageController.gd" id="1_m1n7w"] -[ext_resource type="PackedScene" uid="uid://cjiuycwqqxaxn" path="res://Player.tscn" id="2_sxo5w"] -[ext_resource type="PackedScene" uid="uid://bab4ac3s2n0o1" path="res://Borders.tscn" id="3_04xvl"] +[ext_resource type="Script" path="res://scripts/stageController.gd" id="1_m1n7w"] +[ext_resource type="Texture2D" uid="uid://bynsxkfd4t4cn" path="res://assets/export/stage1.png" id="2_48003"] +[ext_resource type="PackedScene" uid="uid://cjiuycwqqxaxn" path="res://components/Player.tscn" id="2_sxo5w"] +[ext_resource type="PackedScene" uid="uid://bab4ac3s2n0o1" path="res://components/Borders.tscn" id="3_04xvl"] [sub_resource type="QuadMesh" id="QuadMesh_seics"] size = Vector2(480, 64) [sub_resource type="RectangleShape2D" id="RectangleShape2D_h5wua"] -size = Vector2(480, 66) +size = Vector2(480, 106) [node name="World" type="Node2D"] position = Vector2(272, 240) script = ExtResource("1_m1n7w") next_stage = "res://levels/level1/stage2.tscn" -[node name="Player" parent="." instance=ExtResource("2_sxo5w")] -position = Vector2(-192, 0) +[node name="Background" type="Sprite2D" parent="."] +position = Vector2(-32, -64) +texture = ExtResource("2_48003") [node name="Borders" parent="." instance=ExtResource("3_04xvl")] position = Vector2(-272, -240) +[node name="Player" parent="." instance=ExtResource("2_sxo5w")] +position = Vector2(-240, -16) + [node name="Floor" type="StaticBody2D" parent="."] [node name="MeshInstance2D" type="MeshInstance2D" parent="Floor"] -position = Vector2(-32, 88) +position = Vector2(-32, 68) +scale = Vector2(1, 1.625) mesh = SubResource("QuadMesh_seics") [node name="CollisionShape2D" type="CollisionShape2D" parent="Floor"] -position = Vector2(-32, 89) +position = Vector2(-32, 69) +shape = SubResource("RectangleShape2D_h5wua") + +[node name="Ceiling" type="StaticBody2D" parent="."] + +[node name="MeshInstance2D" type="MeshInstance2D" parent="Ceiling"] +position = Vector2(-32, -192) +scale = Vector2(1, 1.625) +mesh = SubResource("QuadMesh_seics") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Ceiling"] +position = Vector2(-32, -192) shape = SubResource("RectangleShape2D_h5wua") diff --git a/levels/level1/stage2.tscn b/levels/level1/stage2.tscn index f9aa683..2c53ff8 100644 --- a/levels/level1/stage2.tscn +++ b/levels/level1/stage2.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=2 format=3 uid="uid://cnpspjqlc7b52"] -[ext_resource type="Script" path="res://stageController.gd" id="1_0rodf"] +[ext_resource type="Script" path="res://scripts/stageController.gd" id="1_0rodf"] [node name="World" type="Node2D"] script = ExtResource("1_0rodf") diff --git a/player.gd b/player.gd deleted file mode 100644 index b7d2433..0000000 --- a/player.gd +++ /dev/null @@ -1,38 +0,0 @@ -extends CharacterBody2D - -@export var SPEED = 300 -@export var GRAVITY = 30 -@export var JUMP_FORCE = 500 - -@onready var animated_sprite = $AnimatedSprite2D; - -var jumping = false; - -func _ready(): - animated_sprite.play("idle") - -func _physics_process(delta): - if !is_on_floor(): - velocity.y += GRAVITY - if velocity.y > 1000: - velocity.y = 1000 - - if jumping && is_on_floor(): - jumping = false - - if Input.is_action_just_pressed("jump") && is_on_floor(): - velocity.y = -JUMP_FORCE - jumping = true - animated_sprite.play("jump") - - var horizontal_direction = Input.get_axis("move_left", "move_right") - velocity.x = SPEED * horizontal_direction - move_and_slide() - - animated_sprite.flip_h = horizontal_direction < 0 - - if !jumping: - if is_on_floor() && horizontal_direction != 0: - animated_sprite.play("walk") - else: - animated_sprite.play("idle") diff --git a/project.godot b/project.godot index 52de13c..a23dcd6 100644 --- a/project.godot +++ b/project.godot @@ -14,18 +14,23 @@ config/name="claustrophemia" config/version="0.0.1" run/main_scene="res://levels/level1/stage1.tscn" config/features=PackedStringArray("4.3", "Forward Plus") +boot_splash/show_image=false config/icon="res://icon.svg" [aseprite] animation/layers/only_include_visible_layers_by_default=true -import/import_plugin/default_automatic_importer="SpriteFrames" + +[autoload] + +GlobalKeybinds="*res://scripts/globalKeybinds.gd" [display] window/size/viewport_width=480 window/size/viewport_height=360 window/stretch/mode="canvas_items" +window/vsync/vsync_mode=0 [editor] @@ -62,3 +67,13 @@ trigger_completed={ "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":4194323,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) ] } +toggle_fullscreen={ +"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":4194342,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +] +} +quit={ +"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":4194305,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +] +} diff --git a/scripts/globalKeybinds.gd b/scripts/globalKeybinds.gd new file mode 100644 index 0000000..c811ddf --- /dev/null +++ b/scripts/globalKeybinds.gd @@ -0,0 +1,16 @@ +extends Node + +var previous_window_mode = -1 + +func _process(delta: float) -> void: + if Input.is_action_just_pressed("toggle_fullscreen"): + if get_window().mode == Window.MODE_FULLSCREEN: + if previous_window_mode != -1: + get_window().mode = previous_window_mode + else: + get_window().mode = Window.MODE_MAXIMIZED + else: + previous_window_mode = get_window().mode + get_window().mode = Window.MODE_FULLSCREEN + elif Input.is_action_just_pressed("quit"): + get_tree().quit() diff --git a/scripts/player.gd b/scripts/player.gd new file mode 100644 index 0000000..ddf8032 --- /dev/null +++ b/scripts/player.gd @@ -0,0 +1,51 @@ +extends CharacterBody2D + +@export var SPEED = 300 +@export var GRAVITY = 30 +@export var JUMP_FORCE = 500 + +@onready var animated_sprite = $AnimatedSprite2D; + +var jumping = false; +var facing_right = true; + +func _ready(): + animated_sprite.play("idle") + +func _physics_process(delta): + if is_on_floor(): + # allow the player to jump + if jumping: + jumping = false + + if Input.is_action_just_pressed("jump"): + velocity.y = -JUMP_FORCE + jumping = true + animated_sprite.play("jump") + else: + # apply gravity + velocity.y += GRAVITY + if velocity.y > 1000: + velocity.y = 1000 + + # perform horizontal movement + var horizontal_direction = Input.get_axis("move_left", "move_right") + velocity.x = SPEED * horizontal_direction + move_and_slide() + + # ensure the player faces the correct direction + if horizontal_direction > 0 && !facing_right: + animated_sprite.flip_h = false + elif horizontal_direction < 0 && facing_right: + animated_sprite.flip_h = true + + if horizontal_direction != 0: + facing_right = horizontal_direction > 0 + + # figure out which animation should be played + # respecting the jump animation above all + if !jumping: + if is_on_floor() && horizontal_direction != 0: + animated_sprite.play("walk") + else: + animated_sprite.play("idle") diff --git a/stageController.gd b/scripts/stageController.gd similarity index 100% rename from stageController.gd rename to scripts/stageController.gd