forked from team-sg/hero-mark-2
fixed respawning
This commit is contained in:
parent
c3f32de2df
commit
923c28a8df
3 changed files with 18 additions and 7 deletions
|
@ -15,10 +15,14 @@ func _ready():
|
|||
func _process(delta):
|
||||
#Scroll screen when player is on different sector
|
||||
current_sector = (player.global_position / resolution).floor()
|
||||
if current_sector != last_sector:
|
||||
Game.respawn_point = player.global_position + Vector2(8,0)
|
||||
if scroll_h: position.x = current_sector.x * resolution.x
|
||||
if scroll_v: position.y = current_sector.y * resolution.y
|
||||
if scroll_h && current_sector.x != last_sector.x:
|
||||
Game.respawn_point = player.global_position + Vector2(8,0) # Set respawn point
|
||||
position.x = current_sector.x * resolution.x # Move camera
|
||||
last_sector = current_sector
|
||||
Game.current_sector = current_sector
|
||||
if scroll_v && current_sector.y != last_sector.y:
|
||||
Game.respawn_point = player.global_position + Vector2(0,-8) # Set respawn point
|
||||
position.y = current_sector.y * resolution.y # Move camera
|
||||
last_sector = current_sector
|
||||
Game.current_sector = current_sector
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue