Game data save/load, profile autoload
This commit is contained in:
parent
11ea0f0d51
commit
cf4687350d
7 changed files with 48 additions and 4 deletions
|
|
@ -26,6 +26,26 @@ func _ready():
|
|||
ship.camera.limit_right = map_width/2.0
|
||||
ship.camera.limit_top = -map_height/2.0
|
||||
ship.camera.limit_bottom = map_height/2.0
|
||||
|
||||
if Game.profile.profile_meta.has('game_load'):
|
||||
Game.profile.profile_meta.erase('game_load')
|
||||
var save = Game.profile.profile_meta['game']
|
||||
ship.money = save['money']
|
||||
ship.hull.hp = save['hp']
|
||||
ship.hull.fuel = save['fuel']
|
||||
ship.hull.ammunition = save['ammo']
|
||||
if save.has('primaryweapon'):
|
||||
for node in ship.primary_slot.get_children():
|
||||
node.queue_free()
|
||||
var weapon_inst = Game.get_weapon(save['primaryweapon']).instantiate()
|
||||
weapon_inst.id = save['primaryweapon']
|
||||
ship.primary_slot.add_child(weapon_inst)
|
||||
if save.has('secondaryweapon'):
|
||||
for node in ship.secondary_slot.get_children():
|
||||
node.queue_free()
|
||||
var weapon_inst = Game.get_weapon(save['secondaryweapon']).instantiate()
|
||||
weapon_inst.id = save['secondaryweapon']
|
||||
ship.secondary_slot.add_child(weapon_inst)
|
||||
|
||||
func addtargetlist(body : Node2D):
|
||||
if !can_target.has(body):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue