- 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.
推薦閱讀
- 三菱FX3U/5U PLC從入門到精通
- R Machine Learning By Example
- 一本書玩轉數據分析(雙色圖解版)
- Hands-On Neural Networks with Keras
- RPA:流程自動化引領數字勞動力革命
- 網絡綜合布線設計與施工技術
- Mastering ServiceNow Scripting
- 網站入侵與腳本攻防修煉
- 網絡管理工具實用詳解
- 自動化生產線安裝與調試(三菱FX系列)(第二版)
- 學練一本通:51單片機應用技術
- 樂高創意機器人教程(中級 上冊 10~16歲) (青少年iCAN+創新創意實踐指導叢書)
- 智能控制技術及其應用
- Microsoft 365 Mobility and Security:Exam Guide MS-101
- Arduino創意機器人入門:基于Mind+