Initialization of the player, now reads the Levels initial gravity and direction. Also re-worked the way switches work.
This commit is contained in:
+18
-3
@@ -19,11 +19,21 @@ func load_plyr():
|
||||
G.add_child( plyr )
|
||||
P = $Game/Player
|
||||
init_plyr()
|
||||
|
||||
func init_lvl():
|
||||
#connect signals
|
||||
var switches = $Game/Level/Switches.get_children()
|
||||
for s in switches:
|
||||
s.body_entered.connect( _on_switch_body_entered.bind(s.type))
|
||||
# $player.combat_trigger.connect(start_combat)
|
||||
|
||||
pass
|
||||
|
||||
func init_plyr():
|
||||
P.set_gravity_vector( Vector2(0,1) )
|
||||
#P.init()
|
||||
P.set_direction( L.ini_dir )
|
||||
P.set_gravity_vector( L.ini_grav_vec )
|
||||
P.position = L.get_node("SpawnPoint").position
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
@@ -34,8 +44,13 @@ func _ready():
|
||||
load_lvl(curr_lvl)
|
||||
load_plyr()
|
||||
|
||||
|
||||
|
||||
func _on_switch_body_entered(body,type):
|
||||
if type == 0: #end switch
|
||||
pass
|
||||
elif type == 1: #abyss switch
|
||||
P.fall()
|
||||
elif type == 2: #gravity switch
|
||||
pass
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
|
||||
Reference in New Issue
Block a user