i made a booboo

master
Marcus Gosselin 2015-03-03 14:44:52 -05:00
parent ed490d5cfc
commit bac8633be7
15 changed files with 47 additions and 24 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/MAndEngine"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>

1
.gitignore vendored
View File

@ -43,3 +43,4 @@ Icon
Network Trash Folder
Temporary Items
.apdisk
/bin/

View File

@ -8,6 +8,7 @@ import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.Transparency;
import java.awt.event.KeyEvent;
import java.awt.image.BufferedImage;
import java.net.URL;
@ -189,7 +190,7 @@ public class SpaceWars implements BasicApp {
try {
background = ImageIO.read(new URL("http://wallpapersus.com/wallpapers/2012/10/Cool-Wave-600x1024.jpg"));
} catch (Exception e) {
background = (Image) new BufferedImage(1024, 600, BufferedImage.TRANSLUCENT);
background = new BufferedImage(1024, 600, Transparency.TRANSLUCENT);
Graphics g = background.getGraphics();
g.setColor(Color.BLUE);
g.fillRect(0, 0, 1024, 600);

View File

@ -21,7 +21,7 @@ public class Player extends Entity {
private boolean goBoom = false;
public Player() {
super((int) 512, (int) 550, WIDTH, HEIGHT);
super(512, 550, WIDTH, HEIGHT);
}
@Override

View File

@ -30,6 +30,7 @@ public class BasicPlayerBullet extends Bullet {
updateBoundingBox((int) this.x, (int) this.y, WIDTH, HEIGHT);
}
@Override
public int tick() {
if (alive) {
if (direction == Direction.UP) {
@ -58,6 +59,7 @@ public class BasicPlayerBullet extends Bullet {
return 0;
}
@Override
public void render(Graphics g) {
g.setColor(Color.BLACK);
if (alive)
@ -74,11 +76,13 @@ public class BasicPlayerBullet extends Bullet {
return 1;
}
public int getWIDTH(){
@Override
public int getWIDTH(){
return WIDTH;
}
public int getHEIGHT(){
@Override
public int getHEIGHT(){
return HEIGHT;
}

View File

@ -19,11 +19,13 @@ public class PlayerExplodeBullet extends Bullet {
private final int size;
private static final double PHI = 1.618033988749894848204586;
public int getWIDTH(){
@Override
public int getWIDTH(){
return WIDTH;
}
public int getHEIGHT(){
@Override
public int getHEIGHT(){
return HEIGHT;
}
@ -45,6 +47,7 @@ public class PlayerExplodeBullet extends Bullet {
}
@Override
public int tick() {
if (alive) {
if (direction == Direction.UP) {
@ -75,6 +78,7 @@ public class PlayerExplodeBullet extends Bullet {
return 0;
}
@Override
public void render(Graphics g) {
g.setColor(Color.BLACK);
if (alive)

View File

@ -16,11 +16,13 @@ public class PlayerImpactBullet extends Bullet {
private boolean alive = true;
private final int level;
public int getWIDTH(){
@Override
public int getWIDTH(){
return WIDTH;
}
public int getHEIGHT(){
@Override
public int getHEIGHT(){
return HEIGHT;
}
@ -40,6 +42,7 @@ public class PlayerImpactBullet extends Bullet {
this.level = level;
}
@Override
public int tick() {
if (alive) {
if (direction == Direction.UP) {
@ -68,6 +71,7 @@ public class PlayerImpactBullet extends Bullet {
return 0;
}
@Override
public void render(Graphics g) {
g.setColor(Color.BLACK);
if (alive)

View File

@ -17,11 +17,13 @@ public class PlayerPiercingBullet extends Bullet {
private final boolean INFINISHOT;
final boolean lolface = true;
public int getWIDTH(){
@Override
public int getWIDTH(){
return WIDTH;
}
public int getHEIGHT(){
@Override
public int getHEIGHT(){
return HEIGHT;
}
@ -42,6 +44,7 @@ public class PlayerPiercingBullet extends Bullet {
INFINISHOT = b;
}
@Override
public int tick() {
oldX = x;
oldY = y;

View File

@ -137,7 +137,7 @@ public class BlueEnemy extends Enemy {
g.setColor(color);
int temp;
try{
temp = r.nextInt((int)(0-((double)absoluteTime/20d))+5);
temp = r.nextInt((int)(0-(absoluteTime/20d))+5);
}catch(Exception e){
temp = 0;
}

View File

@ -142,7 +142,7 @@ public class GreenEnemy extends Enemy {
g.setColor(color);
int temp;
try{
temp = r.nextInt((int)(0-((double)absoluteTime/20d))+5);
temp = r.nextInt((int)(0-(absoluteTime/20d))+5);
}catch(Exception e){
temp = 0;
}

View File

@ -137,7 +137,7 @@ public class NormalEnemy extends Enemy {
g.setColor(color);
int temp;
try{
temp = r.nextInt((int)(0-((double)absoluteTime/20d))+5);
temp = r.nextInt((int)(0-(absoluteTime/20d))+5);
}catch(Exception e){
temp = 0;
}

View File

@ -27,7 +27,8 @@ public class RedEnemy extends Enemy {
}
public int tick() {
@Override
public int tick() {
// epic AI
if((int)healthBar <= 0){
alive = false;
@ -130,11 +131,12 @@ public class RedEnemy extends Enemy {
private Random r = new Random();
private int absoluteTime = 0;
public void render(Graphics g) {
@Override
public void render(Graphics g) {
g.setColor(color);
int temp;
try{
temp = r.nextInt((int)(0-((double)absoluteTime/20d))+5);
temp = r.nextInt((int)(0-(absoluteTime/20d))+5);
}catch(Exception e){
temp = 0;
}

View File

@ -22,9 +22,9 @@ public class Shop {
public void tick(){
if(state == ON && !(animationTime > BOX_WIDTH)){
animationTime+=(double)(MAX_ANIMATION_TIME-animationTime)/6;
animationTime+=(MAX_ANIMATION_TIME-animationTime)/6;
}else if(state == OFF && !(animationTime < 0)){
animationTime+=(double)(0-animationTime)/6;
animationTime+=(0-animationTime)/6;
}
if(animationTime < 0.49d){
selection = 0;

View File

@ -70,10 +70,11 @@ public class CollisionParticle extends Entity {
this.damage = damage;
}
@Override
public int tick() {
if (life < moveLife) {
x += Math.cos(((double) angleDeg * Math.PI) / 180d) * speed;
y += Math.sin(((double) angleDeg * Math.PI) / 180d) * speed;
x += Math.cos((angleDeg * Math.PI) / 180d) * speed;
y += Math.sin((angleDeg * Math.PI) / 180d) * speed;
}
speed /= DECAY;
if (life > renderLife)
@ -100,6 +101,7 @@ public class CollisionParticle extends Entity {
return 0;
}
@Override
public void render(Graphics g) {
if (alive) {
g.setColor(color);

View File

@ -63,16 +63,17 @@ public class Particle extends Entity{
} else {
color = new Color(rand(0, 256), rand(0, 256), rand(0, 256));
}
updateBoundingBox((int)x, (int)y, size , size);
updateBoundingBox(x, y, size , size);
}
private static final double PHI = 1.618033988749894848204586;
@Override
public int tick() {
if (life < moveLife) {
x += Math.cos(((double) angleDeg * Math.PI) / 180d) * speed;
y += Math.sin(((double) angleDeg * Math.PI) / 180d) * speed;
x += Math.cos((angleDeg * Math.PI) / 180d) * speed;
y += Math.sin((angleDeg * Math.PI) / 180d) * speed;
}
speed /= PHI;
if (life > renderLife)
@ -87,6 +88,7 @@ public class Particle extends Entity{
return 0;
}
@Override
public void render(Graphics g) {
if (alive) {
g.setColor(color);