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

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.

主站蜘蛛池模板: 公安县| 水富县| 贺兰县| 高台县| 淮阳县| 江川县| 永和县| 崇仁县| 行唐县| 镇江市| 商丘市| 都匀市| 山西省| 绥宁县| 平舆县| 蓬莱市| 怀宁县| 东兴市| 晋宁县| 白朗县| 上饶市| 江西省| 阳新县| 海盐县| 长丰县| 柳河县| 农安县| 东宁县| 乳山市| 潢川县| 扶余县| 富宁县| 石首市| 江阴市| 武山县| 通化县| 正安县| 天台县| 沙河市| 西乌| 双流县|