官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 西吉县| 大石桥市| 桂东县| 平凉市| 噶尔县| 同德县| 墨竹工卡县| 加查县| 新乡市| 睢宁县| 土默特左旗| 专栏| 霍城县| 涪陵区| 华坪县| 友谊县| 福州市| 长宁县| 邵东县| 皋兰县| 梓潼县| 清新县| 潍坊市| 美姑县| 东阳市| 石林| 黎城县| 二连浩特市| 始兴县| 万山特区| 伊宁县| 邯郸县| 遂川县| 内乡县| 洛隆县| 临夏县| 武山县| 思茅市| 咸宁市| 泸西县| 尼勒克县|