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
|
||||
|
||||
|
|
|
@ -32,6 +32,9 @@ onready var deathtiles = map.get_node("Death")
|
|||
##Preload
|
||||
var pre_arrow = preload("res://objects/player/arrow_projectile.tscn")
|
||||
|
||||
#Set initial respawn point
|
||||
func _ready():
|
||||
Game.respawn_point = global_position
|
||||
|
||||
func _physics_process(delta):
|
||||
axis = Vector2(Input.get_axis("ui_left","ui_right"),Input.get_axis("ui_up","ui_down"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue