id stringlengths 36 36 | text stringlengths 1 1.25M |
|---|---|
6d349b33-4165-47e7-8ad6-b71e2cfdbb06 | public void accelerate(float offset, float multiplier) {
PX += acceleration * Math.pow(U.getC(), 2) * Math.cos(getA() + offset) * multiplier;
PY += acceleration * Math.pow(U.getC(), 2) * Math.sin(getA() + offset) * multiplier;
// Multiplier allows front booster to be less powerful than the rear
// booster
P = (float) Math.hypot(PX, PY);
ChangeFrame();
} |
adc5441a-f61c-4483-b2a8-38a01b545868 | public void changeDirection(int dir) {
if (dir > 0) {
a = (float) (getA() + Math.PI * (3. / 360.));
} else {
a = (float) (getA() - Math.PI * (3. / 360.));
}
} |
3c40e252-19f5-4267-ada9-75b0a0d58095 | public void ChangeFrame() {
// Energy through relativistic energy-momentum relationship
E = (float) Math.sqrt(Math.pow(M * U.getC() * U.getC(), 2)
+ Math.pow(P * U.getC(), 2));
// Energy and momentum define ship rapidity
RAPIDITY = (float) (0.5f * Math.log((E + (P * U.getC()))
/ (E - (P * U.getC()))));
// Velocity is the hyperbolic tangent of rapidity
v = (float) (U.getC() * Math.tanh(RAPIDITY / U.getC()));
// Components vx and vy are scaled from the momentum vectors
final float ratio_v_to_P = v / P;
if (ratio_v_to_P == ratio_v_to_P) { // Check for NaN (at velocity === 0)
vx = PX * ratio_v_to_P;
vy = PY * ratio_v_to_P;
HEADING = (float) (Math.atan2(vy, vx));
}
BETA = (v / U.getC());
GAMMA = (float) Math.abs(1. / Math.sqrt(1. - BETA * BETA));
// System.out.println("ratio_v_to_P:"+ratio_v_to_P);
} |
684b3217-7a78-4aee-a518-7dac9da81ef7 | private void Constrain() {
if (U.getTorus() == true) {
if (x < (0 - U.world_x_pixels2)) {
x += U.world_x_pixels;
} else if (x > U.world_x_pixels2) {
x -= U.world_x_pixels;
}
if (y < (0 - U.world_y_pixels2 + U.UI)) {
y += U.world_y_pixels - U.UI;
} else if (y > U.world_y_pixels2) {
y -= U.world_y_pixels - U.UI;
}
} else {
if (x < (0 - U.world_x_pixels2)) {
PX = Math.abs(PX);
//a = ((float) (+Math.PI - getHeading()));
ChangeFrame();
} else if (x + (2 * r) >= U.world_x_pixels2) {
PX = -(Math.abs(PX));
//a = ((float) (-Math.PI - getHeading()));
ChangeFrame();
}
if (y < (0 - U.world_y_pixels2 + U.UI)) {
PY = Math.abs(PY);
//a = ((float) (2 * Math.PI - getHeading()));
ChangeFrame();
} else if (y + (2 * r) >= U.world_y_pixels2) {
PY = -(Math.abs(PY));
//a = ((float) (-2 * Math.PI - getHeading()));
ChangeFrame();
}
}
} |
a400a425-b4bb-414b-bcae-3a6af828c7bc | public void Damage() {
dmg = 20;
} |
d023e093-55e7-4903-81b4-99099ba601de | public float getA() {
return a;
} |
b65b9b9b-8773-47ea-b2fa-34391fdf9dbb | public double getBeta() {
return BETA;
} |
e1214568-5661-468c-8065-dca82c877066 | public double getGamma() {
return GAMMA;
} |
35920cc2-be1b-4162-ae78-adf9a12b92e1 | public float getHeading() {
return HEADING;
} |
e1fea32b-a9dc-4d48-9d11-89c4e50bd7fa | private boolean IsDamaged() {
if (dmg > 0) {
--dmg;
return true;
}
return false;
} |
57dfb197-286c-4abd-9cfe-160c431da4ff | public void Render(Graphics2D _g2) {
ship.Render(_g2, Math.round(x), Math.round(y), getA(), accelerating,
IsDamaged());
accelerating = false;
} |
bc3e4d7a-5c39-4d3f-9cfd-016f199e8e68 | public void Reset() {
PX = 0f;
PY = 0f;
vx = 0f;
vy = 0f;
E = 0f;
P = 0f;
v = 0f;
RAPIDITY = 0f;
GAMMA = 1f;
BETA = 0f;
a = ((float) Math.toRadians(-90));
} |
bd254b8b-52a5-409a-994e-6ae65abce9fd | public void Walk() {
x += vx;
y += vy;
Constrain();
} |
ccf55856-ac9e-4489-9c9b-ae2258431b5d | public static PhotonManager GetPhotonManager() {
return singleton;
} |
53f15d78-58be-4ac4-9266-a80c9a00dea9 | private PhotonManager() {
} |
3973d425-c0b1-42b2-8847-2599b4521902 | public void AddShell(PhotonShell _ps) {
synchronized (list_of_shells_sync) {
list_of_shells_sync.add(_ps);
}
} |
b074ee75-4a35-4fee-8a14-d2e5d452d917 | public void Cleanup() {
// Clear clutter
final LinkedList<PhotonShell> ToRemove = new LinkedList<PhotonShell>();
synchronized (list_of_shells_sync) {
for (final PhotonShell _p : list_of_shells_sync) {
if (_p.GetDead() == true) {
ToRemove.add(_p);
}
}
}
synchronized (list_of_shells_sync) {
list_of_shells_sync.removeAll(ToRemove);
}
} |
48558d30-60bb-4f5e-bfb2-63ccf1f0ea5f | public void Clear() {
synchronized (list_of_shells_sync) {
list_of_shells_sync.clear();
}
} |
1c0bf96a-8a0f-4982-9b18-86532798f2f2 | public void RenderFromLocation(Graphics2D _g2, float _x, float _y) {
// get list of ting to draw
final HashSet<PhotonShell> toDraw = new HashSet<PhotonShell>();
synchronized (list_of_shells_sync) {
for (final PhotonShell _p : list_of_shells_sync) {
final float sep = Seperation(_x, _y, _p);
if (sep < U.granularity / 2 && sep > -U.granularity / 2) {
toDraw.add(_p);
_p.SetSeen();
} else if (U.currentMode == GameMode.GameOn
&& U.getTorus() == false && _p.GetSeen() == true) {
_p.Kill();
}
}
// TreeSet<PhotonShell> toDraw = new TreeSet<PhotonShell>();
// synchronized (list_of_shells_sync) {
// for (PhotonShell _p : list_of_shells_sync) {
// float sep = Seperation(_x , _y, _p);
// if (sep < U.granularity && sep > -U.granularity) {
// //is it the closest?
// PhotonShell _comparison = toDraw.floor(_p);
// if (_comparison != null && _comparison.GID == _p.GID) {
// //I'm already in, which is closer?
// if (Seperation(_x , _y, toDraw.floor(_p)) < sep) {
// toDraw.remove(_comparison);
// toDraw.add(_p);
// }
// } else {
// toDraw.add( _p );
// }
// }
// }
}
for (final PhotonShell _p : toDraw) {
_p.Render(_g2);
// _p.RenderShell(_g2);
if (U.show_all_locations == true) {
_p.RenderLink(_g2);
}
}
} |
0fecf50c-f238-4b98-bf83-d753a89f4682 | public void RenderShells(Graphics2D _g2) {
synchronized (list_of_shells_sync) {
for (final PhotonShell _p : list_of_shells_sync) {
_p.RenderShell(_g2);
}
}
} |
cb2b2185-00ec-4633-924b-d4823b147fb8 | private float Seperation(float _x, float _y, PhotonShell _p) {
return (float) Math.hypot((_x - _p.x), (_y - _p.y)) - _p.GetRadius();
} |
b2732d76-f7d7-491e-b8ac-bcf345eadc4b | public Rectangle(float _x, float _y, int _shape_size, float _speed) {
super(_x, _y, 0, 0, (short) 0, (short) 0);
shape_size = _shape_size;
shape_size2 = _shape_size / 2;
shape_color = U.default_colour;
a = (float) (U.R.nextFloat() * 2 * Math.PI);
speed = _speed;
ChangeFrame();
GID = ++U.GID;
final int R = U.R.nextInt(255);
final int G = U.R.nextInt(255);
int B = 255 - R - G;
if (B < 0) {
B = 0;
}
shell_colour = new Color(R, G, B);
} |
b26b47bc-1618-4b7b-a8fc-8c5f28b5e2cd | public void ChangeFrame() {
vx = (float) (speed * Math.cos(a) * U.getV());
vy = (float) (speed * Math.sin(a) * U.getV());
} |
2738e7b9-a9e0-438e-8dab-c69af1769b30 | private void Constrain() {
if (U.getTorus() == true) {
if (x + shape_size < (0 - U.world_x_pixels2)) {
x += U.world_x_pixels;
} else if (x >= U.world_x_pixels2) {
x -= U.world_x_pixels;
}
if (y + shape_size < (0 - U.world_y_pixels2 + U.UI)) {
y += U.world_y_pixels - U.UI;
} else if (y >= U.world_y_pixels2) {
y -= U.world_y_pixels - U.UI;
}
} else {
if (x < (0 - U.world_x_pixels2)) {
a = (float) (+Math.PI - a);
ChangeFrame();
} else if (x + shape_size >= U.world_x_pixels2) {
a = (float) (-Math.PI - a);
ChangeFrame();
}
if (y < (0 - U.world_y_pixels2 + U.UI)) {
a = (float) (2 * Math.PI - a);
ChangeFrame();
} else if (y + shape_size >= U.world_y_pixels2) {
a = (float) (-2 * Math.PI - a);
ChangeFrame();
}
}
} |
7f8fdd1e-fe6c-4a8a-a38a-196b1d7191ee | public int getGID() {
return GID;
} |
a9601dbc-cbd2-4089-84a9-a5fe1b00e0db | public void RenderReal(Graphics2D _g2) {
if (U.getDoppler() == true) {
SetDopplerColourMap();
} else {
shape_color = U.default_colour;
}
if (Math.hypot(vx, vy) > U.getC()) {
shape_color = Color.yellow;
DoSuperLumiSpikes(_g2, shape_size2);
}
_g2.setColor(shape_color);
_g2.drawRoundRect(Math.round(x), Math.round(y), shape_size, shape_size,
shape_size2, shape_size2);
} |
e082e697-bacf-4a45-8b83-67c4a8c4dc85 | public void Tick(int _tick) {
if (dist_to_tick > U.granularity) {
dist_to_tick = 0;
P.AddShell(new PhotonShell(x, y, vx, vy, (short) 0, (short) 0,
shape_size, shell_colour, GID, false));
// if (U.option_Torus == true) {
// P.AddShell( new PhotonShell(x, y, vx, vy,
// (short)(x-U.world_x_pixels), (short)0, shape_size, GID, false) );
// P.AddShell( new PhotonShell(x, y, vx, vy,
// (short)(x+U.world_x_pixels), (short)0, shape_size, GID, false) );
// P.AddShell( new PhotonShell(x, y, vx, vy, (short)0,
// (short)(y-U.world_y_pixels), shape_size, GID, false) );
// P.AddShell( new PhotonShell(x, y, vx, vy, (short)0,
// (short)(y+U.world_y_pixels), shape_size, GID, false) );
// }
}
} |
91fb88f5-8db3-420f-8ad6-4ad9f45883f4 | public void Walk() {
x += vx;
y += vy;
dist_to_tick += (U.getV() * speed * 2f) + (U.getC() * 2f);
Constrain();
} |
a4a51249-51ef-454a-8512-2005b85efc6d | public PhotonShell(float _x, float _y, float _vx, float _vy, short _xo,
short _yo, int _shape_size, Color _sc, int _GID, boolean _isDebris) {
super(_x, _y, _vx, _vy, _xo, _yo);
pixel_size = _shape_size;
pixel_size2 = _shape_size / 2;
radius = 0f;
dead = false;
GID = _GID;
createTime = U.shellTime;
isDebris = _isDebris;
shell_color = _sc;
} |
6f1ddc27-3a45-4259-b0bc-79f8501ae975 | @Override
public int compareTo(PhotonShell toComp) {
return GID - toComp.GID;
} |
c3eb6896-c443-450a-ba0a-f411cc30d9d0 | public boolean GetDead() {
return dead;
} |
9575b021-401a-4c2d-ae59-2e09b83561b6 | public float GetRadius() {
radius = ((U.shellTime - createTime) * U.getC());
if (radius > U.max_radius) {
Kill();
}
return radius;
} |
2b904382-50f8-40b1-ae25-4d704458c7bb | public boolean GetSeen() {
return seen;
} |
2bbcc7e5-a9c4-43d9-b6b7-195e2afc8680 | public void Kill() {
dead = true;
} |
8b838655-8db9-4058-aed3-0c98ef08a4cb | public void Render(Graphics2D _g2) {
if (isDebris == true) {
RenderDebris(_g2);
return;
}
if (U.getDoppler() == true) {
//System.out.print("DO DOPPLER ");
SetDopplerColourMap();
} else {
//System.out.print("DONT DO DOPPLER ");
shape_color = U.default_colour;
}
if (Math.hypot(vx, vy) > U.getC()) {
shape_color = Color.yellow;
DoSuperLumiSpikes(_g2, pixel_size2);
}
_g2.setColor(shape_color);
_g2.fillRoundRect(Math.round(x), // +x_offset
Math.round(y), // +y_offset
pixel_size, pixel_size, pixel_size2, pixel_size2);
} |
8d58dbfa-56e1-4f2d-b37f-f1c1302adaee | public void RenderDebris(Graphics2D _g2) {
_g2.setColor(Color.gray);
_g2.fillRoundRect(Math.round(x), Math.round(y), pixel_size, pixel_size,
pixel_size2, pixel_size2);
if (U.show_all_locations == true) {
synchronized (U.list_of_debris_sync) {
for (final Debris D : U.list_of_debris_sync) {
if (D.getGID() == GID) {
_g2.drawLine((int) (x + pixel_size2),
(int) (y + pixel_size2),
(int) (D.x + pixel_size2),
(int) (D.y + pixel_size2));
break;
}
}
}
}
} |
efd1b496-57cb-45b9-8450-8631f14e79ca | public void RenderLink(Graphics2D _g2) {
for (final Rectangle R : U.list_of_rectangles_sync) {
if (R.getGID() == GID) {
_g2.drawLine((int) (x + pixel_size2), // +x_offset
(int) (y + pixel_size2), // +y_offset
(int) (R.x + pixel_size2), (int) (R.y + pixel_size2));
break;
}
}
} |
6ed9a59b-5375-4f23-9532-9427becd3c9b | public void RenderShell(Graphics2D _g2) {
_g2.setColor(shell_color);
_g2.drawOval(Math.round(x - GetRadius() + pixel_size2), // -x_offset
Math.round(y - GetRadius() + pixel_size2), // -y_offset
Math.round(2 * GetRadius()), Math.round(2 * GetRadius()));
} |
e6a2a7b4-a987-4cd5-9768-b94d30361189 | public void SetSeen() {
seen = true;
} |
a536a041-bfbb-4303-a87b-3c8f633632bc | public Button(int _x, int _y, int _w, int _h, String _d, String _d2,
boolean _c) {
x = _x;
y = _y;
w = _w;
h = _h;
b = 6; // bevel
b2 = b / 2;
display = _d;
display2 = _d2;
Clickable = _c;
} |
39dc3206-f6bc-4d26-aa70-61cfca1702ea | public void AddValue(float _var) {
SetValue(var + _var);
} |
d9694a21-0944-4aa1-989e-4ed867c9d4dc | public boolean GetHover() {
if (Clickable == false)
return false;
if (U.CurMouse == null)
return false;
if (U.CurMouse.x <= x + U.world_x_offset)
return false;
if (U.CurMouse.x >= x + w + U.world_x_offset)
return false;
if (U.CurMouse.y <= y)
return false;
if (U.CurMouse.y >= y + h)
return false;
return true;
} |
741b438a-cf5e-4a06-b7b7-0e36f9141ffe | public float GetValue() {
return var;
} |
1a78ead2-ca8b-4da7-9b95-d07210afa779 | public void Render(Graphics2D _g2) {
final boolean hov = GetHover();
if (hov == true) {
_g2.setColor(Color.white);
} else if (Clickable == true) {
_g2.setColor(Color.gray);
} else {
_g2.setColor(Color.black);
}
_g2.fillRect(x, y, w, h);
if (hov == true) {
_g2.setColor(Color.black);
} else {
_g2.setColor(Color.white);
}
_g2.drawRect(x, y, w, h);
_g2.drawRect(x + b2, y + b2, w - b, h - b);
_g2.drawLine(x, y, x + b2, y + b2);
_g2.drawLine(x, y + h, x + b2, y + h - b2);
_g2.drawLine(x + w, y, x + w - b2, y + b2);
_g2.drawLine(x + w, y + h, x + w - b2, y + h - b2);
_g2.drawString(display + var_str + display2, x + text_x, y + text_y);
if (isYesNo == true) {
String yn = "ON";
if (yesNoValue == false) {
yn = "OFF";
}
_g2.drawString(yn, x + w / 2, y + (h / 2) + 15);
}
} |
a5e896bd-3c69-4197-b57a-83288e80769c | public void setClickable(boolean _c) {
Clickable = _c;
} |
789abccf-19ce-47bb-81ac-4b044f3b09c2 | public void setHighPrecision(boolean _p) {
highPrecision = _p;
} |
df68cf08-e6e8-42a8-b19a-6d7a255b7984 | public void setIsYesNo(boolean _yn) {
isYesNo = _yn;
} |
dd4defd2-474f-4c54-98fd-064609f3dcf9 | public void setPrecision(boolean _p) {
precision = _p;
} |
faedfa3e-5b31-4749-b0ab-945511dc3243 | public void SetValue(float _var) {
var = _var;
if (highPrecision == true) {
var_str = String.format("%.5f", var);
} else if (precision == true) {
var_str = String.format("%.2f", var);
} else {
var_str = String.format("%.0f", var);
}
} |
581f0b6e-b220-4e30-9fe7-fe08f66dbd02 | public void SetYesNoValue(boolean _yn) {
yesNoValue = _yn;
} |
5f8c5012-8f3c-42eb-8fbb-c9f0cd0d3ca3 | public static ButtonManager GetButtonManager() {
return singleton;
} |
c58c4df2-778e-458f-95b8-f8d516156796 | private ButtonManager() {
final int b2x = 0 + 70;
final int b3x = b2x + 320;
final int b4x = b3x + 175;
Quit = new Button(0, 0, b2x, U.UI, "Quit", "", true);
// Quit.text_y *= 1.5;
// End of game
NewGame = new Button(800, 0, 200, U.UI, "New Game", "", true);
// Playing game
PlayingC = new Button(b2x, 0, b3x - b2x, U.UI / 2, "Speed of Light:",
"", false);
PlayingAsteroidSpeed = new Button(b2x, U.UI / 2, b3x - b2x, U.UI / 2,
"Max Asteroid Speed:", "c", false);
PlayingLevel = new Button(b3x, 0, b4x - b3x, U.UI / 2, "Level:", "",
false);
PlayingScore = new Button(b3x, U.UI / 2, b4x - b3x, U.UI / 2, "Score:",
"", false);
PlayingLevel.setPrecision(false);
PlayingScore.setPrecision(false);
// lives
LivesShip = new ShipGraphic(3);
//
// title screen
StartArcade = new Button(50, 400, 200, 50, "Arcade Mode", "", true);
StartCreative = new Button(50, 500, 200, 50, "Sandbox Mode", "", true);
Start_Toggle_Doppler = new Button(0+150, 0, 250, 50, "Doppler Shift", "",
true);
Start_Toggle_LengthCon = new Button(300+150, 0, 250, 50,
"Length Contraction", "", true);
// Start_Toggle_TimeCon = new Button(400, 0, 250, 50, "Time Dialation",
// "", true);
Start_Toggle_Toroid = new Button(600+150, 0, 250, 50, "Toroidal Universe",
"", true);
Start_Toggle_Doppler.setIsYesNo(true);
Start_Toggle_LengthCon.setIsYesNo(true);
// Start_Toggle_TimeCon.setIsYesNo(true);
Start_Toggle_Toroid.setIsYesNo(true);
// creative mode
CreativeAsteroids = new Button(b2x, 0, 210, U.UI / 2, "Asteroids:", "",
false);
CreativeAsteroids_Minus = new Button(b2x + 210, 0, U.UI / 2, U.UI / 2,
"-", "", true);
CreativeAsteroids_Plus = new Button(b2x + 210 + U.UI / 2, 0, U.UI / 2,
U.UI / 2, "+", "", true);
CreativeAsteroidV = new Button(b2x, U.UI / 2, 210, U.UI / 2,
"Asteroid V:", "c", false);
CreativeAsteroidV_Minus = new Button(b2x + 210, U.UI / 2, U.UI / 2,
U.UI / 2, "-", "", true);
CreativeAsteroidV_Plus = new Button(b2x + 210 + U.UI / 2, U.UI / 2,
U.UI / 2, U.UI / 2, "+", "", true);
CreativeC = new Button(340, 0, 260, U.UI / 2, "Speed of Light:", "",
false);
CreativeC_Minus = new Button(340 + 260, 0, U.UI / 2, U.UI / 2, "-", "",
true);
CreativeC_Plus = new Button(340 + 260 + U.UI / 2, 0, U.UI / 2,
U.UI / 2, "+", "", true);
CreativeBeta = new Button(340, U.UI / 2, 260 / 2, U.UI / 2, "β:", "",
false);
CreativeGamma = new Button(340 + 260 / 2, U.UI / 2, 260 / 2, U.UI / 2,
"γ:", "", false);
CreativeShowTrue = new Button(660, 0, 170, U.UI, "True Position", "",
true);
CreativeShowLight = new Button(660 + 170, 0, 170, U.UI,
"Photon Shells", "", true);
CreativeHeading = new Button(340 + 260, U.UI / 2, U.UI / 2, U.UI / 2,
"", "", false);
CreativePointing = new Button(340 + 260 + U.UI / 2, U.UI / 2, U.UI / 2,
U.UI / 2, "", "", false);
CreativeAsteroids.setPrecision(false);
CreativeShowTrue.setIsYesNo(true);
CreativeShowLight.setIsYesNo(true);
CreativeBeta.setHighPrecision(true);
CreativeGamma.setHighPrecision(true);
heading_x = 340 + 260 + U.UI / 4;
heading_y = 3 * U.UI / 4;
pointing_x = 340 + 260 + (U.UI / 4) + (U.UI / 2);
pointing_y = 3 * U.UI / 4;
arrow_size = U.UI / 5;
} |
8139d740-39a4-4541-91ee-9903dbdb0a0c | public void ProcessMouseClick() {
if (U.currentMode == GameMode.GameOn
|| U.currentMode == GameMode.GameOver
|| U.currentMode == GameMode.Creative) {
if (Quit.GetHover() == true) {
U.currentMode = GameMode.Title;
U.titleCascade = 1;
}
}
if (U.currentMode == GameMode.Title) {
if (StartArcade.GetHover() == true) {
U.MAIN.NewGame();
U.currentMode = GameMode.GameOn;
} else if (StartCreative.GetHover() == true) {
U.MAIN.NewCreative();
U.currentMode = GameMode.Creative;
} else if (Start_Toggle_Doppler.GetHover() == true) {
U.flipDoppler();
} else if (Start_Toggle_LengthCon.GetHover() == true) {
U.flipLength();
// } else if (Start_Toggle_TimeCon.GetHover() == true) {
// U.option_Time = !U.option_Time;
} else if (Start_Toggle_Toroid.GetHover() == true) {
U.flipTorus();
}
} else if (U.currentMode == GameMode.Creative) {
if (CreativeShowLight.GetHover() == true) {
U.show_light_cones = !U.show_light_cones;
} else if (CreativeShowTrue.GetHover() == true) {
U.show_all_locations = !U.show_all_locations;
} else if (CreativeAsteroidV_Plus.GetHover() == true) {
U.modifyV(0.05f*U.getC());
} else if (CreativeAsteroidV_Minus.GetHover() == true) {
U.modifyV(-0.05f*U.getC());
} else if (CreativeC_Plus.GetHover() == true) {
U.modifyC(0.05f);
} else if (CreativeC_Minus.GetHover() == true) {
U.modifyC(-0.05f);
} else if (CreativeAsteroids_Plus.GetHover() == true) {
synchronized (U.list_of_rectangles_sync) {
U.list_of_rectangles_sync
.add(new Rectangle(
(int) (U.R.nextFloat()
* (U.world_x_pixels - 10) - U.world_x_pixels2),
(int) (U.R.nextFloat()
* (U.world_y_pixels - 10 - U.UI)
- U.world_y_pixels2 + U.UI),
7 + U.R.nextInt(5) - 2, 1f));
}
} else if (CreativeAsteroids_Minus.GetHover() == true) {
Rectangle toRemove = null;
synchronized (U.list_of_rectangles_sync) {
for (final Rectangle R : U.list_of_rectangles_sync) {
toRemove = R;
break;
}
}
synchronized (U.list_of_rectangles_sync) {
U.list_of_rectangles_sync.remove(toRemove);
}
}
} else if (U.currentMode == GameMode.GameOver) {
if (NewGame.GetHover() == true) {
U.MAIN.NewGame();
U.currentMode = GameMode.GameOn;
}
}
} |
f9f696f3-4c06-40f4-9e2c-3a5011b245fa | public void Render(Graphics2D _g2) {
_g2.setFont(display_font);
_g2.setColor(Color.black);
_g2.fillRect(0, 0, U.world_x_pixels, U.UI);
if (U.currentMode == GameMode.GameOver) {
NewGame.Render(_g2);
_g2.setColor(Color.white);
if (PlayingScore.GetValue() > U.highScore) {
U.highScore = (int) PlayingScore.GetValue();
_g2.drawString("New High Score!", 590, (U.UI / 2) + 8);
} else {
_g2.drawString((int) (U.highScore - PlayingScore.GetValue())
+ " Points From", 590, (U.UI / 2) - 3);
_g2.drawString("A High Score.", 610, (U.UI / 2) + 17);
}
}
if (U.currentMode == GameMode.GameOn
|| U.currentMode == GameMode.GameOver) {
Quit.Render(_g2);
PlayingC.SetValue(U.getC());
PlayingC.Render(_g2);
PlayingAsteroidSpeed.SetValue(U.getV() / U.getC());
PlayingAsteroidSpeed.Render(_g2);
PlayingLevel.SetValue(U.Level);
PlayingLevel.Render(_g2);
PlayingScore.Render(_g2);
RenderLives(_g2);
} else if (U.currentMode == GameMode.Title) {
StartArcade.Render(_g2);
StartCreative.Render(_g2);
Start_Toggle_Doppler.SetYesNoValue(U.getDoppler());
Start_Toggle_LengthCon.SetYesNoValue(U.getLength());
// Start_Toggle_TimeCon.SetYesNoValue(U.option_Time);
Start_Toggle_Toroid.SetYesNoValue(U.getTorus());
Start_Toggle_Doppler.Render(_g2);
Start_Toggle_LengthCon.Render(_g2);
// Start_Toggle_TimeCon.Render(_g2);
Start_Toggle_Toroid.Render(_g2);
_g2.setColor(Color.white);
_g2.drawString(String.format("Version: %.1f", U.version_number),
U.world_x_offset, 655);
} else if (U.currentMode == GameMode.Creative) {
Quit.Render(_g2);
CreativeBeta.SetValue((float) U.player.getBeta());
CreativeBeta.Render(_g2);
CreativeGamma.SetValue((float) U.player.getGamma());
CreativeGamma.Render(_g2);
CreativeC.SetValue(U.getC());
CreativeC.Render(_g2);
CreativeC_Plus.Render(_g2);
CreativeC_Minus.Render(_g2);
CreativeAsteroids.SetValue(U.getNRectangles());
CreativeAsteroids.Render(_g2);
CreativeAsteroids_Plus.Render(_g2);
CreativeAsteroids_Minus.Render(_g2);
CreativeAsteroidV.SetValue(U.getV() / U.getC());
CreativeAsteroidV.Render(_g2);
CreativeAsteroidV_Plus.Render(_g2);
CreativeAsteroidV_Minus.Render(_g2);
CreativeShowTrue.SetYesNoValue(U.show_all_locations);
CreativeShowLight.SetYesNoValue(U.show_light_cones);
CreativeShowTrue.Render(_g2);
CreativeShowLight.Render(_g2);
CreativeHeading.Render(_g2);
CreativePointing.Render(_g2);
// Draw heading
_g2.setColor(Color.RED);
_g2.drawLine(
heading_x,
heading_y,
(int) Math.round(heading_x
+ (arrow_size * Math.cos(U.player.getA()))),
(int) Math.round(heading_y
+ (arrow_size * Math.sin(U.player.getA()))));
_g2.setColor(Color.BLUE);
_g2.drawLine(
pointing_x,
pointing_y,
(int) Math.round(pointing_x
+ (arrow_size * U.player.getBeta() * Math
.cos(U.player.getHeading()))),
(int) Math.round(pointing_y
+ (arrow_size * U.player.getBeta() * Math
.sin(U.player.getHeading()))));
}
// Do FPS
_g2.setColor(Color.white);
_g2.drawString("FPS: " + U.MAIN.getFPS(), 900, 655);
} |
1dd38b64-d6f1-4304-a70e-7da644b272ec | public void RenderLives(Graphics2D _g2) {
if (U.Lives == 0)
return;
final int offset = 50;
for (int L = 1; L <= U.Lives; ++L) {
LivesShip.Render(_g2, U.world_x_pixels - (L * offset),
5 + U.UI / 2, -(float) Math.PI / 2f, false, false);
}
} |
052646e9-f6ef-4dfb-9c74-1ed47c4cc2c8 | SpriteShip(int _x, int _y) {
vel_x = U.getV();
vel_y = U.getV();
x = _x;
y = _y;
r = (5 * 4);
// make the shape
// int _s = 5;
// int _r = 5;
// myShapes.add( new Rectangle(_x - _r, _y - (3*_r), _s, new
// Color(112,146,190)) );//light blue
// myShapes.add( new Rectangle(_x + _r, _y - (3*_r), _s, new
// Color(112,146,190)) );//light blue
//
// myShapes.add( new Rectangle(_x - _r, _y - (2*_r), _s, new
// Color(112,146,190)) );//light blue
// myShapes.add( new Rectangle(_x + _r, _y - (2*_r), _s, new
// Color(112,146,190)) );//light blue
// myShapes.add( new Rectangle(_x , _y - (2*_r), _s, new
// Color(181,230,29 )) );//lime
//
// myShapes.add( new Rectangle(_x - _r, _y - _r, _s, new
// Color(181,230,29 )) );//lime
// myShapes.add( new Rectangle(_x + _r, _y - _r, _s, new
// Color(181,230,29 )) );//lime
// myShapes.add( new Rectangle(_x , _y - _r, _s, new Color(181,230,29 ))
// );//lime
//
// myShapes.add( new Rectangle(_x - (2*_r), _y, _r, new Color(163,73
// ,164)) );//violet
// myShapes.add( new Rectangle(_x - (1*_r), _y, _r, new Color(163,73
// ,164)) );//violet
// myShapes.add( new Rectangle(_x , _y, _r, new Color(163,73 ,164))
// );//violet
// myShapes.add( new Rectangle(_x + (1*_r), _y, _r, new Color(163,73
// ,164)) );//violet
// myShapes.add( new Rectangle(_x + (2*_r), _y, _r, new Color(163,73
// ,164)) );//violet
//
// myShapes.add( new Rectangle(_x - (2*_r), _y + _r, _s, new
// Color(163,73 ,164)) );//violet
// myShapes.add( new Rectangle(_x - (1*_r), _y + _r, _s, new Color(63
// ,72 ,204)) );//blue
// myShapes.add( new Rectangle(_x , _y + _r, _s, new Color(163,73 ,164))
// );//violet
// myShapes.add( new Rectangle(_x + (1*_r), _y + _r, _s, new Color(63
// ,72 ,204)) );//blue
// myShapes.add( new Rectangle(_x + (2*_r), _y + _r, _s, new
// Color(163,73 ,164)) );//violet
//
// myShapes.add( new Rectangle(_x - (3*_r), _y + (2*_r), _s, new
// Color(34 ,177,76 )) );//green
// myShapes.add( new Rectangle(_x - (2*_r), _y + (2*_r), _s, new
// Color(34 ,177,76 )) );//green
// myShapes.add( new Rectangle(_x - (1*_r), _y + (2*_r), _s, new
// Color(63 ,72 ,204)) );//blue
// myShapes.add( new Rectangle(_x , _y + (2*_r), _s, new Color(63 ,72
// ,204)) );//blue
// myShapes.add( new Rectangle(_x + (1*_r), _y + (2*_r), _s, new
// Color(63 ,72 ,204)) );//blue
// myShapes.add( new Rectangle(_x + (2*_r), _y + (2*_r), _s, new
// Color(34 ,177,76 )) );//green
// myShapes.add( new Rectangle(_x + (3*_r), _y + (2*_r), _s, new
// Color(34 ,177,76 )) );//green
//
// myShapes.add( new Rectangle(_x - (3*_r), _y + (3*_r), _s, new
// Color(34 ,177,76 )) );//green
// myShapes.add( new Rectangle(_x , _y + (3*_r), _s, new Color(237,28
// ,36 )) );//red
// myShapes.add( new Rectangle(_x + (3*_r), _y + (3*_r), _s, new
// Color(34 ,177,76 )) );//green
} |
ba245e75-b4eb-4ed5-83fc-99315267ec0e | void RenderReal(Graphics2D _g2) {
for (final Rectangle _r : myShapes) {
_g2.setColor(_r.shape_color);
// _g2.drawRoundRect((int)_r.x, (int)_r.y, _r.shape_size,
// _r.shape_size, _r.shape_size/2, _r.shape_size/2);
}
} |
759dd069-9ebc-4875-86f6-a566b7afeec7 | void Tick(int _tick) {
if (Math.abs(vel_x) != U.getV()) {
if (vel_x > 0) {
vel_x = U.getV();
} else {
vel_x = -U.getV();
}
if (vel_y > 0) {
vel_y = U.getV();
} else {
vel_y = -U.getV();
}
}
// check if need to change dir^n
if (y - r < 0) { // off top
vel_y = Math.abs(vel_y);
} else if (y + r > U.world_y_pixels) {
vel_y = -Math.abs(vel_y);
}
if (x - r < 0) { // off left
vel_x = Math.abs(vel_x);
} else if (x + r > U.world_x_pixels) {
vel_x = -Math.abs(vel_x);
}
x += vel_x;
y += vel_y;
for (final Rectangle _r : myShapes) {
// _r.ExternalMove(vel_x, vel_y);
_r.Tick(_tick);
}
} |
852f726a-569b-4cc5-ad37-74ea9586bb11 | public Debris(Rectangle R) {
super(R.x + R.shape_size2, R.y + R.shape_size2, R.vx, R.vy, (short) 0,
(short) 0);
vx *= 1 + U.R.nextFloat();
vy *= 1 + U.R.nextFloat();
float speed = (float) Math.hypot(vx, vy);
if (speed >= U.getC()) {
vx /= speed / U.getC();
vy /= speed / U.getC();
speed = (float) Math.hypot(vx, vy);
} else if (speed < 0.4f) {
vx /= speed / 0.4f;
vy /= speed / 0.4f;
speed = (float) Math.hypot(vx, vy);
}
r = 4;
dead = false;
GID = ++U.GID;
} |
cd99f976-f104-4fbf-bf17-4226f5e0feac | public void Constrain() {
if (x < (0 - U.world_x_pixels2)) {
Kill();
} else if (x + 2 * r >= U.world_x_pixels2) {
Kill();
} else if (y < (0 - U.world_y_pixels2 + U.UI)) {
Kill();
} else if (y + 2 * r >= U.world_y_pixels2) {
Kill();
}
} |
64e19d1a-9aad-46d4-9fa1-311330453fcb | public boolean GetDead() {
return dead;
} |
b5f9ac2e-7930-495a-8f37-2fb2d68944cb | public int getGID() {
return GID;
} |
60378c88-9161-4779-9ceb-920396e0a339 | public float GetSmear() {
return (1 + ((U.R.nextInt(20) - 10) * 0.3f));
} |
c4abae87-f67b-4e01-953b-64149b61d220 | public void Kill() {
dead = true;
} |
ffa5a1a4-feea-43fa-a78a-1ab7a6a1f78f | public void RenderReal(Graphics2D _g2) {
_g2.setColor(Color.gray);
_g2.drawOval(Math.round(x - r), Math.round(y - r), r * 2, r * 2);
} |
4ddc1777-3d87-43ef-889e-bdeba700fa3c | public void Tick(int _tick) {
if (GetDead() == true)
return;
if (dist_to_tick > U.granularity) {
dist_to_tick = 0;
P.AddShell(new PhotonShell(x, y, vx, vy, (short) 0, (short) 0, r,
Color.gray, GID, true));
}
} |
f864f9ce-47d0-4d17-bbd4-ac94bbf3c093 | public void Walk() {
if (GetDead() == true)
return;
x += vx;
y += vy;
dist_to_tick += ((speed * 2f) + (U.getC() * 2f));
Constrain();
} |
933abdae-93b4-4795-a5ca-45f5bdc424b5 | public BackgroundStar(float _x, float _y) {
x = _x;
y = _y;
} |
393b888d-1733-4498-8f19-a1f671c8391b | public void Render(Graphics2D _g2) {
_g2.setColor(Color.white);
_g2.fillRect((int) x, (int) y, 1, 1);
if (twinkle == 0 && U.R.nextFloat() < U.twinkle_prob) {
twinkle = 1;
twinkle_size = 1;
} else if (twinkle > 0) {
_g2.fillRect((int) x + twinkle_size, (int) y, 1, 1);
_g2.fillRect((int) x, (int) y + twinkle_size, 1, 1);
_g2.fillRect((int) x - twinkle_size, (int) y, 1, 1);
_g2.fillRect((int) x, (int) y - twinkle_size, 1, 1);
++twinkle;
if (twinkle % U.twinkle_speed == 0) {
++twinkle_size;
}
if (twinkle == U.twinkle_speed * 4) {
twinkle = 0;
}
}
} |
89777fe6-73ef-48e3-bc93-ed725e8fb492 | protected DopplerObject(float _x, float _y, float _vx, float _vy,
short _xo, short _yo) {
x = _x;
y = _y;
vx = _vx;
vy = _vy;
// x_offset = _xo;
// y_offset = _yo;
} |
aad2f2ab-a533-4a0d-ac79-9d22c6d3d76d | protected void DoSuperLumiSpikes(Graphics2D _g2, float ss2) {
_g2.setColor(shape_color);
for (int S = 0; S < U.superLumiSpikes; ++S) {
final double randomAngle = (U.R.nextFloat() * Math.PI * 2);
final int sx = (int) (x + ss2 + ((U.R.nextInt(U.superLumiSpikeSize) + 5) * Math
.cos(randomAngle)));
final int sy = (int) (y + ss2 + ((U.R.nextInt(U.superLumiSpikeSize) + 5) * Math
.sin(randomAngle)));
_g2.drawLine((int) (x + ss2), (int) (y + ss2), sx, sy);
}
} |
8e6c1838-f82b-42b0-8286-2d6364076578 | protected double GetRelativeDoppler() {
final double angle = Math.atan2((x - U.player.x), (y - U.player.y));
// System.out.println("angle to player: "+ Math.toDegrees(angle));
// calculate my velocity along this axis
final double my_vx_axis = vx * Math.sin(angle);
final double my_vy_axis = vy * Math.cos(angle);
final double my_axis_velocity = Math.hypot(my_vx_axis, my_vy_axis);
final double pl_vx_axis = U.player.vx * Math.sin(angle);
final double pl_vy_axis = U.player.vy * Math.cos(angle);
final double pl_axis_velocity = Math.hypot(pl_vx_axis, pl_vy_axis);
double doppler = (my_axis_velocity - pl_axis_velocity)
/ Math.sqrt(1 - ((my_axis_velocity * pl_axis_velocity) / (U
.getC() * U.getC())));
//normalise
doppler /= U.getC();
//System.out.println("Debug game gamma: "+doppler);
if (my_vx_axis + my_vy_axis + pl_vx_axis + pl_vy_axis < 0) {
doppler *= -1;
}
if (doppler > 1f) {
doppler = 1f;
} else if (doppler < -1f) {
doppler = -1f;
}
return doppler;
// System.out.println("speed to player: "+ pl_axis_velocity + " angle "
// + Math.toDegrees(angle) + " DOPPLER " + doppler);
} |
1c882e7e-2d14-47cd-acf4-9f39e13eace2 | protected void SetDopplerColourMap() {
final int fractionRed = (int) (((GetRelativeDoppler() + 1f) / 2f) * 255);
final int fractionBlu = 255 - fractionRed;
// if (x_offset != (short)0 || y_offset != (short)0) {
// fractionRed /= 4;
// fractionBlu /= 4;
// }
shape_color = new Color(fractionRed, 0, fractionBlu);
} |
63b0b993-d315-4768-b8e0-03ddbe6dc361 | public ShipGraphic(int _scale) {
scale = _scale;
ship.addPoint(0 * scale, 0 * scale);
ship.addPoint(10 * scale, 0 * scale);
ship.addPoint(-5 * scale, 5 * scale);
ship.addPoint(-2 * scale, 0 * scale);
ship.addPoint(-5 * scale, -5 * scale);
ship.addPoint(10 * scale, 0 * scale);
} |
a2a1187f-e827-49ad-a6f5-7feec44424da | public void Render(Graphics2D _g2, int x, int y, float a,
boolean accelerating, boolean dmg) {
_g2.translate(x, y);
_g2.rotate(a);
if (accelerating == true) {
_g2.setColor(Color.orange);
_g2.fillOval(-5 * scale, -2 * scale, 4 * scale, 4 * scale);
_g2.setColor(Color.red);
for (int S = 0; S < U.superLumiSpikes; ++S) {
final double randomAngle = (U.R.nextFloat() * Math.PI * 2);
final int sx = (int) (-3 * scale + (scale * 5 * Math
.cos(randomAngle)));
final int sy = (int) (0 + (scale * 5 * Math.sin(randomAngle)));
_g2.drawLine(-3 * scale, 0, sx, sy);
}
}
_g2.setColor(Color.white);
_g2.fillPolygon(ship);
if (dmg == true) {
_g2.setColor(Color.red);
for (int S = 0; S < U.superLumiSpikes * 2; ++S) {
final double randomAngle = (U.R.nextFloat() * Math.PI * 2);
final int sx = (int) (0 + (scale * 8 * Math.cos(randomAngle)));
final int sy = (int) (0 + (scale * 8 * Math.sin(randomAngle)));
_g2.drawLine(0, 0, sx, sy);
}
}
_g2.rotate(-a);
_g2.translate(-x, -y);
} |
d06a3c72-2eac-41c0-aec4-ca5c12fcc34f | public static Utility GetUtility() {
return singleton;
} |
fd132164-421d-427b-b2d7-659409bdaa37 | private Utility() {
} |
2fb708d0-400b-42c8-aa7a-d91c0215406a | public float getC() {
return c_pixel;
} |
95671979-10c1-4521-8726-89225aa21d56 | public boolean getDoppler() {
return option_Doppler;
} |
57d3a650-30af-48a8-9da1-e75b08ef5ec4 | public boolean getLength() {
return option_Length;
} |
a3f4fde5-0fbb-4946-a5da-f08bbeb9ce0f | public boolean getTorus() {
return option_Torus;
} |
94e38c18-d107-48d3-9e71-0c1fa4a24f71 | public void flipDoppler() {
option_Doppler = !option_Doppler;
} |
1c45c5cc-c74e-44c3-bb9f-250f01f706c0 | public void flipLength() {
option_Length = !option_Length;
} |
0e7aa715-93f6-4639-977d-ff3b35b6f2a7 | public void flipTorus() {
option_Torus = !option_Torus;
} |
a6bdf331-73ee-4c63-8d94-9f61811439ab | public int getNRectangles() {
return list_of_rectangles.size();
} |
75e67fc7-abb8-4e02-a600-4351c8a2747e | public float getV() {
return velocity;
} |
634cddec-3ab0-4464-8e7d-5c185d0f8f78 | public void modifyC(float mod) {
setC(c_pixel + mod);
} |
c094aba6-394f-4f3c-9bbe-9f4adc4b8df5 | public void modifyV(float mod) {
setV(velocity + mod);
} |
96195d5a-24de-43d9-901e-c93d38ca744b | public void setC(float C) {
if (C > 1f) {
C = 1f;
} else if (C < 0.2f) {
C = 0.2f;
}
c_pixel = C;
if (player != null) {
player.ChangeFrame();
}
} |
fc3dcfc7-ae62-4126-9805-d8bc8e7a517c | public void setV(float V) {
if (V > 1f) {
V = 1f;
} else if (V < 0.f) {
V = 0f;
}
velocity = V;
synchronized (list_of_rectangles_sync) {
for (final Rectangle R : list_of_rectangles_sync) {
R.ChangeFrame();
}
}
} |
d6e4f1f2-1284-4620-8e04-a531309918c6 | public void Clear() {
synchronized (U.list_of_rectangles_sync) {
U.list_of_rectangles_sync.clear();
}
synchronized (U.list_of_debris_sync) {
U.list_of_debris_sync.clear();
}
P.Clear();
} |
f27a1f60-2f58-4858-811a-cb28b705a223 | public boolean CollisionCheck() {
// Also does points
float pointsScored = 0;
final LinkedList<Rectangle> ToRemove = new LinkedList<Rectangle>();
synchronized (U.list_of_rectangles_sync) {
for (final Rectangle R : U.list_of_rectangles_sync) {
final float sep_x = (R.x + R.shape_size2) - U.player.x;
final float sep_y = (R.y + R.shape_size2) - U.player.y;
final double sep = Math.hypot(sep_x, sep_y);
pointsScored += 1f / sep;
if (sep < (R.shape_size2 + 4.)) {
for (int i = 0; i < U.NDebris; ++i) {
synchronized (U.list_of_debris_sync) {
U.list_of_debris_sync.add(new Debris(R));
}
}
ToRemove.add(R);
--U.Lives;
if (U.Lives <= 0) {
U.Lives = 0;
} else {
U.player.Damage();
}
}
}
pointsScored *= U.Level;
if (U.currentMode == GameMode.GameOn) {
B.PlayingScore.AddValue(pointsScored);
}
if (ToRemove.size() > 0) {
synchronized (U.list_of_debris_sync) {
U.list_of_rectangles_sync.removeAll(ToRemove);
}
if (U.Lives == 0) return true; //disable this line to CHEAT
}
}
return false;
} |
d07884d3-204c-4ecf-9de1-31246ae93976 | public void DebrisCleanup() {
final LinkedList<Debris> ToRemove = new LinkedList<Debris>();
synchronized (U.list_of_debris_sync) {
for (final Debris _d : U.list_of_debris_sync) {
if (_d.GetDead() == true) {
ToRemove.add(_d);
}
}
}
synchronized (U.list_of_debris_sync) {
U.list_of_debris_sync.removeAll(ToRemove);
}
} |
22e03e77-f68e-4c67-a280-f5ddded1441f | @Override
public void destroy() {
} |
c0851fa7-10ea-45b0-9989-15cc7235d6d0 | private void doLengthContractionTransform(Graphics2D g2) {
g2.rotate(U.player.getHeading());
double LC = 1./((((double)U.player.getGamma() - 1) * (1 - U.length_cont_red)) + 1.);
//System.out.println("LC " + LC);
g2.scale(LC, 1.);
g2.rotate(-U.player.getHeading());
} |
e3c82a4e-b806-47b1-a6d9-2d31ccb5416c | public long getFPS() {
return _FPS;
} |
9a4882b3-5c12-4437-8fbe-a9f47af78ff3 | @Override
public void init() {
setSize(U.world_x_pixels + (2 * U.world_x_offset), U.world_y_pixels
+ (2 * U.world_y_offset));
U.MAIN = this;
System.out.println("World is "
+ (U.world_x_pixels + (2 * U.world_x_offset)) + "x"
+ (U.world_y_pixels + (2 * U.world_y_offset)));
addMouseMotionListener(this);
addMouseListener(this);
addKeyListener(this);
for (int i = 0; i < U.twinkle_stars; ++i) {
U.list_of_stars.add(new BackgroundStar(U.R.nextFloat()
* U.world_x_pixels - U.world_x_pixels2, U.R.nextFloat()
* (U.world_y_pixels - U.UI) - U.world_y_pixels2 + U.UI));
}
} |
5554c524-c070-4e5a-b01f-63fa375156b2 | @Override
public void keyPressed(KeyEvent e) {
if (e.getKeyChar() == 'w' || e.getKeyChar() == 'W'
|| e.getKeyCode() == KeyEvent.VK_UP) {
N = true;
}
if (e.getKeyChar() == 'd' || e.getKeyChar() == 'D'
|| e.getKeyCode() == KeyEvent.VK_RIGHT) {
E = true;
}
if (e.getKeyChar() == 's' || e.getKeyChar() == 'S'
|| e.getKeyCode() == KeyEvent.VK_DOWN) {
S = true;
}
if (e.getKeyChar() == 'a' || e.getKeyChar() == 'A'
|| e.getKeyCode() == KeyEvent.VK_LEFT) {
W = true;
}
} |
706fee37-a0df-4d97-a149-74b97c1d3670 | @Override
public void keyReleased(KeyEvent e) {
if (e.getKeyChar() == 'w' || e.getKeyChar() == 'W'
|| e.getKeyCode() == KeyEvent.VK_UP) {
N = false;
}
if (e.getKeyChar() == 'd' || e.getKeyChar() == 'D'
|| e.getKeyCode() == KeyEvent.VK_RIGHT) {
E = false;
}
if (e.getKeyChar() == 's' || e.getKeyChar() == 'S'
|| e.getKeyCode() == KeyEvent.VK_DOWN) {
S = false;
}
if (e.getKeyChar() == 'a' || e.getKeyChar() == 'A'
|| e.getKeyCode() == KeyEvent.VK_LEFT) {
W = false;
}
} |
5c0ef1d9-1f64-4ef3-bc2b-d56c4fae38d1 | @Override
public void keyTyped(KeyEvent e) {
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.