Updated bee nectar gathering and game levels

The bee's nectar gathering now depends on the current flower nectar level. The return, deposit_nectar, die, and other functions have been updated to return void. Nectar requirements for each game level have been increased tenfold. A new variable 'flower_nectar_level' has been added to manage the amount of nectar in flowers. Also, several functions in GameStateManager were updated to include specific input parameters or return void.
This commit is contained in:
Dan Baker 2024-05-14 19:05:47 +01:00
parent 513b0c92a7
commit a62cd6018e
10 changed files with 40 additions and 24 deletions

View file

@ -1,7 +1,7 @@
class_name GameStateManager extends Node
## THIS SHOULD NOT EXIST HERE BUT I AM NOT GOING TO MAKE A NEW CLASS FOR IT RIGHT NOW
@onready var default_cursor = preload("res://resources/cursors/pointer_a.png")
@onready var default_cursor := preload("res://resources/cursors/pointer_a.png")
var placing_drone : bool = false
@ -13,8 +13,23 @@ var level_started : bool = false
var level_complete : bool = false
var game_over : bool = false
## Game Rules
## Game Rules ##############################################################
# Nectar levels - Depleted by snails, increased by bee visits?? Or time, TBD
# TODO: Decide how to renew the nectar levels
# This is capped out at 10... Seems like a good amount
var flower_nectar_level : int = 10 :
get:
return flower_nectar_level
set(value):
if value > 10:
flower_nectar_level = 10
else:
flower_nectar_level = value
# Snails
var spawn_snails : bool = false
var snail_spawn_interval : float = 10.0
var gathered_nectar : int = 0 :
get:
@ -50,26 +65,27 @@ var judge_level_par : int = 0 :
else:
return 0
func _process(delta):
func _process(delta) -> void:
if level_started and !level_complete and !game_over:
level_timer += delta
func bee_died():
func bee_died() -> void:
dead_bees += 1
func add_nectar():
gathered_nectar += 1
# Add the nectar to the total gathered nectar
func add_nectar(nectar : int) -> void:
gathered_nectar += nectar
func add_drone():
func add_drone() -> void:
drones_used += 1
func remove_drone():
func remove_drone() -> void:
drones_used -= 1
func game_start():
func game_start() -> void:
level_started = true
func game_win():
func game_win() -> void:
Log.pr("Game win")
level_complete = true
HighScoreMgr.add_honey(gathered_nectar)
@ -77,13 +93,13 @@ func game_win():
HighScoreMgr.add_dead_bees(dead_bees)
HighScoreMgr.save()
func game_lose():
func game_lose() -> void:
Log.pr("Game lose")
game_over = true
HighScoreMgr.add_dead_bees(dead_bees)
HighScoreMgr.save()
func reset():
func reset() -> void:
level_timer = 0.0
level_started = false
level_complete = false
@ -92,5 +108,5 @@ func reset():
dead_bees = 0
spawn_snails = false
func reset_cursor():
func reset_cursor() -> void:
Input.set_custom_mouse_cursor(default_cursor, Input.CURSOR_ARROW, Vector2(8, 8))