From 2cfb73b94d3a0eb4754b106985eff49e5303988b Mon Sep 17 00:00:00 2001 From: Tabby <41929769+tabby-cat-nya@users.noreply.github.com> Date: Wed, 14 May 2025 13:30:27 +1000 Subject: [PATCH] cooking in progress, will work on "story" after lunch --- base modules/channel_controller.gd | 28 +++++++++++++++------- base modules/test_channel.tscn | 1 + game_logic.gd | 28 ++++++++++++++++++++++ game_logic.gd.uid | 1 + game_scene.tscn | 20 +++++++++------- games/platformer/lab_platform.gd | 17 ++++++++++++++ games/platformer/lab_platform.gd.uid | 1 + games/platformer/lab_platform.tscn | 19 +++++++++++++++ games/platformer/platformer.tscn | 34 ++++++++++++++++++++++++--- games/platformer/player.gd | 4 ++-- sprites/lab_platform.pdn | Bin 0 -> 4124 bytes sprites/lab_platform.png | Bin 0 -> 507 bytes sprites/lab_platform.png.import | 34 +++++++++++++++++++++++++++ 13 files changed, 165 insertions(+), 22 deletions(-) create mode 100644 game_logic.gd create mode 100644 game_logic.gd.uid create mode 100644 games/platformer/lab_platform.gd create mode 100644 games/platformer/lab_platform.gd.uid create mode 100644 games/platformer/lab_platform.tscn create mode 100644 sprites/lab_platform.pdn create mode 100644 sprites/lab_platform.png create mode 100644 sprites/lab_platform.png.import diff --git a/base modules/channel_controller.gd b/base modules/channel_controller.gd index 9dffc1f..71a9c87 100644 --- a/base modules/channel_controller.gd +++ b/base modules/channel_controller.gd @@ -1,6 +1,8 @@ extends Control class_name Channel +signal channel_win +signal channel_lose @export var channel_name : String @export var channel_scene : PackedScene @@ -8,25 +10,33 @@ class_name Channel @export var offline_channel_cover : TextureRect @export var game_viewport : SubViewport -var channel_online : bool = true +var channel_online : bool = false func _ready() -> void: - var new_scene = channel_scene.instantiate() - game_viewport.add_child(new_scene) - + #var new_scene = channel_scene.instantiate() + #game_viewport.add_child(new_scene) + #start_channel(channel_scene) + #if(channel_name == "Platformer"): + #start_channel(channel_scene) + pass func _process(delta: float) -> void: offline_channel_cover.visible = !channel_online -func start_channel(): - pass +func start_channel(scene : PackedScene): + var new_scene = scene.instantiate() + game_viewport.add_child(new_scene) + channel_online = true func end_channel(): - pass + channel_online = false + game_viewport.get_child(0).queue_free() func win_channel(): - pass + channel_win.emit() + end_channel() func lose_channel(): - pass + channel_lose.emit() + end_channel() diff --git a/base modules/test_channel.tscn b/base modules/test_channel.tscn index 0cf36ed..58b80a5 100644 --- a/base modules/test_channel.tscn +++ b/base modules/test_channel.tscn @@ -40,6 +40,7 @@ anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 texture = ExtResource("2_01b3p") +expand_mode = 2 [node name="GameViewport" type="SubViewport" parent="."] handle_input_locally = false diff --git a/game_logic.gd b/game_logic.gd new file mode 100644 index 0000000..534db91 --- /dev/null +++ b/game_logic.gd @@ -0,0 +1,28 @@ +extends Control + +enum Gamemode{ + Story, + Endless +} + +#mode settings +@export var max_lives = 3 +@export var lives = 3 +@export var platformer_game : PackedScene +@export var games : Array[PackedScene] +@export_group("Node References") +@export var main_camera : Camera2D +@export var outer_channels : Array[Channel] +@export var main_channel : Channel +var gamemode : Gamemode = Gamemode.Story #will be set by manager/menu option + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + if(gamemode == Gamemode.Story): + main_camera.zoom = Vector2(3.1,3.1) + main_channel.start_channel(platformer_game) + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta: float) -> void: + pass diff --git a/game_logic.gd.uid b/game_logic.gd.uid new file mode 100644 index 0000000..ec49332 --- /dev/null +++ b/game_logic.gd.uid @@ -0,0 +1 @@ +uid://d2q6xfk8htbyy diff --git a/game_scene.tscn b/game_scene.tscn index 66ef645..0d0395b 100644 --- a/game_scene.tscn +++ b/game_scene.tscn @@ -1,8 +1,8 @@ [gd_scene load_steps=11 format=3 uid="uid://ct8axfbvd2wn4"] +[ext_resource type="Script" uid="uid://d2q6xfk8htbyy" path="res://game_logic.gd" id="1_j5hk1"] [ext_resource type="PackedScene" uid="uid://63rik2noj8id" path="res://base modules/test_channel.tscn" id="1_mlf6e"] [ext_resource type="PackedScene" uid="uid://ch1x8pfdu2b1g" path="res://test_game.tscn" id="2_mixcd"] -[ext_resource type="Texture2D" uid="uid://cyo0wl4dt3td1" path="res://sprites/offline_channel.png" id="2_po0ka"] [ext_resource type="PackedScene" uid="uid://bw1hhx7lyfonr" path="res://games/asteroids/asteroids.tscn" id="3_mj2jn"] [ext_resource type="PackedScene" uid="uid://ckbyiwy0dxbsd" path="res://games/platformer/platformer.tscn" id="4_mj2jn"] [ext_resource type="PackedScene" uid="uid://b5lh8cnwu8xhg" path="res://games/ddr/ddr.tscn" id="5_e35lh"] @@ -11,13 +11,19 @@ [ext_resource type="PackedScene" uid="uid://bkabgl6p44c5b" path="res://games/space invaders/space_invaders.tscn" id="9_miq82"] [ext_resource type="PackedScene" uid="uid://drk2fwkv816qv" path="res://games/crafting/crafting.tscn" id="9_udeyl"] -[node name="GameScene" type="Control"] +[node name="GameScene" type="Control" node_paths=PackedStringArray("main_camera", "outer_channels", "main_channel")] layout_mode = 3 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 +script = ExtResource("1_j5hk1") +platformer_game = ExtResource("4_mj2jn") +games = Array[PackedScene]([ExtResource("3_mj2jn"), ExtResource("7_6e45b"), ExtResource("6_kdryc"), ExtResource("9_udeyl"), ExtResource("5_e35lh"), ExtResource("9_miq82")]) +main_camera = NodePath("Camera2D") +outer_channels = [NodePath("GridContainer/Control"), NodePath("GridContainer/Control2"), NodePath("GridContainer/Control9"), NodePath("GridContainer/Control6"), NodePath("GridContainer/Control4"), NodePath("GridContainer/Control5"), NodePath("GridContainer/Control8"), NodePath("GridContainer/Control7")] +main_channel = NodePath("GridContainer/Main") [node name="ColorRect" type="ColorRect" parent="."] layout_mode = 1 @@ -46,19 +52,17 @@ layout_mode = 2 channel_name = "Asteroids" channel_scene = ExtResource("3_mj2jn") -[node name="ColorRect" type="TextureRect" parent="GridContainer"] +[node name="Control9" parent="GridContainer" instance=ExtResource("1_mlf6e")] layout_mode = 2 -size_flags_horizontal = 3 -size_flags_vertical = 3 -texture = ExtResource("2_po0ka") -expand_mode = 1 +channel_name = "Asteroids" +channel_scene = ExtResource("3_mj2jn") [node name="Control6" parent="GridContainer" instance=ExtResource("1_mlf6e")] layout_mode = 2 channel_name = "DDR" channel_scene = ExtResource("5_e35lh") -[node name="Control3" parent="GridContainer" instance=ExtResource("1_mlf6e")] +[node name="Main" parent="GridContainer" instance=ExtResource("1_mlf6e")] layout_mode = 2 channel_name = "Platformer" channel_scene = ExtResource("4_mj2jn") diff --git a/games/platformer/lab_platform.gd b/games/platformer/lab_platform.gd new file mode 100644 index 0000000..7b0685e --- /dev/null +++ b/games/platformer/lab_platform.gd @@ -0,0 +1,17 @@ +extends AnimatableBody2D + +const offset_multiplier : float = 2 +var float_offset : float +var starting_y : float +var elapsed : float + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + starting_y = position.y + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta: float) -> void: + elapsed += delta + float_offset = sin(elapsed * offset_multiplier) + position.y = starting_y + float_offset diff --git a/games/platformer/lab_platform.gd.uid b/games/platformer/lab_platform.gd.uid new file mode 100644 index 0000000..0e1f44d --- /dev/null +++ b/games/platformer/lab_platform.gd.uid @@ -0,0 +1 @@ +uid://dgv63122abplg diff --git a/games/platformer/lab_platform.tscn b/games/platformer/lab_platform.tscn new file mode 100644 index 0000000..5c2fe45 --- /dev/null +++ b/games/platformer/lab_platform.tscn @@ -0,0 +1,19 @@ +[gd_scene load_steps=4 format=3 uid="uid://q3wdnawp7n63"] + +[ext_resource type="Texture2D" uid="uid://brdr3sc5kfrpq" path="res://sprites/lab_platform.png" id="1_5v7mp"] +[ext_resource type="Script" uid="uid://dgv63122abplg" path="res://games/platformer/lab_platform.gd" id="1_y0tou"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_x2rtd"] +size = Vector2(96, 8) + +[node name="LabPlatformer" type="AnimatableBody2D"] +script = ExtResource("1_y0tou") + +[node name="Sprite2D" type="Sprite2D" parent="."] +scale = Vector2(2, 2) +texture = ExtResource("1_5v7mp") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2(0, -12) +shape = SubResource("RectangleShape2D_x2rtd") +one_way_collision = true diff --git a/games/platformer/platformer.tscn b/games/platformer/platformer.tscn index 510164a..36042fa 100644 --- a/games/platformer/platformer.tscn +++ b/games/platformer/platformer.tscn @@ -1,11 +1,13 @@ -[gd_scene load_steps=7 format=3 uid="uid://ckbyiwy0dxbsd"] +[gd_scene load_steps=11 format=4 uid="uid://ckbyiwy0dxbsd"] [ext_resource type="Script" uid="uid://dqyddqx8xm0gw" path="res://games/platformer/player.gd" id="1_1wj3w"] [ext_resource type="Texture2D" uid="uid://diilj7xuttpqu" path="res://icon.svg" id="1_oyf6i"] +[ext_resource type="Texture2D" uid="uid://g5arxk4po7kw" path="res://sprites/platformer_lab_tile.png" id="3_84mot"] +[ext_resource type="PackedScene" uid="uid://q3wdnawp7n63" path="res://games/platformer/lab_platform.tscn" id="4_w58m1"] [sub_resource type="Gradient" id="Gradient_1wj3w"] -offsets = PackedFloat32Array(0.0962343, 0.158996) -colors = PackedColorArray(0, 0.254902, 0, 1, 0.618821, 0.815103, 1, 1) +offsets = PackedFloat32Array(0.0209205, 1) +colors = PackedColorArray(0.241156, 0.241156, 0.241156, 1, 0.462291, 0.462291, 0.462291, 1) [sub_resource type="GradientTexture2D" id="GradientTexture2D_84mot"] gradient = SubResource("Gradient_1wj3w") @@ -17,6 +19,15 @@ size = Vector2(32, 32) [sub_resource type="RectangleShape2D" id="RectangleShape2D_1wj3w"] size = Vector2(608, 46) +[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_w58m1"] +texture = ExtResource("3_84mot") +0:0/0 = 0 +0:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) + +[sub_resource type="TileSet" id="TileSet_x2rtd"] +physics_layer_0/collision_layer = 1 +sources/0 = SubResource("TileSetAtlasSource_w58m1") + [node name="Platformer" type="Node"] [node name="TextureRect" type="TextureRect" parent="."] @@ -43,3 +54,20 @@ position = Vector2(319, 344) [node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"] shape = SubResource("RectangleShape2D_1wj3w") + +[node name="TileMapLayer" type="TileMapLayer" parent="."] +scale = Vector2(2, 2) +tile_map_data = PackedByteArray("AAAAAAkAAAAAAAAAAAABAAkAAAAAAAAAAAACAAkAAAAAAAAAAAADAAkAAAAAAAAAAAAEAAkAAAAAAAAAAAAFAAkAAAAAAAAAAAAGAAkAAAAAAAAAAAAHAAkAAAAAAAAAAAAIAAkAAAAAAAAAAAAJAAkAAAAAAAAAAAAKAAkAAAAAAAAAAAALAAkAAAAAAAAAAAAMAAkAAAAAAAAAAAANAAkAAAAAAAAAAAAOAAkAAAAAAAAAAAAPAAkAAAAAAAAAAAAQAAkAAAAAAAAAAAARAAkAAAAAAAAAAAASAAkAAAAAAAAAAAATAAkAAAAAAAAAAAATAAoAAAAAAAAAAAATAAsAAAAAAAAAAAASAAsAAAAAAAAAAAARAAsAAAAAAAAAAAAQAAsAAAAAAAAAAAAPAAsAAAAAAAAAAAAOAAsAAAAAAAAAAAANAAsAAAAAAAAAAAAMAAsAAAAAAAAAAAALAAsAAAAAAAAAAAAKAAsAAAAAAAAAAAAJAAsAAAAAAAAAAAAIAAsAAAAAAAAAAAAHAAsAAAAAAAAAAAAGAAsAAAAAAAAAAAAFAAsAAAAAAAAAAAAEAAsAAAAAAAAAAAADAAsAAAAAAAAAAAACAAsAAAAAAAAAAAABAAsAAAAAAAAAAAABAAoAAAAAAAAAAAAAAAoAAAAAAAAAAAAAAAsAAAAAAAAAAAACAAoAAAAAAAAAAAADAAoAAAAAAAAAAAAEAAoAAAAAAAAAAAAFAAoAAAAAAAAAAAAGAAoAAAAAAAAAAAAHAAoAAAAAAAAAAAAIAAoAAAAAAAAAAAAJAAoAAAAAAAAAAAAKAAoAAAAAAAAAAAALAAoAAAAAAAAAAAAMAAoAAAAAAAAAAAANAAoAAAAAAAAAAAAOAAoAAAAAAAAAAAAPAAoAAAAAAAAAAAAQAAoAAAAAAAAAAAARAAoAAAAAAAAAAAASAAoAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAACAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAGAAAAAAAAAAAAAAAHAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAJAAAAAAAAAAAAAAAKAAAAAAAAAAAAAAALAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAANAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAPAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAARAAAAAAAAAAAAAAASAAAAAAAAAAAAAAATAAAAAAAAAAAAAAATAAEAAAAAAAAAAAATAAIAAAAAAAAAAAATAAMAAAAAAAAAAAATAAQAAAAAAAAAAAATAAUAAAAAAAAAAAATAAYAAAAAAAAAAAATAAcAAAAAAAAAAAATAAgAAAAAAAAAAAA=") +tile_set = SubResource("TileSet_x2rtd") + +[node name="LabPlatformer" parent="." instance=ExtResource("4_w58m1")] +position = Vector2(112, 208) + +[node name="LabPlatformer2" parent="." instance=ExtResource("4_w58m1")] +position = Vector2(496, 208) + +[node name="LabPlatformer3" parent="." instance=ExtResource("4_w58m1")] +position = Vector2(368, 112) + +[node name="LabPlatformer4" parent="." instance=ExtResource("4_w58m1")] +position = Vector2(240, 112) diff --git a/games/platformer/player.gd b/games/platformer/player.gd index 366d83e..1b0dd4d 100644 --- a/games/platformer/player.gd +++ b/games/platformer/player.gd @@ -1,8 +1,8 @@ extends CharacterBody2D -const SPEED = 300.0 -const JUMP_VELOCITY = -400.0 +@export var SPEED = 200.0 +@export var JUMP_VELOCITY = -450.0 func _physics_process(delta: float) -> void: diff --git a/sprites/lab_platform.pdn b/sprites/lab_platform.pdn new file mode 100644 index 0000000000000000000000000000000000000000..2bcf79f57fed30fd5f11cbff9c864eb9b7710648 GIT binary patch literal 4124 zcmd^BU2Gf25x%qdt4Ou-SI15h(`*pHpu!)Kl*B-EaYxe9iJ~ZyK3cMC$j9T7Jd?aT z+>dA~NYXYa^3Vc_QTHLpL*AVBp#_o_EgB?20u)6b(w8DA3d2Q!B52XVb^4pQ2@-W? zPYOxbY0?6H@*Zw(XLk3S-I>{$Tg$G--`K}2=yg@-N=*{zDRrxr4kqS>K9`Cmg2xtQ+qAUqu?4GT zcWVJ%ZKi`tl`oci(fndlHae4o^Kje-70~&xE>q%r&f-E=*e-xJ zuIJ1H)zD5hVG&(N=sHS353FxG>%?>I1jh;704LYO(*ZW0Ygh6~QP#_dwRCE^oI5TS zbD?^>WEPv?gi@qih&Liat)sVv`F!R?r4o&=7rMH-+R;;rTFVIMwNj*^a9dGsCez@B zOhN4x$qZMR-EQPJWUe8kwnLoCtyh+|3oBK5No$-~UYE3}a7te>_;zMBZ}!@;c$JIJ zi;+n6FM^LTEIbUe0}a2}CiVeYTay&k%4*gsvBFu&lBNTD5qx6+PX{t~$FdEQR*7vH zQfE4_X4g83oG1MgTAQe8)$VlM2!GcIswUfAqFNpp7+1`!V(OYn>K^Czxar;UIM>Sm z@in^LHi=OnmQ;s52^Q&^jEiB$#@M@up;zz%t|+F3NAdYSSLvHDHN1O*-?6)VM(cEl zY{9iO!;3^Eh9ZYy(^aWs6M!?$&YV8IJGEjNirSnGbWK?^I!bL|jzl<$&!=0VHa90F z<>YKE6;F`peCo{f{}cSo=`(nE#yw}iu8*WnW18b`&D8Ecci zdke2B%X<7En0$boR~lhUYQ|4T&v?c`lwCkkK&hvL@n{kXGbAHgp{>47Xnm#t>7clH zT(7Am`$W4c3R%%ER1$rTOVhN;{sZiaw)ISmXi1=!Nf1Q_T4qvM{!t6men&|>7}!+; z^~M4G>mK0#5x^t@;x(Nc0-OgR3JCug4j`Ok7jUQ$I>7Jj0pBqKJd410-UtjE`>eoI zcvtZ%`R_th6BUNoL8)_q|=m6ONDM|Ix#GTm|oL1 z8j?(==wN72LvC{fw1iAJeW#G@&Ky9{#N&GC6ZD0KbgzA^7NhUZ;T08U8)y&K=Q}by zh$#sihA=$A2%7!GtdWhIJ`v> zDk|>`n4wk8=t`Yk7WYW^c^~S;ectTY7#Abe+G9eotP{5>ODa|#7i8!Wj}}N*Gx~f- zliO%BeD^BUYtZ-K55$dz_;gcZM7UI`OaA@Gz>75kPCTKQyd<}qhGwgEuck|~V)gyh z6a}qLSgeGuTjigCW%nH#c0P?v>Ta~fp2Izd!6xGatN8=Kv+R!hEl4o`VLc5pnw&N_ z86ToyV=;V-(|j z+=?5+>XYISgTM!uplP*c6aJQDuF)SLU!63FVURiu`&kwvmBA{2jr9iT2MM%WkH7amMATJyH=nFcJu>@?-#&Z!-6L;2@l5K2FD-rZ zrSD(*-lN}X{4#u1A%|b=|8U}wQ-iXD}xjxD+42tQV z0J5OE3=Kem$?)>(H;YrZa;kvLGEW!B5DWjg6S?^s6nLC}_T2q{A}=aM`B0Ou%9gvu zYRigKm)}^Pqhz>{|9%Je7v_ZdEDb&LndjYLwmSQ1MgjYY@AeIISTD&NbB7*$QEL>Q z)yt7K={1`}uhtor>!l8tk22klOxSp!Twg&`Pu}P*L&Z*qE7s4rjjA|YCA+3KfL!D0 L>gTe~DWM4fN7sbQ literal 0 HcmV?d00001 diff --git a/sprites/lab_platform.png.import b/sprites/lab_platform.png.import new file mode 100644 index 0000000..ce3a912 --- /dev/null +++ b/sprites/lab_platform.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://brdr3sc5kfrpq" +path="res://.godot/imported/lab_platform.png-e61609504366de5cb5e99a47a4365b19.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://sprites/lab_platform.png" +dest_files=["res://.godot/imported/lab_platform.png-e61609504366de5cb5e99a47a4365b19.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