wea re cooking 🔥

This commit is contained in:
Tabby 2025-05-16 22:13:34 +10:00
parent 2b90112231
commit 34eb42616d
25 changed files with 247 additions and 77 deletions

View file

@ -7,6 +7,8 @@ enum Gamemode{
#mode settings
signal game_over(score : int)
@export var max_lives = 3
@export var lives = 3
@export var platformer_game : PackedScene
@ -23,15 +25,21 @@ enum Gamemode{
var gamemode : Gamemode = Gamemode.Story #will be set by manager/menu option
var zooming_out : bool = false
var gameplay : bool = false # becomes true when the game starts
var score : int = 0
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
GameManager.zoom_out_signal.connect(zoom_out)
GameManager.prepare.connect(get_ready)
GameManager.gaming.connect(start_game)
GameManager.channel_win.connect(rec_channel_win)
GameManager.channel_lose.connect(rec_channel_lose)
if(gamemode == Gamemode.Story):
main_camera.zoom = Vector2(3.1,3.1)
main_channel.start_specific_channel(platformer_game)
if(GameManager.are_we_skipping_intro):
main_camera.zoom = Vector2(1,1)
GameManager.skip_intro.emit()
# Called every frame. 'delta' is the elapsed time since the previous frame.
@ -69,7 +77,19 @@ func game_loop(delta : float):
else:
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()))
#print("Online Channels: " + str(online_channels.size()))
if(online_channels.size() < target_channels and offline_channels.size() > 0):
var random_channel_number = randi_range(0, offline_channels.size()-1)
offline_channels[random_channel_number].start_channel()
var random_game = randi_range(0, games.size()-1)
#offline_channels[random_channel_number].start_channel()
offline_channels[random_channel_number].start_specific_channel(games[random_game])
func rec_channel_win():
score += 1
GameManager.send_update_data(score, lives)
func rec_channel_lose():
lives -= 1
GameManager.send_update_data(score, lives)
if(lives <= 0):
game_over.emit()