javascript - Phaser3 中的随机星星
问题描述
我有一群明星。一开始它只给了我1星。我想做,如果我拿这颗星,它给我 2 颗星,如果我拿 2 颗星,它给我 3 颗星,以此类推。我该怎么做?
stars = this.physics.add.group({
key: 'star',
repeat: -1,
setXY: {
x: Phaser.Math.RND.between(0, 900),
y: Phaser.Math.RND.between(0, 600),
frameQuantity: 2,
repeat: 5
}
});
this.physics.add.overlap(player, stars, collectStar, null, this);
function collectStar (player,star){
star.disableBody(true, true);
score += 2; // COUNT BY 2
scoreText.setText('Score: ' + score);
}
解决方案
推荐阅读
- r - 在 ggplot2 的轴中显示替代分类标签
- windows - 带有 unicode 字符串的 SendInput 未正确发送到 Windows 10 上的 UWP 应用程序
- c# - 从另一个项目引用控制器
- php - dompdf在部分视图上没有得到css
- javascript - 以模态显示视频
- visual-studio-2017 - 在地图模式下更改 Visual Studio 滚动条插入符号颜色
- javascript - 在按钮上调用函数后停止 admin-ajax.php
- c++ - 如何使用 LLVM pass 使变量 volatile 或 const
- colors - Echarts Pie - 没有颜色的碎片
- vue.js - 对话框中的轮播消失,Vue 和 Vuetify