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

Checking for remaining coins

The main script needs to detect whether the player has picked up all of the coins. Since the coins are all children of CoinCointainer, you can use get_child_count() on this node to find out how many coins remain. Put this in the _process() function so that it will be checked every frame:

func _process(delta):
if playing and $CoinContainer.get_child_count() == 0:
level += 1
time_left += 5
spawn_coins()

If no more coins remain, then the player advances to the next level.

主站蜘蛛池模板: 金湖县| 杂多县| 镇康县| 大竹县| 潞西市| 山阳县| 兰州市| 祁东县| 即墨市| 泗洪县| 临江市| 定远县| 红河县| 青岛市| 和田县| 茶陵县| 达拉特旗| 同德县| 建德市| 浏阳市| 得荣县| 岢岚县| 万州区| 泰兴市| 秦皇岛市| 保康县| 会泽县| 四子王旗| 赣州市| 广元市| 沧源| 通许县| 广安市| 碌曲县| 行唐县| 广德县| 萍乡市| 凌云县| 铜鼓县| 修武县| 卢氏县|