From df9ad93a430664c2b70a26c441899e24b828d685 Mon Sep 17 00:00:00 2001 From: Tabby <41929769+tabby-cat-nya@users.noreply.github.com> Date: Fri, 16 May 2025 23:16:29 +1000 Subject: [PATCH] platformer mostly working and overall game logic also coming along well --- base modules/channel_controller.gd | 3 +++ bugs.md | 5 +++-- game_logic.gd | 11 +++++++---- game_scene.tscn | 2 ++ games/platformer/platformer.gd | 22 ++++++++++++++++------ 5 files changed, 31 insertions(+), 12 deletions(-) diff --git a/base modules/channel_controller.gd b/base modules/channel_controller.gd index b0c2065..c31632b 100644 --- a/base modules/channel_controller.gd +++ b/base modules/channel_controller.gd @@ -12,6 +12,7 @@ enum Mode{ @export var channel_name : String @export var channel_scene : PackedScene +@export var dead_channel : bool @export_group("Node References") @export var offline_channel_cover : TextureRect @export var static_channel_cover : TextureRect @@ -19,6 +20,8 @@ enum Mode{ var channel_mode : Mode = Mode.Offline + + func _ready() -> void: #var new_scene = channel_scene.instantiate() #game_viewport.add_child(new_scene) diff --git a/bugs.md b/bugs.md index 4e4bad5..67539f1 100644 --- a/bugs.md +++ b/bugs.md @@ -1,8 +1,9 @@ # High Priority - [ ] remote breaking animation not working - [x] pressing enter causes the platformer channel to restart event after the intiial prompt dismissial -- [ ] lasers not appearing -- [ ] only 1 lane getting warning +- [x] lasers not appearing +- [x] only 1 lane getting warning +- [ ] platformer works once but having trouble getting it to replay # Minor diff --git a/game_logic.gd b/game_logic.gd index 028e4ec..fe05afe 100644 --- a/game_logic.gd +++ b/game_logic.gd @@ -15,7 +15,7 @@ signal game_over(score : int) @export var games : Array[PackedScene] @export var zoom_speed : float = 0.5 @export_group("Channel Rules") -@export var target_channels : float = 2.5 +@export var target_channels : float = 1.5 @export var channel_growth_per_min : float = 4 @export_group("Node References") @@ -68,14 +68,15 @@ func game_loop(delta : float): var online_channels : Array[Channel] var offline_channels : Array[Channel] # sort all the channels into online and offline - if main_channel.channel_mode == Channel.Mode.Online: + #if main_channel.channel_mode == Channel.Mode.Online: + if main_channel.platformer_online: online_channels.append(main_channel) else: online_channels.append(main_channel) for channel in outer_channels: if(channel.channel_mode == Channel.Mode.Online): online_channels.append(channel) - else: + elif(!channel.dead_channel): offline_channels.append(channel) # if i need to switch a channel online, then pick one and run tis start channel method #print("Online Channels: " + str(online_channels.size())) @@ -84,7 +85,9 @@ func game_loop(delta : float): var random_game = randi_range(0, games.size()-1) #offline_channels[random_channel_number].start_channel() if(offline_channels[random_channel_number] != main_channel): - offline_channels[random_channel_number].start_specific_channel(games[random_game]) + offline_channels[random_channel_number].start_channel() + #picking a random game is cool but we cant have two of the same! + #offline_channels[random_channel_number].start_specific_channel(games[random_game]) else: main_channel.start_channel() diff --git a/game_scene.tscn b/game_scene.tscn index 2febca4..da3a1c8 100644 --- a/game_scene.tscn +++ b/game_scene.tscn @@ -53,6 +53,7 @@ columns = 3 [node name="Control" parent="GridContainer" instance=ExtResource("1_mlf6e")] layout_mode = 2 channel_scene = ExtResource("7_6e45b") +dead_channel = true [node name="Control2" parent="GridContainer" instance=ExtResource("1_mlf6e")] layout_mode = 2 @@ -63,6 +64,7 @@ channel_scene = ExtResource("3_mj2jn") layout_mode = 2 channel_name = "Asteroids" channel_scene = ExtResource("3_mj2jn") +dead_channel = true [node name="Control6" parent="GridContainer" instance=ExtResource("1_mlf6e")] layout_mode = 2 diff --git a/games/platformer/platformer.gd b/games/platformer/platformer.gd index a3579c1..3adfd7e 100644 --- a/games/platformer/platformer.gd +++ b/games/platformer/platformer.gd @@ -35,12 +35,16 @@ func _ready() -> void: # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: - for i in range(2): - #warning_areas[i].visible = stage == GameStage.Warning and safe_lane!=i - #laser_areas[i].visible = stage == GameStage.Lasers and safe_lane!=i + for i in range(3): + warning_areas[i].visible = stage == GameStage.Warning and safe_lane!=i + laser_areas[i].visible = stage == GameStage.Lasers and safe_lane!=i + if(stage == GameStage.Lasers and safe_lane!=i): + if laser_areas[i].get_overlapping_areas().size()>0: + end_game() + game_lose.emit() pass - warning_areas[0].visible = stage == GameStage.Warning - laser_areas[0].visible = stage == GameStage.Lasers + #warning_areas[0].visible = stage == GameStage.Warning + #laser_areas[0].visible = stage == GameStage.Lasers #todo make sure lasers dont trigger the door/remote/event hitboxes func update_ui(score : int, lives :int): @@ -60,6 +64,7 @@ func start_game(): pass func end_game(): + # set stage back to none? game_active = false pass @@ -68,5 +73,10 @@ func _on_timer_timeout() -> void: if(stage == GameStage.Warning): stage = GameStage.Lasers timer.start(laser_duration) - if(stage == GameStage.Lasers): + elif(stage == GameStage.Lasers): stage = GameStage.None + if(game_active): + game_win.emit() + end_game() + + #if i havent died yet, then win