initialized levels and players on the loading function.

recode0.2
Jorge Vásquez Pérez 2 years ago
parent bde3cc5976
commit d4e97136b3

@ -12,11 +12,15 @@ func load_lvl( lvl_index: int ):
var lvl: Node = load( lvl_path ).instantiate() var lvl: Node = load( lvl_path ).instantiate()
G.add_child( lvl ) G.add_child( lvl )
L = $Game/Level L = $Game/Level
init_lvl()
func load_plyr(): func load_plyr():
var plyr = load("res://scenes/Player.tscn").instantiate() var plyr = load("res://scenes/Player.tscn").instantiate()
G.add_child( plyr ) G.add_child( plyr )
P = $Game/Player P = $Game/Player
init_plyr()
func init_lvl():
pass
func init_plyr(): func init_plyr():
P.set_gravity_vector( Vector2(0,1) ) P.set_gravity_vector( Vector2(0,1) )
@ -29,7 +33,7 @@ func _ready():
load_lvl(curr_lvl) load_lvl(curr_lvl)
load_plyr() load_plyr()
init_plyr()

Loading…
Cancel
Save