forked from team-sg/hero-mark-2
indicator for if sg is off the top of the screen
This commit is contained in:
parent
ae0e52f506
commit
8b1ccd366f
7 changed files with 127 additions and 2 deletions
|
@ -2,6 +2,7 @@ extends Camera2D
|
|||
|
||||
onready var player = get_tree().get_nodes_in_group("player").front()
|
||||
onready var last_sector = Game.get_sector(player.global_position + Vector2(0.0, -5.0))
|
||||
onready var off_level_indicator = $OffLevelIndicator
|
||||
#Scroll direction
|
||||
export var scroll_h = true
|
||||
export var scroll_v = false
|
||||
|
@ -16,7 +17,7 @@ func _process(delta):
|
|||
if not is_instance_valid(player):
|
||||
player = get_tree().get_nodes_in_group("player").pop_front()
|
||||
else:
|
||||
var current_sector = Game.get_sector(player.global_position + Vector2(0.0, 1.0))
|
||||
var current_sector = Game.get_sector(player.global_position + Vector2(0.0, -5.0))
|
||||
if scroll_h && current_sector.x != last_sector.x:
|
||||
position.x = current_sector.x * Game.RESOLUTION.x
|
||||
if respawn_h:
|
||||
|
@ -27,3 +28,9 @@ func _process(delta):
|
|||
position.y = current_sector.y * Game.RESOLUTION.y
|
||||
last_sector.y = current_sector.y
|
||||
Game.current_sector = last_sector
|
||||
#Off level indicator
|
||||
if player.global_position.y - global_position.y <= 16.0:
|
||||
off_level_indicator.visible = true
|
||||
off_level_indicator.global_position.x = player.global_position.x
|
||||
else:
|
||||
off_level_indicator.visible = false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue