diff --git a/Assets/Player/Player.ase b/Assets/Player/Player.ase new file mode 100644 index 0000000..0ad604a Binary files /dev/null and b/Assets/Player/Player.ase differ diff --git a/Assets/Player/Player.ase.import b/Assets/Player/Player.ase.import new file mode 100644 index 0000000..fe25ccb --- /dev/null +++ b/Assets/Player/Player.ase.import @@ -0,0 +1,14 @@ +[remap] + +importer="aseprite_wizard.plugin.noop" +type="PackedDataContainer" +uid="uid://c0p830yfqmsu3" +path="res://.godot/imported/Player.ase-327f2691d292d3d2542bc4967ad2e2d6.res" + +[deps] + +source_file="res://Assets/Player/Player.ase" +dest_files=["res://.godot/imported/Player.ase-327f2691d292d3d2542bc4967ad2e2d6.res"] + +[params] + diff --git a/Assets/Player/Player.png b/Assets/Player/Player.png new file mode 100644 index 0000000..8cc6315 Binary files /dev/null and b/Assets/Player/Player.png differ diff --git a/Assets/Player/Player.png.import b/Assets/Player/Player.png.import new file mode 100644 index 0000000..be8bcb4 --- /dev/null +++ b/Assets/Player/Player.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b2xbgtcyxvi73" +path="res://.godot/imported/Player.png-1cdd804a9b0fdcfc546bbabf40de7758.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Player/Player.png" +dest_files=["res://.godot/imported/Player.png-1cdd804a9b0fdcfc546bbabf40de7758.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/Assets/Tilemaps/Floor.png.import b/Assets/Tilemaps/Floor.png.import new file mode 100644 index 0000000..1bcfaa6 --- /dev/null +++ b/Assets/Tilemaps/Floor.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://tiulht2m5b24" +path="res://.godot/imported/Floor.png-eb0d8e7badb1675ed9f141870f8d4783.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Tilemaps/Floor.png" +dest_files=["res://.godot/imported/Floor.png-eb0d8e7badb1675ed9f141870f8d4783.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/Assets/Tilemaps/FloorHexago.ase b/Assets/Tilemaps/FloorHexago.ase new file mode 100644 index 0000000..3b5aff0 Binary files /dev/null and b/Assets/Tilemaps/FloorHexago.ase differ diff --git a/Assets/Tilemaps/FloorHexago.ase.import b/Assets/Tilemaps/FloorHexago.ase.import new file mode 100644 index 0000000..dbee093 --- /dev/null +++ b/Assets/Tilemaps/FloorHexago.ase.import @@ -0,0 +1,14 @@ +[remap] + +importer="aseprite_wizard.plugin.noop" +type="PackedDataContainer" +uid="uid://ducrqbus0jmt8" +path="res://.godot/imported/FloorHexago.ase-d08ee98c6b9c72f48243da2ce975e93d.res" + +[deps] + +source_file="res://Assets/Tilemaps/FloorHexago.ase" +dest_files=["res://.godot/imported/FloorHexago.ase-d08ee98c6b9c72f48243da2ce975e93d.res"] + +[params] + diff --git a/Assets/Tilemaps/FloorHexago.png b/Assets/Tilemaps/FloorHexago.png new file mode 100644 index 0000000..309ba36 Binary files /dev/null and b/Assets/Tilemaps/FloorHexago.png differ diff --git a/Assets/Tilemaps/FloorHexago.png.import b/Assets/Tilemaps/FloorHexago.png.import new file mode 100644 index 0000000..1a6ce3d --- /dev/null +++ b/Assets/Tilemaps/FloorHexago.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c6yle2kbtbe2h" +path="res://.godot/imported/FloorHexago.png-c91424975b38e46ce438a950b0f72a74.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Tilemaps/FloorHexago.png" +dest_files=["res://.godot/imported/FloorHexago.png-c91424975b38e46ce438a950b0f72a74.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/Assets/Tilemaps/FloorHexago.tres b/Assets/Tilemaps/FloorHexago.tres new file mode 100644 index 0000000..e287947 --- /dev/null +++ b/Assets/Tilemaps/FloorHexago.tres @@ -0,0 +1,21 @@ +[gd_resource type="TileSet" load_steps=4 format=3 uid="uid://dxngauus5lurh"] + +[ext_resource type="Texture2D" uid="uid://tiulht2m5b24" path="res://Assets/Tilemaps/Floor.png" id="1_sbmhw"] + +[sub_resource type="NavigationPolygon" id="NavigationPolygon_uxv2c"] +vertices = PackedVector2Array(16, -8, 16, 8, 0, 16, -16, 8, -16, -8, 0, -16) +polygons = Array[PackedInt32Array]([PackedInt32Array(0, 1, 2, 3, 4, 5)]) +outlines = Array[PackedVector2Array]([PackedVector2Array(0, -16, -16, -8, -16, 8, 0, 16, 16, 8, 16, -8)]) +agent_radius = 0.0 + +[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_pbnxo"] +texture = ExtResource("1_sbmhw") +texture_region_size = Vector2i(32, 32) +0:0/0 = 0 +0:0/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_uxv2c") + +[resource] +tile_shape = 3 +tile_size = Vector2i(32, 32) +navigation_layer_0/layers = 1 +sources/0 = SubResource("TileSetAtlasSource_pbnxo") diff --git a/Assets/Tilemaps/Wall.png.import b/Assets/Tilemaps/Wall.png.import new file mode 100644 index 0000000..a076b89 --- /dev/null +++ b/Assets/Tilemaps/Wall.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c7fq0sv3tn88s" +path="res://.godot/imported/Wall.png-46e1e62d0954071fbcae8ddbd4292afc.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Tilemaps/Wall.png" +dest_files=["res://.godot/imported/Wall.png-46e1e62d0954071fbcae8ddbd4292afc.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/Assets/Tilemaps/WallHexagon.ase b/Assets/Tilemaps/WallHexagon.ase new file mode 100644 index 0000000..95a843d Binary files /dev/null and b/Assets/Tilemaps/WallHexagon.ase differ diff --git a/Assets/Tilemaps/WallHexagon.ase.import b/Assets/Tilemaps/WallHexagon.ase.import new file mode 100644 index 0000000..b0782b7 --- /dev/null +++ b/Assets/Tilemaps/WallHexagon.ase.import @@ -0,0 +1,14 @@ +[remap] + +importer="aseprite_wizard.plugin.noop" +type="PackedDataContainer" +uid="uid://c0phfcmfmh6k3" +path="res://.godot/imported/WallHexagon.ase-eede65226ecdbd82fe805729950b02eb.res" + +[deps] + +source_file="res://Assets/Tilemaps/WallHexagon.ase" +dest_files=["res://.godot/imported/WallHexagon.ase-eede65226ecdbd82fe805729950b02eb.res"] + +[params] + diff --git a/Assets/Tilemaps/WallHexagon.png b/Assets/Tilemaps/WallHexagon.png new file mode 100644 index 0000000..b3e21fa Binary files /dev/null and b/Assets/Tilemaps/WallHexagon.png differ diff --git a/Assets/Tilemaps/WallHexagon.png.import b/Assets/Tilemaps/WallHexagon.png.import new file mode 100644 index 0000000..6f95481 --- /dev/null +++ b/Assets/Tilemaps/WallHexagon.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bas12neil84t3" +path="res://.godot/imported/WallHexagon.png-72a945adebe9892b4fc2def9e4c26eeb.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Tilemaps/WallHexagon.png" +dest_files=["res://.godot/imported/WallHexagon.png-72a945adebe9892b4fc2def9e4c26eeb.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/Assets/Tilemaps/WallHexagon.tres b/Assets/Tilemaps/WallHexagon.tres new file mode 100644 index 0000000..7d8d294 --- /dev/null +++ b/Assets/Tilemaps/WallHexagon.tres @@ -0,0 +1,74 @@ +[gd_resource type="TileSet" load_steps=10 format=3 uid="uid://beqxnvupuy2rk"] + +[ext_resource type="Texture2D" uid="uid://c7fq0sv3tn88s" path="res://Assets/Tilemaps/Wall.png" id="1_s3a4i"] + +[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_ksoke"] + +[sub_resource type="NavigationPolygon" id="NavigationPolygon_epnhj"] +vertices = PackedVector2Array(16, -8, 16, 8, 0, 16, -16, 8, -16, -8, 0, -16) +polygons = Array[PackedInt32Array]([PackedInt32Array(0, 1, 2, 3, 4, 5)]) +outlines = Array[PackedVector2Array]([PackedVector2Array(-16, -8, 0, -16, 16, -8, 16, 8, 0, 16, -16, 8)]) +agent_radius = 0.0 + +[sub_resource type="NavigationPolygon" id="NavigationPolygon_jioix"] +vertices = PackedVector2Array(0, 16, -16, 8, -16, -8, 0, -16) +polygons = Array[PackedInt32Array]([PackedInt32Array(0, 1, 2, 3)]) +outlines = Array[PackedVector2Array]([PackedVector2Array(0, -16, -16, -8, -16, 8, 0, 16)]) +agent_radius = 0.0 + +[sub_resource type="NavigationPolygon" id="NavigationPolygon_osy5n"] +vertices = PackedVector2Array(16, -8, 16, 8, 1.79688, 15.1016, -16, 8, -16, -8, 0, -16) +polygons = Array[PackedInt32Array]([PackedInt32Array(0, 1, 2, 3, 4, 5)]) +outlines = Array[PackedVector2Array]([PackedVector2Array(0, -16, 16, -8, 16, 8, 1.8, 15.1, -16, 8, -16, -8)]) +agent_radius = 0.0 + +[sub_resource type="NavigationPolygon" id="NavigationPolygon_thqwj"] +vertices = PackedVector2Array(16, -8, 16, 8, 0, 16, 0, -16) +polygons = Array[PackedInt32Array]([PackedInt32Array(0, 1, 2, 3)]) +outlines = Array[PackedVector2Array]([PackedVector2Array(0, -16, 16, -8, 16, 8, 0, 16)]) +agent_radius = 0.0 + +[sub_resource type="NavigationPolygon" id="NavigationPolygon_tofi5"] +vertices = PackedVector2Array(16, -8, -16, -8, 0, -16) +polygons = Array[PackedInt32Array]([PackedInt32Array(0, 1, 2)]) +outlines = Array[PackedVector2Array]([PackedVector2Array(-16, -8, 0, -16, 16, -8)]) +agent_radius = 0.0 + +[sub_resource type="NavigationPolygon" id="NavigationPolygon_dalg8"] +vertices = PackedVector2Array(0, 16, -16, 8, 16, 8) +polygons = Array[PackedInt32Array]([PackedInt32Array(0, 1, 2)]) +outlines = Array[PackedVector2Array]([PackedVector2Array(-16, 8, 0, 16, 16, 8)]) +agent_radius = 0.0 + +[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_kqjqa"] +texture = ExtResource("1_s3a4i") +texture_region_size = Vector2i(32, 32) +0:0/next_alternative_id = 3 +0:0/0 = 0 +0:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(0, -16, -16, -8, -16, 8, 0, 16, 16, 8, 16, -8) +0:0/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_epnhj") +1:0/0 = 0 +1:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -8, 0, -16, 16, -8, 16, 8, 0, 16, -16, 8) +1:0/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_osy5n") +0:1/0 = 0 +0:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(0, -16, 0, 16, -16, 8, -16, -8) +0:1/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_jioix") +1:1/0 = 0 +1:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(0, -16, 16, -8, 16, 8, 0, 16) +1:1/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_thqwj") +2:1/0 = 0 +2:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(0, -16, -16, -8, 16, -8) +2:1/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_tofi5") +3:1/0 = 0 +3:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, 8, 0, 16, 16, 8) +3:1/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_dalg8") +2:0/0 = 0 + +[resource] +tile_shape = 3 +tile_size = Vector2i(32, 32) +physics_layer_0/collision_layer = 1 +physics_layer_0/collision_mask = 2 +physics_layer_0/physics_material = SubResource("PhysicsMaterial_ksoke") +navigation_layer_0/layers = 2 +sources/0 = SubResource("TileSetAtlasSource_kqjqa") diff --git a/Assets/Tilemaps/Walls.ase b/Assets/Tilemaps/Walls.ase new file mode 100644 index 0000000..97c4f73 Binary files /dev/null and b/Assets/Tilemaps/Walls.ase differ diff --git a/Assets/Tilemaps/Walls.ase.import b/Assets/Tilemaps/Walls.ase.import new file mode 100644 index 0000000..21d6221 --- /dev/null +++ b/Assets/Tilemaps/Walls.ase.import @@ -0,0 +1,14 @@ +[remap] + +importer="aseprite_wizard.plugin.noop" +type="PackedDataContainer" +uid="uid://8nakjbmxfybw" +path="res://.godot/imported/Walls.ase-3e27fd0f4db2952123bde42b18b33d12.res" + +[deps] + +source_file="res://Assets/Tilemaps/Walls.ase" +dest_files=["res://.godot/imported/Walls.ase-3e27fd0f4db2952123bde42b18b33d12.res"] + +[params] + diff --git a/Assets/Tilemaps/Walls.png b/Assets/Tilemaps/Walls.png new file mode 100644 index 0000000..17f9f69 Binary files /dev/null and b/Assets/Tilemaps/Walls.png differ diff --git a/Assets/Tilemaps/Walls.png.import b/Assets/Tilemaps/Walls.png.import new file mode 100644 index 0000000..9f604bc --- /dev/null +++ b/Assets/Tilemaps/Walls.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://co3t2vwnd185g" +path="res://.godot/imported/Walls.png-c4d75ce7a92fff5362d6eb632d3e487c.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Tilemaps/Walls.png" +dest_files=["res://.godot/imported/Walls.png-c4d75ce7a92fff5362d6eb632d3e487c.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/Assets/Tilemaps/Walls.tres b/Assets/Tilemaps/Walls.tres new file mode 100644 index 0000000..51eb127 --- /dev/null +++ b/Assets/Tilemaps/Walls.tres @@ -0,0 +1,26 @@ +[gd_resource type="TileSet" load_steps=4 format=3 uid="uid://64vn4umcy2ke"] + +[ext_resource type="Texture2D" uid="uid://co3t2vwnd185g" path="res://Assets/Tilemaps/Walls.png" id="1_udimy"] + +[sub_resource type="NavigationPolygon" id="NavigationPolygon_51bnv"] +vertices = PackedVector2Array(16, 16, -16, 16, -16, -16, 16, -16) +polygons = Array[PackedInt32Array]([PackedInt32Array(0, 1, 2, 3)]) +outlines = Array[PackedVector2Array]([PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)]) +agent_radius = 0.0 + +[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_dgfr3"] +texture = ExtResource("1_udimy") +texture_region_size = Vector2i(32, 32) +0:0/0 = 0 +0:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16) +0:0/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_51bnv") +1:0/0 = 0 +0:1/0 = 0 +1:1/0 = 0 + +[resource] +tile_size = Vector2i(32, 32) +physics_layer_0/collision_layer = 1 +physics_layer_0/collision_mask = 2 +navigation_layer_0/layers = 2 +sources/0 = SubResource("TileSetAtlasSource_dgfr3") diff --git a/project.godot b/project.godot index ef8bfb5..c2db1e7 100644 --- a/project.godot +++ b/project.godot @@ -13,16 +13,47 @@ config_version=5 config/name="brackeysGameJam2024.2" config/version="0.0.0" config/tags=PackedStringArray("game_jam") -run/main_scene="res://scenes/game/mainGame/main_game.tscn" +run/main_scene="res://scenes/main/main.tscn" config/features=PackedStringArray("4.3", "GL Compatibility") boot_splash/image="res://Assets/Spash Screen.png" config/icon="res://icon.svg" +[autoload] + +G="*res://scenes/GLOBAL.gd" +DebugMenu="*res://addons/debug_menu/debug_menu.tscn" + +[display] + +window/size/viewport_width=1920 +window/size/viewport_height=1080 +window/size/mode=2 +window/stretch/mode="canvas_items" +window/stretch/aspect="expand" + [editor] version_control/plugin_name="GitPlugin" version_control/autoload_on_startup=true +[editor_plugins] + +enabled=PackedStringArray("res://addons/debug_menu/plugin.cfg") + +[global_group] + +Entity="A Entity" +Player="A Player" + +[importer_defaults] + +aseprite_wizard.plugin={ +"exclude_layers_pattern": "", +"only_visible_layers": true, +"sheet_type": "Packed", +"split_layers": true +} + [input] MOVE_UP={ @@ -78,6 +109,22 @@ ROLL={ locale/translations=PackedStringArray("res://translations/translations.de.translation", "res://translations/translations.en.translation") +[layer_names] + +2d_physics/layer_1="Map" +2d_navigation/layer_1="Floor" +2d_physics/layer_2="Entity" +2d_navigation/layer_2="Wall" +2d_physics/layer_3="Object" +2d_physics/layer_4="EntityHitbox" +2d_physics/layer_5="DamageHitbox" + +[physics] + +common/physics_jitter_fix=1.0 +common/physics_interpolation=true + [rendering] +textures/canvas_textures/default_texture_filter=0 textures/vram_compression/import_etc2_astc=true diff --git a/scenes/GLOBAL.gd b/scenes/GLOBAL.gd new file mode 100644 index 0000000..fd43086 --- /dev/null +++ b/scenes/GLOBAL.gd @@ -0,0 +1,4 @@ +extends Node + +func resetValues(): + pass diff --git a/scenes/game/entities/entity.gd b/scenes/game/entities/entity.gd new file mode 100644 index 0000000..b5de175 --- /dev/null +++ b/scenes/game/entities/entity.gd @@ -0,0 +1,47 @@ +extends CharacterBody2D + +## Signal for when the entity dies +signal death +## Signal for when the entity gets damaged +signal damaged +## Signal for when the entity gets healed +signal healed + +## The maximal possible amount of Health for the Entity +@export_range(1,100) var maxHealth = 10 + +## The maximal possible Speed of the Entity +@export_range(100,500) var maxSpeed = 200 +## The normal Speed between Min and Max +@export_range(100,500) var normalSpeed = 100 +## The lowest possible Speed of the Entity +@export_range(100,500) var minSpeed = 50 + +## Acceleration of the Entity +@export_range(100,500) var acceleration = 10 + +@onready var health = maxHealth +@onready var speed = normalSpeed +var invincible = false + +func hit(damage : int) -> void: + health -= damage + damaged.emit() + if health <= 0: + health = 0 + death.emit() + +func heal(heal : int) -> void: + health += heal + healed.emit() + if health >= maxHealth: + health = maxHealth + +func resetSpeed(): + speed = normalSpeed + +func resetHealth(): + health = health + +func setSpeed(n): + speed = n diff --git a/scenes/game/entities/entity.tscn b/scenes/game/entities/entity.tscn new file mode 100644 index 0000000..bc9212a --- /dev/null +++ b/scenes/game/entities/entity.tscn @@ -0,0 +1,17 @@ +[gd_scene load_steps=2 format=3 uid="uid://b18cf4i8v6a1"] + +[ext_resource type="Script" path="res://scenes/game/entities/entity.gd" id="1_s7hj7"] + +[node name="Entity" type="CharacterBody2D" groups=["Entity"]] +collision_layer = 2 +script = ExtResource("1_s7hj7") + +[node name="Area2D" type="Area2D" parent="." groups=["Entity"]] +collision_layer = 8 +collision_mask = 16 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] + +[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] diff --git a/scenes/game/entities/player/player.gd b/scenes/game/entities/player/player.gd new file mode 100644 index 0000000..97b973c --- /dev/null +++ b/scenes/game/entities/player/player.gd @@ -0,0 +1,78 @@ +extends "res://scenes/game/entities/entity.gd" + +@onready var rollTimer = $RollTimer +@onready var rollCooldownTimer = $RollCooldownTimer + +@onready var animatedSprite = $AnimatedSprite2D + +var rollSpeed = maxSpeed * 5 + +const rollCooldown = 5.0 +const rollTime = 0.4 + +var rolling = false + +var canRoll = true + +var lastDirection : Vector2 +var lastdirectionVector : Vector2 + +func _physics_process(delta: float) -> void: + + var direction : Vector2 = Input.get_vector("MOVE_LEFT", "MOVE_RIGHT", "MOVE_UP", "MOVE_DOWN").normalized() + #var direction : Vector2 = Vector2( + #Input.get_action_strength("MOVE_RIGHT") - Input.get_action_strength("MOVE_LEFT"), + #Input.get_action_strength("MOVE_DOWN") - Input.get_action_strength("MOVE_UP") + #) + var directionVector : Vector2 = position.direction_to(position + direction) + + if direction != Vector2.ZERO and not rolling: + lastDirection = direction + lastdirectionVector = directionVector + if Input.is_action_just_pressed("ROLL") and lastDirection != Vector2.ZERO: + roll() + if rolling: + move(lastdirectionVector * speed, acceleration) + else: + move(directionVector * speed, acceleration) + setAnimation() + move_and_slide() + +func move(newVelocity : Vector2, acc): + velocity.x = move_toward(velocity.x, + newVelocity.x, + acc) + velocity.y = move_toward(velocity.y, + newVelocity.y, + acc) + +func roll(): + if not rolling and canRoll: + canRoll = false + setSpeed(rollSpeed) + invincible = true + rolling = true + rollTimer.start(rollTime) + +func _on_roll_timeout() -> void: + resetSpeed() + invincible = false + rolling = false + rollCooldownTimer.start(rollCooldown) + + +func _on_roll_cooldown_timer_timeout() -> void: + canRoll = true + +func setAnimation(): + if not rolling: + if Input.is_action_pressed("MOVE_LEFT") and not Input.is_action_pressed("MOVE_RIGHT") and animatedSprite.animation != "LEFT": + animatedSprite.play("LEFT") + elif Input.is_action_pressed("MOVE_RIGHT") and not Input.is_action_pressed("MOVE_LEFT") and animatedSprite.animation != "RIGHT": + animatedSprite.play("RIGHT") + elif Input.is_action_pressed("MOVE_UP") and animatedSprite.animation != "UP" and not Input.is_action_pressed("MOVE_LEFT") and not Input.is_action_pressed("MOVE_RIGHT"): + animatedSprite.play("UP") + elif Input.is_action_pressed("MOVE_DOWN") and animatedSprite.animation != "DOWN" and not Input.is_action_pressed("MOVE_LEFT") and not Input.is_action_pressed("MOVE_RIGHT"): + animatedSprite.play("DOWN") + elif not (Input.is_action_pressed("MOVE_UP") or Input.is_action_pressed("MOVE_RIGHT") or Input.is_action_pressed("MOVE_DOWN") or Input.is_action_pressed("MOVE_LEFT")): + animatedSprite.play("IDLE") diff --git a/scenes/game/entities/player/player.tres b/scenes/game/entities/player/player.tres new file mode 100644 index 0000000..ea24f78 --- /dev/null +++ b/scenes/game/entities/player/player.tres @@ -0,0 +1,101 @@ +[gd_resource type="SpriteFrames" load_steps=12 format=3 uid="uid://dv18sf3aj0n1h"] + +[ext_resource type="Texture2D" uid="uid://b2xbgtcyxvi73" path="res://Assets/Player/Player.png" id="1_21ptg"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_m3bgq"] +atlas = ExtResource("1_21ptg") +region = Rect2(0, 64, 16, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_6rhbk"] +atlas = ExtResource("1_21ptg") +region = Rect2(16, 64, 16, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_51ijx"] +atlas = ExtResource("1_21ptg") +region = Rect2(0, 0, 16, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ydp1x"] +atlas = ExtResource("1_21ptg") +region = Rect2(16, 0, 16, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_l7ggo"] +atlas = ExtResource("1_21ptg") +region = Rect2(0, 128, 16, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_404j7"] +atlas = ExtResource("1_21ptg") +region = Rect2(16, 128, 16, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_csdks"] +atlas = ExtResource("1_21ptg") +region = Rect2(0, 96, 16, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_yahsm"] +atlas = ExtResource("1_21ptg") +region = Rect2(16, 96, 16, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_8pkt3"] +atlas = ExtResource("1_21ptg") +region = Rect2(0, 32, 16, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_rq2en"] +atlas = ExtResource("1_21ptg") +region = Rect2(16, 32, 16, 32) + +[resource] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_m3bgq") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_6rhbk") +}], +"loop": true, +"name": &"DOWN", +"speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_51ijx") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ydp1x") +}], +"loop": true, +"name": &"IDLE", +"speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_l7ggo") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_404j7") +}], +"loop": true, +"name": &"LEFT", +"speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_csdks") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_yahsm") +}], +"loop": true, +"name": &"RIGHT", +"speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_8pkt3") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_rq2en") +}], +"loop": true, +"name": &"UP", +"speed": 5.0 +}] diff --git a/scenes/game/entities/player/player.tscn b/scenes/game/entities/player/player.tscn new file mode 100644 index 0000000..c468f82 --- /dev/null +++ b/scenes/game/entities/player/player.tscn @@ -0,0 +1,56 @@ +[gd_scene load_steps=6 format=3 uid="uid://0duodsosmfpq"] + +[ext_resource type="PackedScene" uid="uid://b18cf4i8v6a1" path="res://scenes/game/entities/entity.tscn" id="1_kmfws"] +[ext_resource type="Script" path="res://scenes/game/entities/player/player.gd" id="2_s0pfn"] +[ext_resource type="SpriteFrames" uid="uid://dv18sf3aj0n1h" path="res://scenes/game/entities/player/player.tres" id="3_mlsai"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_gk017"] +size = Vector2(16, 16) + +[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_upmug"] +radius = 8.0 +height = 16.0 + +[node name="Player" groups=["Player"] instance=ExtResource("1_kmfws")] +script = ExtResource("2_s0pfn") + +[node name="Area2D" parent="." index="0" groups=["Player"]] + +[node name="CollisionShape2D" parent="Area2D" index="0"] +position = Vector2(0, 8) +shape = SubResource("RectangleShape2D_gk017") + +[node name="CollisionShape2D" parent="." index="1"] +position = Vector2(0, 8) +shape = SubResource("CapsuleShape2D_upmug") + +[node name="AnimatedSprite2D" parent="." index="2"] +sprite_frames = ExtResource("3_mlsai") +animation = &"DOWN" +metadata/_aseprite_wizard_config_ = { +"layer": "", +"o_ex_p": "", +"o_folder": "", +"o_name": "", +"only_visible": false, +"slice": "", +"source": "res://Assets/Player/Player.ase" +} +metadata/_aseprite_wizard_interface_config_ = { +"layer_section": false, +"slice_section": false +} + +[node name="Camera2D" type="Camera2D" parent="." index="3"] +zoom = Vector2(3, 3) +limit_smoothed = true +position_smoothing_enabled = true + +[node name="RollTimer" type="Timer" parent="." index="4"] +one_shot = true + +[node name="RollCooldownTimer" type="Timer" parent="." index="5"] +one_shot = true + +[connection signal="timeout" from="RollTimer" to="." method="_on_roll_timeout"] +[connection signal="timeout" from="RollCooldownTimer" to="." method="_on_roll_cooldown_timer_timeout"] diff --git a/scenes/game/mainGame/main_game.gd b/scenes/game/mainGame/main_game.gd index d0e27c1..88e0050 100644 --- a/scenes/game/mainGame/main_game.gd +++ b/scenes/game/mainGame/main_game.gd @@ -4,7 +4,6 @@ extends Node2D # Called when the node enters the scene tree for the first time. func _ready() -> void: pass # Replace with function body. - print() # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: diff --git a/scenes/game/mainGame/main_game.tscn b/scenes/game/mainGame/main_game.tscn index d4ffa9c..5d3612f 100644 --- a/scenes/game/mainGame/main_game.tscn +++ b/scenes/game/mainGame/main_game.tscn @@ -1,6 +1,12 @@ -[gd_scene load_steps=2 format=3 uid="uid://dgxw2n4ei2ahe"] +[gd_scene load_steps=4 format=3 uid="uid://dgxw2n4ei2ahe"] [ext_resource type="Script" path="res://scenes/game/mainGame/main_game.gd" id="1_napbe"] +[ext_resource type="PackedScene" uid="uid://0duodsosmfpq" path="res://scenes/game/entities/player/player.tscn" id="3_sjgkj"] +[ext_resource type="PackedScene" uid="uid://br7eqr6jomsg4" path="res://scenes/game/map/map.tscn" id="3_vpriv"] [node name="mainGame" type="Node2D"] script = ExtResource("1_napbe") + +[node name="Map" parent="." instance=ExtResource("3_vpriv")] + +[node name="Player" parent="." instance=ExtResource("3_sjgkj")] diff --git a/scenes/game/map/floorHexagon.tscn b/scenes/game/map/floorHexagon.tscn new file mode 100644 index 0000000..9e60578 --- /dev/null +++ b/scenes/game/map/floorHexagon.tscn @@ -0,0 +1,8 @@ +[gd_scene load_steps=2 format=4 uid="uid://4bbmk4wy0a1b"] + +[ext_resource type="TileSet" path="res://Assets/Tilemaps/Floor.tres" id="1_557um"] + +[node name="Floor" type="TileMapLayer"] +position = Vector2(16, 32) +tile_map_data = PackedByteArray("AAD+//3/AAAAAAAAAAD+//7/AAAAAAAAAAD9//7/AAAAAAAAAAD///3/AAAAAAAAAAAAAP7/AAAAAAAAAAD///7/AAAAAAAAAAD9////AAAAAAAAAAD8////AAAAAAAAAAD/////AAAAAAAAAAD9/wAAAAAAAAAAAAD+////AAAAAAAAAAA=") +tile_set = ExtResource("1_557um") diff --git a/scenes/game/map/map.tscn b/scenes/game/map/map.tscn new file mode 100644 index 0000000..c429361 --- /dev/null +++ b/scenes/game/map/map.tscn @@ -0,0 +1,9 @@ +[gd_scene load_steps=2 format=4 uid="uid://br7eqr6jomsg4"] + +[ext_resource type="TileSet" uid="uid://64vn4umcy2ke" path="res://Assets/Tilemaps/Walls.tres" id="1_gju0a"] + +[node name="Map" type="Node2D"] + +[node name="Walls" type="TileMapLayer" parent="."] +tile_map_data = PackedByteArray("AAD///7/AAAAAAAAAAAAAP7/AAAAAAAAAAD+////AAAAAAAAAAD+/wAAAAAAAAAAAAD+//7/AAAAAAAAAAABAP7/AAAAAAAAAAACAP7/AAAAAAAAAAD+/wEAAAAAAAAAAAD+/wIAAAAAAAAAAAD+/wMAAAAAAAAAAAADAP7/AAAAAAAAAAAEAP7/AAAAAAAAAAA=") +tile_set = ExtResource("1_gju0a") diff --git a/scenes/game/map/wallsHexagon.tscn b/scenes/game/map/wallsHexagon.tscn new file mode 100644 index 0000000..8033c99 --- /dev/null +++ b/scenes/game/map/wallsHexagon.tscn @@ -0,0 +1,8 @@ +[gd_scene load_steps=2 format=4 uid="uid://m3sgr6auims"] + +[ext_resource type="TileSet" path="res://Assets/Tilemaps/Wall.tres" id="1_8k7fq"] + +[node name="Walls" type="TileMapLayer"] +position = Vector2(16, 32) +tile_map_data = PackedByteArray("AAD8//v/AAAAAAEAAAD8//z/AAABAAAAAAD7//3/AAABAAEAAAD7//v/AAABAAEAAAD8//r/AAADAAEAAAD9//z/AAADAAEAAAD8//7/AAABAAAAAAD7////AAABAAEAAAD8////AAAAAAEAAAD8/wAAAAAAAAAAAAD9//3/AAAAAAEAAAD9//7/AAACAAEAAAD8//3/AAABAAAAAAA=") +tile_set = ExtResource("1_8k7fq") diff --git a/scenes/main/main.gd b/scenes/main/main.gd new file mode 100644 index 0000000..a13afe0 --- /dev/null +++ b/scenes/main/main.gd @@ -0,0 +1,11 @@ +extends Node + +func _ready() -> void: + loadGame() + + +func loadGame(): + G.resetValues() + for i in get_children(): + i.queue_free() + add_child(load("res://scenes/game/mainGame/main_game.tscn").instantiate()) diff --git a/scenes/main/main.tscn b/scenes/main/main.tscn index 4c0b614..0588537 100644 --- a/scenes/main/main.tscn +++ b/scenes/main/main.tscn @@ -1,3 +1,6 @@ -[gd_scene format=3 uid="uid://bwsbkfnkncfhp"] +[gd_scene load_steps=2 format=3 uid="uid://bwsbkfnkncfhp"] + +[ext_resource type="Script" path="res://scenes/main/main.gd" id="1_1blp2"] [node name="Main" type="Node"] +script = ExtResource("1_1blp2")