-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LevelMenu 的场景结构发生变化: - LevelMenu - LevelMenuCamera # 相机 - SmoothMovement - LevelButtons # 选关按钮 - UI - PreviousLevelButton - NextLevelButton - Title 初始化时,会生成所有的选关按钮。 按屏幕左右的按钮(PreviousLevelButton 或 NextLevelButton)可以移动 相机,从而实现切换章节的功能。 BREAKING CHANGE: LevelMenu 的场景结构发生变化。
- Loading branch information
Showing
3 changed files
with
86 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
extends Camera2D | ||
|
||
|
||
const WIDTH := 1920 / 4 | ||
const HEIGHT := 1080 / 4 | ||
const MOVE_TIME := 0.3 | ||
|
||
|
||
func _process(_delta): | ||
self.position = $SmoothMovement.get_position() | ||
# print($SmoothMovement.get_position()) | ||
|
||
func init_position(pos: Vector2) -> void: | ||
$SmoothMovement.set_position(pos) | ||
|
||
|
||
func _on_next_chapter_button_pressed(): | ||
$SmoothMovement.move_to($SmoothMovement.get_position() + Vector2(WIDTH, 0), MOVE_TIME) | ||
|
||
|
||
func _on_previous_chapter_button_pressed(): | ||
$SmoothMovement.move_to($SmoothMovement.get_position() - Vector2(WIDTH, 0), MOVE_TIME) |