zoom out to see board
This commit is contained in:
parent
e33cc17bc2
commit
46536f02b8
3 changed files with 25 additions and 1 deletions
7
board.gd
7
board.gd
|
|
@ -9,6 +9,13 @@ extends Node3D
|
||||||
# literally just linearly search to find pieces at a position
|
# literally just linearly search to find pieces at a position
|
||||||
# children
|
# children
|
||||||
|
|
||||||
|
# for zooming out to see the whole puzzle
|
||||||
|
func top_left_aabb() -> AABB:
|
||||||
|
return AABB(position, Vector3.ONE*0.1)
|
||||||
|
|
||||||
|
func bottom_right_aabb() -> AABB:
|
||||||
|
return AABB(position + Vector3(dims.x, 0, dims.y), Vector3.ONE*0.1)
|
||||||
|
|
||||||
# todo: Array[Piece]
|
# todo: Array[Piece]
|
||||||
func pieces() -> Array:
|
func pieces() -> Array:
|
||||||
return get_children()
|
return get_children()
|
||||||
|
|
|
||||||
12
main.gd
12
main.gd
|
|
@ -19,6 +19,7 @@ var player: Piece
|
||||||
@onready var sound: AudioStreamPlayer = $Sound
|
@onready var sound: AudioStreamPlayer = $Sound
|
||||||
var sounds_hit := AudioStreamRandomizer.new()
|
var sounds_hit := AudioStreamRandomizer.new()
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
add_child(board)
|
add_child(board)
|
||||||
var wall_count := 0
|
var wall_count := 0
|
||||||
|
|
@ -38,9 +39,18 @@ func _ready() -> void:
|
||||||
var file_name := hit_dir.get_next()
|
var file_name := hit_dir.get_next()
|
||||||
while file_name != "":
|
while file_name != "":
|
||||||
if file_name.ends_with("ogg"):
|
if file_name.ends_with("ogg"):
|
||||||
var stream := AudioStream.new()
|
|
||||||
sounds_hit.add_stream(-1, load("res://sfx/hit/"+file_name))
|
sounds_hit.add_stream(-1, load("res://sfx/hit/"+file_name))
|
||||||
file_name = hit_dir.get_next()
|
file_name = hit_dir.get_next()
|
||||||
|
|
||||||
|
$TopLeft.aabb = board.top_left_aabb()
|
||||||
|
$BottomRight.aabb = board.bottom_right_aabb()
|
||||||
|
print($TopLeft.position)
|
||||||
|
print(board.bottom_right_aabb())
|
||||||
|
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
if $TopLeft.is_on_screen() and $BottomRight.is_on_screen():
|
||||||
|
return
|
||||||
|
camera.position.y += delta
|
||||||
|
|
||||||
func _input(event: InputEvent) -> void:
|
func _input(event: InputEvent) -> void:
|
||||||
if event.is_action_pressed("u", true, true):
|
if event.is_action_pressed("u", true, true):
|
||||||
|
|
|
||||||
|
|
@ -23,3 +23,10 @@ fov = 90.0
|
||||||
environment = SubResource("Environment_ig7tw")
|
environment = SubResource("Environment_ig7tw")
|
||||||
|
|
||||||
[node name="Sound" type="AudioStreamPlayer" parent="."]
|
[node name="Sound" type="AudioStreamPlayer" parent="."]
|
||||||
|
|
||||||
|
[node name="TopLeft" type="VisibleOnScreenNotifier3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0)
|
||||||
|
aabb = AABB(0, 0, 0, 2, 2, 2)
|
||||||
|
|
||||||
|
[node name="BottomRight" type="VisibleOnScreenNotifier3D" parent="."]
|
||||||
|
aabb = AABB(0, 0, 0, 2, 2, 2)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue