Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/180.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Android studio图像生成_Java_Android_Android Studio - Fatal编程技术网

Java Android studio图像生成

Java Android studio图像生成,java,android,android-studio,Java,Android,Android Studio,我正在尝试创建一个应用程序,让球从屏幕顶部向下落下。球是不同颜色的。如何让计算机随机选择要发送的球?我还可以改变速度和一次下降多少?我怎么做墙 将两个球排成一列。假设您有一个Ball类,将它们放在一个球数组中,然后选择一个随机数来选择要从天空落下的球。 像这样: Ball[] ballArray = {ball1, ball2}; int randomBall; //Loop to randomly throw ballls from sky randomBall = (int) Math.r

我正在尝试创建一个应用程序,让球从屏幕顶部向下落下。球是不同颜色的。如何让计算机随机选择要发送的球?我还可以改变速度和一次下降多少?我怎么做墙

将两个球排成一列。假设您有一个Ball类,将它们放在一个球数组中,然后选择一个随机数来选择要从天空落下的球。 像这样:

Ball[] ballArray = {ball1, ball2};
int randomBall;

//Loop to randomly throw ballls from sky
randomBall = (int) Math.random()*2; //Choose between ball at index 0 or 1.
是的,在编程中你可以做任何事情。我不知道你的代码,所以我不知道如何为你实现速度。是的,你可以同时投两个球