Add a savegame system using slots and a main menu, allow player to move RigidBody2Ds using apply_impulse(), increased physics tick, enabled FXAA, and more.

This commit is contained in:
ChaoticByte 2024-10-01 23:19:37 +02:00
parent 35ebe26340
commit 5a67d46d6f
No known key found for this signature in database
13 changed files with 291 additions and 25 deletions

21
menu/slot/slot.gd Normal file
View file

@ -0,0 +1,21 @@
extends Node2D
@export var slot_idx: int
@export var slot_label: String = ""
func _ready() -> void:
$Label.text = str(slot_label)
func _on_area_2d_load_body_entered(body: Node2D) -> void:
# load slot & start game
if body == NodeRegistry.player:
Gamestate.current_slot = slot_idx
Gamestate.load_slot()
Levels.load_entrypoint(Gamestate.last_entrypoint)
func _on_area_2d_delete_body_entered(body: Node2D) -> void:
# reset slot on disk
if body == NodeRegistry.player:
Gamestate.reset_slot(slot_idx)
NodeRegistry.player.position = Levels.mainmenu_player_pos