- 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.
推薦閱讀
- Dreamweaver CS3+Flash CS3+Fireworks CS3創意網站構建實例詳解
- Mastering Spark for Data Science
- 計算機控制技術
- Windows XP中文版應用基礎
- STM32G4入門與電機控制實戰:基于X-CUBE-MCSDK的無刷直流電機與永磁同步電機控制實現
- 自動生產線的拆裝與調試
- 可編程序控制器應用實訓(三菱機型)
- 水下無線傳感器網絡的通信與決策技術
- SMS 2003部署與操作深入指南
- Photoshop CS5圖像處理入門、進階與提高
- 機器學習案例分析(基于Python語言)
- 人工智能云平臺:原理、設計與應用
- 網管員世界2009超值精華本
- 工程地質地學信息遙感自動提取技術
- Deep Learning with PyTorch Quick Start Guide