- Godot Engine Game Development Projects
- Chris Bradfield
- 105字
- 2021-06-18 18:51:27
Starting and Ending the Player's Movement
When the game starts, the main scene will need to inform the player that the game has begun. Add the start() function as follows, which the main scene will use to set the player's starting animation and position:
func start(pos):
set_process(true)
position = pos
$AnimatedSprite.animation = "idle"
The die() function will be called when the player hits an obstacle or runs out of time:
func die():
$AnimatedSprite.animation = "hurt"
set_process(false)
Setting set_process(false) causes the _process() function to no longer be called for this node. That way, when the player has died, they can't still be moved by key input.
推薦閱讀
- 集成架構(gòu)中型系統(tǒng)
- 工業(yè)機器人虛擬仿真實例教程:KUKA.Sim Pro(全彩版)
- Julia 1.0 Programming
- Expert AWS Development
- 80x86/Pentium微型計算機原理及應(yīng)用
- Windows環(huán)境下32位匯編語言程序設(shè)計
- Enterprise PowerShell Scripting Bootcamp
- 網(wǎng)絡(luò)安全管理實踐
- 悟透AutoCAD 2009案例自學(xué)手冊
- INSTANT Heat Maps in R:How-to
- 人工智能:語言智能處理
- 從零開始學(xué)Java Web開發(fā)
- 基于RPA技術(shù)財務(wù)機器人的應(yīng)用與研究
- AVR單片機C語言程序設(shè)計實例精粹
- 從實踐中學(xué)嵌入式Linux操作系統(tǒng)