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("AAAAAAkAAAAAAAAAAAABAAkAAAAAAAAAAAACAAkAAAAAAAAAAAADAAkAAAAAAAAAAAAEAAkAAAAAAAAAAAAFAAkAAAAAAAAAAAAGAAkAAAAAAAAAAAAHAAkAAAAAAAAAAAAIAAkAAAAAAAAAAAAJAAkAAAAAAAAAAAAKAAkAAAAAAAAAAAALAAkAAAAAAAAAAAAMAAkAAAAAAAAAAAANAAkAAAAAAAAAAAAOAAkAAAAAAAAAAAAPAAkAAAAAAAAAAAAQAAkAAAAAAAAAAAARAAkAAAAAAAAAAAASAAkAAAAAAAAAAAATAAkAAAAAAAAAAAATAAoAAAAAAAAAAAATAAsAAAAAAAAAAAASAAsAAAAAAAAAAAARAAsAAAAAAAAAAAAQAAsAAAAAAAAAAAAPAAsAAAAAAAAAAAAOAAsA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AAATAAUAAAAAAAAAAAATAAYAAAAAAAAAAAATAAcAAAAAAAAAAAATAAgAAAAAAAAAAAA=") +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 0000000..2bcf79f Binary files /dev/null and b/sprites/lab_platform.pdn differ diff --git a/sprites/lab_platform.png b/sprites/lab_platform.png new file mode 100644 index 0000000..d661b7d Binary files /dev/null and b/sprites/lab_platform.png differ 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