5
我在面向對象編程類中爲小行星遊戲製作了一個Asteroid字段,並收到非法字符錯誤:'\ u200b'。這個問題似乎是對線12發生(進口java.awt.Point中之間的線;以及公共類小行星延伸PolyBlob)非法字符錯誤:' u200b'
/*
* University of Central Florida
* COP3330 - Spring 2016
* Author: Aundray Ortiz
*/
package asteroidfield;
import java.util.Random;
import blobzx.PolyBlob;
import blobzx.BlobUtils;
import java.awt.Point;
public class Asteroid extends PolyBlob
{
private static final Random random = new Random();
public Asteroid(int a, int b, double c)
{
super(-100,-100,c);
int sides = 5 + random.nextInt(5);
int[] x = new int[sides];
int[] y = new int[sides];
int going = 0;
double direct = 0;
double region = (Math.PI * 2)/sides;
for(int num = 0; num<sides;num++)
{
going = 5 + random.nextInt(16);
direct = (num * region) + (Math.random() * region);
Point p = BlobUtils.rotatePoint(going, direct);
x[num] = p.x;
y[num] = p.y;
}
setPolygon(x, y);
setRate(c);
setDelta(a,b);
}
}
哇,這很容易,*臉掌* 非常感謝! –