fixed an issue where the camera was off-center after generating the boards

master
Zac 4 years ago
parent 5bf4e1d44c
commit 9ed56022c6
  1. 6
      Game.tscn
  2. 2
      scripts/Game.gd

@ -68,6 +68,8 @@ disabled = true
[node name="InGameUI" parent="." index="1" instance=ExtResource( 3 )]
scale = Vector2( 1, 1 )
[node name="Blocks" type="Node2D" parent="." index="2"]
editor/display_folded = true
@ -102,13 +104,11 @@ playback/speed = 1.0
[node name="TopBoard" type="Position2D" parent="." index="4"]
pause_mode = 2
editor/display_folded = true
position = Vector2( 300, 480 )
_sections_unfolded = [ "Pause" ]
_sections_unfolded = [ "Pause", "Transform" ]
[node name="Camera" type="Camera2D" parent="TopBoard" index="0"]
editor/display_folded = true
position = Vector2( 0, 0.886444 )
offset = Vector2( 0, -82 )
anchor_mode = 1

@ -24,6 +24,7 @@ func _ready():
get_tree().paused = true
func generate_boards(num):
var initial_pos = $TopBoard.position
var last_b = null
for i in range(num):
var pos = $TopBoard.position
@ -41,6 +42,7 @@ func generate_boards(num):
randomize()
$TopBoard.position += Vector2((randi() % 15) - 7, -10)
last_b = weakref(b)
$TopBoard/Camera.global_position.x = to_global(initial_pos).x
func _process(delta):
if current_time < time_limit and can_tap:

Loading…
Cancel
Save