fixed camera controls

This commit is contained in:
Luca 2024-11-17 13:06:55 +01:00
parent cd62e12389
commit d6a0911801
78 changed files with 4044 additions and 81 deletions

View file

@ -18,6 +18,7 @@ signal on_level_up
@export var base_defense: int = 1
@export var base_tempo: int = 1
@export var base_xp: int = 1
@export var catch_rate: int = 128
# Current Values
@export var attack: int = 1
@ -116,6 +117,16 @@ func add_xp(amount: int = 0) -> void:
if(xp >= xp_for_levelup):
level_up()
func calculate_catch_probability() -> float:
var rate: float = 0.0
var catch_device_modifier: float = 1.0
rate = ( (3.0 * self.health - 2.0 * self.current_health) / 3.0 * self.health) * self.catch_rate * catch_device_modifier
var p: float = rate / 255.0
print(p)
return p
func attack_enemy(enemy_data: MonsterData) -> int:
var damage: int = 0
var base_damage: int = 2

View file

@ -18,6 +18,7 @@ base_health = 40
base_defense = 40
base_tempo = 56
base_xp = 55
catch_rate = 255
attack = 1
current_health = 1
health = 1

View file

@ -1,10 +1,12 @@
class_name SavedGame
extends Resource
# This resource collects all data to save, from the player and other nodes
# This is the main SaveGame that collects all data to save
# It saves all player data and other nodes in the world, quest progress, etc.
# Player info to save
@export var player_money : int = 0
@export var party: Array[MonsterData] = []
@export var monster_storage: Array[MonsterData] = []
# Environment info to save (daytime, current world, weather)
@export var world : String = ""

View file

@ -65,5 +65,8 @@ func load_game() -> void:
if restored_node.has_method("on_load_game"):
restored_node.on_load_game(node)
# This checks if there is a savegame file in the users folder.
# We use FileAccess here to ensure that also works on Android.
# TODO: Research again, why this is needed
func save_exists() -> bool:
return FileAccess.file_exists("user://savegame.tres")

View file

@ -1,7 +1,12 @@
class_name SavedData
extends Resource
# Main class that can save a node's information
# Every node's save data extends from this class
# Class that can save a single node's information
# Every node's save data can either use this SavedData class directly
# or extend from it and add node-specific values
# See "Saving and loading games with Godot" by Godotneers for details:
# https://www.youtube.com/watch?v=43BZsLZheA4&t=2234s
# https://github.com/godotneers/saving-loading-video/blob/main/godotneers-ensuring-saved-game-compatibility.pdf
# Position of the node to save
@export var position: Vector3 = Vector3.ZERO