Pastebin
API
tools
faq
paste
Login
Sign up
Please fix the following errors:
New Paste
Syntax Highlighting
package com.seaney.ld30; import java.awt.Canvas; import java.awt.Color; import java.awt.Cursor; import java.awt.Dimension; import java.awt.Font; import java.awt.Graphics; import java.awt.Image; import java.awt.Point; import java.awt.Toolkit; import java.awt.image.*; import java.util.ArrayList; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JOptionPane; import javax.swing.UIManager; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.Writer; import java.net.URISyntaxException; import com.seaney.ld30.input.Controller; import com.seaney.ld30.input.InputHandler; import com.seaney.ld30.GUI.Launcher; import com.seaney.ld30.graphics.Animation; import com.seaney.ld30.graphics.Sprite; import com.seaney.ld30.Game; public class Display extends Canvas implements Runnable{ static Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); private static final long serialVersionUID = 1L; public static int width = 1280; public static int height = 720; public static boolean paused = false; private Thread thread; private boolean running = false; private Game game; private InputHandler input; private long passedTime; private Image back; private Image cursor; private Image platformI; private Animation platformA; private Image[] manRunRI = new Image[10]; private Animation manRunRA; private Image[] manRunLI = new Image[10]; private Animation manRunLA; private Image manStillI; private Animation manStillA; private Image manStilllI; private Animation manStilllA; private Sprite man; private Sprite[] platform = new Sprite[50]; private Image bulletI; private Animation bulletA; private Sprite[] bullet = new Sprite[20]; private Image gruntI; private Animation gruntA; private Image gruntrI; private Animation gruntrA; private Image gruntdI; private Animation gruntdA; private Sprite[] grunt = new Sprite[30]; private Image bossI; private Animation bossA; private Sprite boss; private Image shipI; private Animation shipA; private Sprite ship; private Image enbulletI; private Animation enbulletA; private Sprite[] enbullet = new Sprite[60]; private int currentWeapon; private int maxWeapon; private int[] clip = new int[6]; private int[] maxClip = new int[6]; private int[] rounds = new int[6]; private int[] fireRate = new int[6]; private int maxLevel; private int curLevel; private int world; private int level; private int offset = 0; private boolean prevPunch; private boolean prevReload; private boolean prevPaused; private boolean prevRight; private boolean reloadPunch; private Cursor crosshair; public Display(int cWorld, int cLevel) { Dimension size = new Dimension(width, height); setPreferredSize(size); setMinimumSize(size); setMaximumSize(size); level = cLevel; world = cWorld; game = new Game(); input = new InputHandler(); addKeyListener(input); addMouseListener(input); addFocusListener(input); addMouseMotionListener(input); initialProcesses(); } private void initialProcesses(){ if(world == 0){ back = new ImageIcon("res\\images\\back1.png").getImage(); platformI = new ImageIcon("res\\images\\platform1.png").getImage(); } if(world == 1){ back = new ImageIcon("res\\images\\back2.png").getImage(); platformI = new ImageIcon("res\\images\\platform2.png").getImage(); } manStillI = new ImageIcon("res\\images\\manStill.png").getImage(); manStilllI = new ImageIcon("res\\images\\manStilll.png").getImage(); cursor = new ImageIcon("res\\images\\crosshair.png").getImage(); bulletI = new ImageIcon("res\\images\\bullet.png").getImage(); enbulletI = new ImageIcon("res\\images\\enbullet.png").getImage(); gruntI = new ImageIcon("res\\images\\enemyStill.png").getImage(); gruntrI = new ImageIcon("res\\images\\enemyStillr.png").getImage(); gruntdI = new ImageIcon("res\\images\\enemyDead.png").getImage(); bossI = new ImageIcon("res\\images\\boss.png").getImage(); shipI = new ImageIcon("res\\images\\ship.png").getImage(); curLevel = (world * 3) + level; clip[0] = 6; clip[1] = 12; clip[2] = 30; clip[3] = 24; clip[4] = 50; clip[5] = 100; maxClip[0] = 6; maxClip[1] = 12; maxClip[2] = 30; maxClip[3] = 24; maxClip[4] = 50; maxClip[5] = 100; rounds[0] = 120; rounds[1] = 240; rounds[2] = 600; rounds[3] = 480; rounds[4] = 1000; rounds[5] = 10000; fireRate[0] = 800; fireRate[1] = 600; fireRate[2] = 400; fireRate[3] = 300; fireRate[4] = 100; fireRate[5] = 40; platformA = new Animation(); platformA.addScene(platformI, 10000); manStillA = new Animation(); manStillA.addScene(manStillI, 200000000); manStilllA = new Animation(); manStilllA.addScene(manStilllI, 200000000); bulletA = new Animation(); bulletA.addScene(bulletI, 1000); enbulletA = new Animation(); enbulletA.addScene(enbulletI, 1000); gruntA = new Animation(); gruntA.addScene(gruntI, 100); gruntrA = new Animation(); gruntrA.addScene(gruntrI, 100); gruntdA = new Animation(); gruntdA.addScene(gruntdI, 100); shipA = new Animation(); shipA.addScene(shipI, 100); bossA = new Animation(); bossA.addScene(bossI, 100); ship = new Sprite(shipA); ship.setX(9500); ship.setY(550); boss = new Sprite(bossA); boss.hidden = true; if(world == 1 && level == 2){ boss.hidden = false; boss.setX(6000); boss.setY(400); boss.health = 5000; boss.fireRate = 300; } for(int i = 0; i < platform.length; i++){ platform[i] = new Sprite(platformA); platform[i].hidden = true; } man = new Sprite(manStillA); man.setX(300); man.setY(300); man.health = 100; man.reloadRate = 2000; for(int i = 0; i < bullet.length; i++){ bullet[i] = new Sprite(bulletA); bullet[i].hidden = true; } for(int i = 0; i < grunt.length; i++){ grunt[i] = new Sprite(gruntA); grunt[i].hidden = true; grunt[i].health = 20; grunt[i].fireRate = 1000; grunt[i].aware = 0; } for(int i = 0; i < enbullet.length; i++){ enbullet[i] = new Sprite(enbulletA); enbullet[i].hidden = true; } Toolkit toolkit = Toolkit.getDefaultToolkit(); crosshair = toolkit.createCustomCursor(cursor, new Point(15,15), null); setCursor(crosshair); try{ FileReader pr = new FileReader(System.getProperty("user.dir") + "\\res\\levels\\data\\world" + world + "\\p" + level + ".txt"); BufferedReader p = new BufferedReader(pr); int i = 0; String platforms = p.readLine(); while(platforms != null){ String[] splatform = platforms.split(","); int x = Integer.parseInt(splatform[0]); int y = Integer.parseInt(splatform[1]); platform[i].hidden = false; platform[i].setX(x); platform[i].setY(y); platform[i].health = 50; i++; platforms = p.readLine(); } pr = new FileReader(System.getProperty("user.dir") + "\\res\\levels\\data\\world" + world + "\\g" + level + ".txt"); p = new BufferedReader(pr); i = 0; platforms = p.readLine(); while(platforms != null){ String[] splatform = platforms.split(","); int x = Integer.parseInt(splatform[0]); int y = Integer.parseInt(splatform[1]); int face = Integer.parseInt(splatform[2]); grunt[i].hidden = false; grunt[i].setX(x); grunt[i].setY(y-50); grunt[i].facing = face; i++; platforms = p.readLine(); } pr = new FileReader(System.getProperty("user.dir") + "\\res\\data\\weapons.txt"); p = new BufferedReader(pr); i = 0; platforms = p.readLine(); while(platforms != null){ int x = Integer.parseInt(platforms); maxWeapon+=x; i++; platforms = p.readLine(); } pr = new FileReader(System.getProperty("user.dir") + "\\res\\data\\levels.txt"); p = new BufferedReader(pr); i = 0; platforms = p.readLine(); while(platforms != null){ int x = Integer.parseInt(platforms); maxLevel+=x; i++; platforms = p.readLine(); } } catch(IOException ex){ } } public void run() { long previousTime = System.nanoTime(); while(running) { long currentTime = System.nanoTime(); passedTime = currentTime - previousTime; previousTime = currentTime; requestFocus(); render(); loop(); update(passedTime); } } public void loop(){ game.loop(input.key); if(Controller.pause && !prevPaused){ if(paused){ paused = false; }else if(!paused){ paused = true; } } if (!paused){ man.grav = true; Controller.canJump = false; for (int i = 0; i < platform.length; i++){ if (collision(man,platform[i])){ if (man.getVelocityY() >= 0 && man.getY() + man.getHeight() < platform[i].getY() + 5){ man.grav = false; Controller.canJump = true; man.setVelocityY(0); } } } if (InputHandler.right && !prevRight){ if(currentWeapon + 1< maxWeapon){ currentWeapon++; } else{ currentWeapon = 0; } } if (Controller.left && man.getX() > 0){ if (Controller.sprint){ man.setVelocityX(-0.0000003f); } else{ man.setVelocityX(-0.0000002f); } } else if (Controller.right && man.getX() + man.getWidth() < 10000){ if (Controller.sprint){ man.setVelocityX(0.0000003f); } else{ man.setVelocityX(0.0000002f); } } else{ man.setVelocityX(0); } if (Controller.jump){ man.gravity = 0; man.setVelocityY(-0.0000006f); Controller.canJump = false; Controller.jump = false; man.grav = true; } if (man.getY() + man.getHeight() > 600){ man.setY(600 - man.getHeight()); if (man.getVelocityY() >= 0){ man.grav = false; Controller.canJump = true; man.setVelocityY(0); } } if (man.getX() - offset > 600 && offset < 10000 - 1280){ offset++; } if (man.getX() - offset < 200 && offset > 0){ offset--; } if (man.grav == true){ man.gravity = man.gravitya; } else{ man.gravity = 0; } man.setVelocityY(man.getVelocityY() + man.gravity * passedTime); if(InputHandler.mouseX < man.getX() - offset){ man.facing = -1; } else{ man.facing = 1; } if(man.facing == 1){ man.setAnimation(manStillA); } else{ man.setAnimation(manStilllA); } if(InputHandler.clicked && !man.punching && !man.reloading){ if(clip[currentWeapon] > 0){ float yrat = ((720f - InputHandler.mouseY) - (720f - man.getY()))/(InputHandler.mouseX - man.getX() + offset); for(int i = 0; i < bullet.length; i++){ if(bullet[i].hidden && System.currentTimeMillis() > man.timeLastFired + fireRate[currentWeapon]){ bullet[i].hidden = false; bullet[i].setX(man.getX()); bullet[i].setY(man.getY()); if(InputHandler.mouseX > man.getX() - offset){ bullet[i].setVelocityX(0.000001f); bullet[i].setVelocityY(0.000001f * -yrat); } else{ bullet[i].setVelocityX(-0.000001f); bullet[i].setVelocityY(0.000001f * yrat); } man.timeLastFired = System.currentTimeMillis(); float mod = (float) (0.000001/(Math.sqrt(bullet[i].getVelocityX() * bullet[i].getVelocityX() + bullet[i].getVelocityY() * bullet[i].getVelocityY()))); bullet[i].setVelocityX(bullet[i].getVelocityX() * mod); bullet[i].setVelocityY(bullet[i].getVelocityY() * mod); clip[currentWeapon]--; rounds[currentWeapon]--; break; } } } else{ man.timeLastReloaded = System.currentTimeMillis(); man.reloading = true; } } if(Controller.reload && !prevReload && !man.reloading && !man.punching){ man.reloading = true; man.timeLastReloaded = System.currentTimeMillis(); } if(Controller.punch && !prevPunch && !man.punching){ man.punching = true; man.punchTime = System.currentTimeMillis(); if(man.reloading){ reloadPunch = true; man.reloading = false; } } if(System.currentTimeMillis() > man.punchTime + 100 && man.punching){ man.punching = false; if(reloadPunch){ man.reloading = true; man.timeLastReloaded = System.currentTimeMillis(); reloadPunch = false; } } if(man.reloading && System.currentTimeMillis() > man.timeLastReloaded + man.reloadRate){ clip[currentWeapon] = maxClip[currentWeapon]; man.reloading = false; } for(int i = 0; i < bullet.length; i++){ if(!bullet[i].hidden && (bullet[i].getX() > 1280 + offset || bullet[i].getX() < offset || bullet[i].getY() > 720 || bullet[i].getY() < 0)){ bullet[i].hidden = true; } } for(int i = 0; i < enbullet.length; i++){ if(!enbullet[i].hidden && (enbullet[i].getX() > 1280 + offset || enbullet[i].getX() < offset || enbullet[i].getY() > 720 || enbullet[i].getY() < 0)){ enbullet[i].hidden = true; } } for(int i = 0; i < enbullet.length; i++){ if(collision(enbullet[i],man)){ man.health -= 10; enbullet[i].hidden = true; } } for(int i = 0; i < platform.length; i++){ for(int ii = 0; ii < bullet.length; ii++){ if(collision(platform[i], bullet[ii])){ platform[i].health -= 10; bullet[ii].hidden = true; } } for(int ii = 0; ii < enbullet.length; ii++){ if(collision(platform[i], enbullet[ii])){ platform[i].health -= 10; enbullet[ii].hidden = true; } } } for(int i = 0; i < platform.length; i++){ if(platform[i].health <= 0 && !platform[i].hidden){ platform[i].hidden = true; for(int ii = 0; ii < grunt.length; ii++){ if(grunt[ii].getX() < offset + 1200 && grunt[ii].getX() > offset && !grunt[ii].hidden){ grunt[ii].aware = 1; } } } } if(man.health <= 0){ JOptionPane.showMessageDialog(getParent(), "You Died :("); final String javaBin = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java"; File currentJar; try { currentJar = new File(Display.class.getProtectionDomain().getCodeSource().getLocation().toURI()); System.out.println(Display.class.getProtectionDomain().getCodeSource().getLocation().toURI()); if(!currentJar.getName().endsWith(".jar")) return; final ArrayList<String> command = new ArrayList<String>(); command.add(javaBin); command.add("-jar"); command.add(currentJar.getPath()); final ProcessBuilder builder = new ProcessBuilder(command); builder.start(); System.exit(0); } catch (URISyntaxException | IOException e) { e.printStackTrace(); } stop(); } for(int i = 0; i < grunt.length; i++){ grunt[i].grav = true; for (int ii = 0; ii < platform.length; ii++){ if (collision(grunt[i],platform[ii])){ if (grunt[i].getVelocityY() >= 0 && grunt[i].getY() + grunt[i].getHeight() < platform[ii].getY() + 5){ grunt[i].grav = false; grunt[i].setVelocityY(0); } } } if (grunt[i].getY() + grunt[i].getHeight() > 600){ grunt[i].setY(600 - grunt[i].getHeight()); if (grunt[i].getVelocityY() >= 0){ grunt[i].grav = false; grunt[i].setVelocityY(0); } } if (grunt[i].grav == true){ grunt[i].gravity = grunt[i].gravitya; } else{ grunt[i].gravity = 0; } grunt[i].setVelocityY(grunt[i].getVelocityY() + (grunt[i].gravity * passedTime)); for(int ii = 0; ii < bullet.length; ii++){ if(collision(grunt[i], bullet[ii])){ if(grunt[i].aware == 0 || grunt[i].aware == 1){ grunt[i].health -= 20; bullet[ii].hidden = true; } else{ grunt[i].health -= 10; bullet[ii].hidden = true; } } } if(grunt[i].facing == -1){ grunt[i].setAnimation(gruntA); } else{ grunt[i].setAnimation(gruntrA); } if(grunt[i].dead){ grunt[i].setAnimation(gruntdA); } if(collision(man,grunt[i])){ if(man.punching){ grunt[i].health -= 20; } else if(grunt[i].punching){ man.health -= 10; man.setX(man.getX() - 100); } else{ if(!grunt[i].punchT){ grunt[i].punchT = true; grunt[i].colTime = System.currentTimeMillis(); } } if(grunt[i].punching && System.currentTimeMillis() > grunt[i].punchTime){ grunt[i].punching = false; } if(System.currentTimeMillis() > grunt[i].colTime + 400 && !grunt[i].punching && grunt[i].punchT){ grunt[i].punching = true; grunt[i].punchT = false; } } if(grunt[i].health <= 0){ grunt[i].dead = true; grunt[i].setVelocityX(0); } if(grunt[i].getX() < offset + 1200 && grunt[i].getX() > offset && !grunt[i].hidden && !grunt[i].dead){ boolean canShoot = true; float yrat = ((720f - man.getY()) - (720f - grunt[i].getY()))/(man.getX() - grunt[i].getX()); breakif: if(grunt[i].facing == -1 && man.getX() < grunt[i].getX()){ float y = grunt[i].getY(); float mod = (float) (0.000001/(Math.sqrt(-0.000001f * -0.000001f + (0.000001f * yrat) * (0.000001f * yrat)))); float x = grunt[i].getX(); while(x > man.getX() && Math.round(y) != Math.round(man.getY())){ for(int ii = 0; ii < platform.length; ii++){ if(contains(platform[ii], new Point(Math.round(x),Math.round(y)))){ canShoot = false; break breakif; } } y += 1 * yrat * mod; if(x > man.getX()){ x-= 1*mod; } } for(int ii = 0; ii < grunt.length; ii++){ grunt[ii].aware = 2; } } breakif: if(grunt[i].facing == 1 && man.getX() > grunt[i].getX()){ float y = grunt[i].getY(); float mod = (float) (0.000001/(Math.sqrt(0.000001f * 0.000001f + (0.000001f * -yrat) * (0.000001f * -yrat)))); float x = grunt[i].getX(); while(x < man.getX() && Math.round(y) != Math.round(man.getY())){ for(int ii = 0; ii < platform.length; ii++){ if(contains(platform[ii], new Point(Math.round(x),Math.round(y)))){ canShoot = false; break breakif; } } y += 1 * -yrat * mod; if(x < man.getX()){ x+= 1*mod; } } for(int ii = 0; ii < grunt.length; ii++){ grunt[ii].aware = 2; } } for(int j = 0; j < grunt.length; j++){ breakif: if(grunt[i].facing == -1 && grunt[j].getX() < grunt[i].getX() && grunt[j].getX() < offset + 1200 && grunt[j].getX() > offset && grunt[i].aware != 2 && grunt[j].dead){ float y = grunt[i].getY(); float mod = (float) (0.000001/(Math.sqrt(-0.000001f * -0.000001f + (0.000001f * yrat) * (0.000001f * yrat)))); float x = grunt[i].getX(); while(x > grunt[j].getX() && Math.round(y) != Math.round(grunt[j].getY())){ for(int ii = 0; ii < platform.length; ii++){ if(contains(platform[ii], new Point(Math.round(x),Math.round(y)))){ canShoot = false; break breakif; } } y += 1 * yrat * mod; if(x > grunt[j].getX()){ x-= 1*mod; } } grunt[i].aware = 1; } breakif: if(grunt[i].facing == 1 && grunt[j].getX() > grunt[i].getX() && grunt[j].getX() < offset + 1200 && grunt[j].getX() > offset && grunt[i].aware != 2 && grunt[j].dead){ float y = grunt[i].getY(); float mod = (float) (0.000001/(Math.sqrt(0.000001f * 0.000001f + (0.000001f * -yrat) * (0.000001f * -yrat)))); float x = grunt[i].getX(); while(x < grunt[j].getX() && Math.round(y) != Math.round(grunt[j].getY())){ for(int ii = 0; ii < platform.length; ii++){ if(contains(platform[ii], new Point(Math.round(x),Math.round(y)))){ canShoot = false; break breakif; } } y += 1 * -yrat * mod; if(x < grunt[j].getX()){ x+= 1*mod; } } grunt[i].aware = 1; } } if(!canShoot && grunt[i].aware == 2){ if(grunt[i].facing == -1){ grunt[i].setVelocityX(-0.0000001f); } else{ grunt[i].setVelocityX(0.0000001f); } } else if(grunt[i].aware == 2){ if(grunt[i].getX() - offset < 400){ grunt[i].setVelocityX(0.0000001f); grunt[i].facing = 1; } if(grunt[i].getX() - offset > 1000){ grunt[i].setVelocityX(-0.0000001f); grunt[i].facing = -1; } } else{ if(grunt[i].aware == 0){ if(System.currentTimeMillis() % 4000 > 1000 + i*300 && System.currentTimeMillis() % 4000 < 2000 + i*100){ grunt[i].facing = -1; grunt[i].setVelocityX(-0.0000001f); } if(System.currentTimeMillis() % 4000 > 2000 + i*300 && System.currentTimeMillis() % 4000 < 3000 + i*100){ grunt[i].facing = -1; grunt[i].setVelocityX(0); } if((System.currentTimeMillis() % 4000 > 3000 + i*300 && System.currentTimeMillis() % 4000 < 4000) || System.currentTimeMillis() % 4000 < i*300){ grunt[i].facing = 1; grunt[i].setVelocityX(0.0000001f); } if(System.currentTimeMillis() % 4000 > 0 + i*300 && System.currentTimeMillis() % 4000 < 1000 + i*300){ grunt[i].setVelocityX(0); } } else if(grunt[i].aware == 1){ if(System.currentTimeMillis() % 10000 > 2500 + i*300 && System.currentTimeMillis() % 10000 < 5000 + i*100){ grunt[i].facing = -1; grunt[i].setVelocityX(-0.0000001f); } if(System.currentTimeMillis() % 10000 > 5000 + i*300 && System.currentTimeMillis() % 10000 < 7500 + i*100){ grunt[i].facing = -1; grunt[i].setVelocityX(0); } if((System.currentTimeMillis() % 10000 > 7500 + i*300 && System.currentTimeMillis() % 10000 < 10000) || System.currentTimeMillis() % 10000 < i*300){ grunt[i].facing = 1; grunt[i].setVelocityX(0.0000001f); } if(System.currentTimeMillis() % 10000 > 0 + i*300 && System.currentTimeMillis() % 10000 < 2500 + i*300){ grunt[i].setVelocityX(0); } } } if(grunt[i].aware == 2){ if(grunt[i].facing == -1 && man.getX() > grunt[i].getX()){ grunt[i].facing = 1; } else if (grunt[i].facing == 1 && man.getX() < grunt[i].getX()){ grunt[i].facing = -1; } } for(int ii = 0; ii < enbullet.length; ii++){ if(enbullet[ii].hidden && System.currentTimeMillis() > grunt[i].timeLastFired + grunt[i].fireRate && grunt[i].aware == 2 && canShoot){ enbullet[ii].hidden = false; enbullet[ii].setX(grunt[i].getX()); enbullet[ii].setY(grunt[i].getY()); if(man.getX() > grunt[i].getX()){ enbullet[ii].setVelocityX(0.000001f); enbullet[ii].setVelocityY(0.000001f * -yrat); } else{ enbullet[ii].setVelocityX(-0.000001f); enbullet[ii].setVelocityY(0.000001f * yrat); } grunt[i].timeLastFired = System.currentTimeMillis(); float mod = (float) (0.000001/(Math.sqrt(enbullet[ii].getVelocityX() * enbullet[ii].getVelocityX() + enbullet[ii].getVelocityY() * enbullet[ii].getVelocityY()))); enbullet[ii].setVelocityX(enbullet[ii].getVelocityX() * mod); enbullet[ii].setVelocityY(enbullet[ii].getVelocityY() * mod); break; } } } if(!boss.hidden && !boss.dead){ float yrat = ((720f - man.getY()) - (720f - boss.getY()))/(man.getX() - boss.getX()); for(int ii = 0; ii < enbullet.length; ii++){ if(enbullet[ii].hidden && System.currentTimeMillis() > boss.timeLastFired + boss.fireRate){ enbullet[ii].hidden = false; enbullet[ii].setX(boss.getX()); enbullet[ii].setY(boss.getY()); if(man.getX() > boss.getX()){ enbullet[ii].setVelocityX(0.000001f); enbullet[ii].setVelocityY(0.000001f * -yrat); } else{ enbullet[ii].setVelocityX(-0.000001f); enbullet[ii].setVelocityY(0.000001f * yrat); } boss.timeLastFired = System.currentTimeMillis(); float mod = (float) (0.000001/(Math.sqrt(enbullet[ii].getVelocityX() * enbullet[ii].getVelocityX() + enbullet[ii].getVelocityY() * enbullet[ii].getVelocityY()))); enbullet[ii].setVelocityX(enbullet[ii].getVelocityX() * mod); enbullet[ii].setVelocityY(enbullet[ii].getVelocityY() * mod); break; } } for(int ii = 0; ii < bullet.length; ii++){ if(collision(boss, bullet[ii])){ boss.health -= 10; bullet[ii].hidden = true; } } if(collision(man,boss)){ if(man.punching){ boss.health -= 20; } else if(boss.punching){ man.health -= 30; man.setX(man.getX() - 100); } else{ if(!boss.punchT){ boss.punchT = true; boss.colTime = System.currentTimeMillis(); } } if(boss.punching && System.currentTimeMillis() > boss.punchTime){ boss.punching = false; } if(System.currentTimeMillis() > boss.colTime + 400 && !boss.punching && boss.punchT){ boss.punching = true; boss.punchT = false; } } if(boss.health <= 0){ boss.hidden = true; } } } if(collision(man,ship)){ boolean allDead = true; for(int i = 0; i < grunt.length; i++){ if(!grunt[i].dead && !grunt[i].hidden){ allDead = false; } } if(!boss.dead && !boss.hidden){ allDead = false; } if(allDead){ JOptionPane.showMessageDialog(getParent(), "You beat the level and have unlocked another weapon and the next level", "You Win", JOptionPane.OK_OPTION); if(curLevel + 1 == maxLevel && maxLevel != 6){ maxLevel++; } if(curLevel + 1 == maxWeapon && maxWeapon != 6){ maxWeapon++; } Writer writer = null; try { writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(System.getProperty("user.dir") + "\\res\\data\\weapons.txt"), "utf-8")); for(int i = 0; i < 6; i++){ if(maxWeapon > 0){ maxWeapon--; writer.write("1"); } else{ writer.write("0"); } writer.write(System.getProperty("line.separator")); } } catch (IOException ex) { } finally { try {writer.close();} catch (Exception ex) {} } try { writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(System.getProperty("user.dir") + "\\res\\data\\levels.txt"), "utf-8")); for(int i = 0; i < 6; i++){ if(maxLevel > 0){ maxLevel--; writer.write("1"); } else{ writer.write("0"); } writer.write(System.getProperty("line.separator")); } } catch (IOException ex) { } finally { try {writer.close();} catch (Exception ex) {} } final String javaBin = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java"; File currentJar; try { currentJar = new File(Display.class.getProtectionDomain().getCodeSource().getLocation().toURI()); if(!currentJar.getName().endsWith(".jar")) return; final ArrayList<String> command = new ArrayList<String>(); command.add(javaBin); command.add("-jar"); command.add(currentJar.getPath()); final ProcessBuilder builder = new ProcessBuilder(command); builder.start(); System.exit(0); } catch (URISyntaxException | IOException e) { e.printStackTrace(); } stop(); } } } else{ Object[] options = { "Continue", "Menu" }; int in = JOptionPane.showOptionDialog(null, "Would you like to continue or go back to the menu?", "Paused", JOptionPane.DEFAULT_OPTION, JOptionPane.OK_CANCEL_OPTION, null, options, options[0]); if(in == 0){ paused = false; } else{ final String javaBin = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java"; File currentJar; try { currentJar = new File(Display.class.getProtectionDomain().getCodeSource().getLocation().toURI()); if(!currentJar.getName().endsWith(".jar")) return; final ArrayList<String> command = new ArrayList<String>(); command.add(javaBin); command.add("-jar"); command.add(currentJar.getPath()); final ProcessBuilder builder = new ProcessBuilder(command); builder.start(); System.exit(0); } catch (URISyntaxException | IOException e) { e.printStackTrace(); } stop(); } } prevPaused = Controller.pause; prevPunch = Controller.punch; prevReload = Controller.reload; prevRight = InputHandler.right; } private void update(long timePassed){ if(!paused){ for(int i = 0; i < platform.length; i++){ platform[i].update(timePassed); } for(int i = 0; i < bullet.length; i++){ bullet[i].update(timePassed); } for(int i = 0; i < grunt.length; i++){ grunt[i].update(timePassed); } for(int i = 0; i < enbullet.length; i++){ enbullet[i].update(timePassed); } man.update(timePassed); } } private boolean collision(Sprite s1, Sprite s2){ if (s1.getX() < s2.getX() + s2.getWidth() && s1.getX() + s1.getWidth() > s2.getX() && s1.getY() < s2.getY() + s2.getHeight() && s1.getY() + s1.getHeight() > s2.getY() && s1.hidden == false && s2.hidden == false && s1.dead == false && s2.dead == false){ return true; } return false; } private boolean contains(Sprite s, Point p){ if (p.x < s.getX() + s.getWidth() && p.x > s.getX() && p.y < s.getY() + s.getHeight() && p.y > s.getY() && s.hidden == false && s.dead == false){ return true; } return false; } private void render() { BufferStrategy bs = this.getBufferStrategy(); if(bs == null) { createBufferStrategy(3); return; } Graphics g = bs.getDrawGraphics(); g.drawImage(back, 0 - offset, 0,null); if(!man.hidden){ g.drawImage(man.getImage(), Math.round(man.getX()) - offset, Math.round(man.getY()), null); } for(int i = 0; i < platform.length; i++){ if(!platform[i].hidden){ g.drawImage(platform[i].getImage(), Math.round(platform[i].getX()) - offset, Math.round(platform[i].getY()), null); } } g.drawImage(ship.getImage(), Math.round(ship.getX()) - offset, Math.round(ship.getY()), null); for(int i = 0; i < grunt.length; i++){ if(!grunt[i].hidden){ g.drawImage(grunt[i].getImage(), Math.round(grunt[i].getX()) - offset, Math.round(grunt[i].getY()), null); g.setColor(Color.red); if(!grunt[i].dead){ g.drawLine(Math.round(grunt[i].getX()) - offset, Math.round(grunt[i].getY() - 20), Math.round(grunt[i].getX() + grunt[i].health) - offset, Math.round(grunt[i].getY() - 20)); switch(grunt[i].aware){ case 0: g.setColor(Color.white); break; case 1: g.setColor(Color.yellow); break; case 2: g.setColor(Color.red); break; } g.fillOval(Math.round(grunt[i].getX()) - offset, Math.round(grunt[i].getY()) - 50, 10, 10); } } } if(!boss.hidden){ g.drawImage(boss.getImage(), Math.round(boss.getX()) - offset, Math.round(boss.getY()), null); g.setColor(Color.red); if(!boss.dead){ g.drawLine(Math.round(boss.getX()) - offset, Math.round(boss.getY() - 20), Math.round(boss.getX() + boss.health) - offset, Math.round(boss.getY() - 20)); } } for(int i = 0; i < bullet.length; i++){ if(!bullet[i].hidden){ g.drawImage(bullet[i].getImage(), Math.round(bullet[i].getX()) - offset, Math.round(bullet[i].getY()), null); } } for(int i = 0; i < enbullet.length; i++){ if(!enbullet[i].hidden){ g.drawImage(enbullet[i].getImage(), Math.round(enbullet[i].getX()) - offset, Math.round(enbullet[i].getY()), null); } } String weapon = ""; switch(currentWeapon){ case 0:weapon = "shotgun"; break; case 1:weapon = "pistol"; break; case 2:weapon = "assault rifle"; break; case 3:weapon = "SMG"; break; case 4:weapon = "LMG"; break; case 5:weapon = "Minigun"; break; } g.setColor(Color.cyan); g.setFont(new Font("candara",Font.PLAIN,20)); g.drawString("Health: " + man.health, 36, 630); g.drawString(weapon + ": " + clip[currentWeapon] + " / " + rounds[currentWeapon], 36, 670); g.dispose(); bs.show(); } public synchronized void start() { if (running) { return; } running = true; thread = new Thread(this); thread.start(); } public synchronized void stop() { if (!running) { return; } running = false; thread.interrupt(); try { //thread.join(); } catch(Exception e) { e.printStackTrace(); System.exit(1); } } public static void main(String[] args) { new Launcher(); } } package com.seaney.ld30.graphics; import java.awt.Image; import com.seaney.ld30.graphics.Animation; public class Sprite { private Animation a; private float x; private float y; private float vx; private float vy; public float gravity; public float gravitya = 0.000000000000001f; public boolean grav = true; public boolean dead = false; public boolean punching; public long punchTime; public boolean punchT; public long colTime; public int fireRate; public long timeLastFired; public int reloadRate; public long timeLastReloaded; public boolean reloading; public int clip; public int fullClip; public int rounds; public int facing; public int aware; public int health; public boolean hidden = false; public Sprite(Animation a) { this.a = a; } public void update(long timePassed) { x += vx * timePassed; y += vy * timePassed; a.update(timePassed); } public float getX() { return x; } public float getY() { return y; } public void setAnimation(Animation a){ this.a = a; } public void setX(float x) { this.x = x; } public void setY(float y) { this.y = y; } public int getWidth() { return a.getImage().getWidth(null); } public int getHeight() { return a.getImage().getHeight(null); } public float getVelocityX() { return vx; } public float getVelocityY() { return vy; } public void setVelocityX(float vx) { this.vx = vx; } public void setVelocityY(float vy) { this.vy = vy; } public Image getImage() { return a.getImage(); } } package com.seaney.ld30; import java.awt.event.KeyEvent; import com.seaney.ld30.input.Controller; public class Game { public int time; public Controller controls; public Game() { controls = new Controller(); } public void loop(boolean[] key) { time ++; boolean right = key[KeyEvent.VK_D]; boolean left = key[KeyEvent.VK_A]; boolean up = key[KeyEvent.VK_W]; boolean sprint = key[KeyEvent.VK_SHIFT]; boolean space = key[KeyEvent.VK_SPACE]; boolean pause = key[KeyEvent.VK_ESCAPE]; boolean reload = key[KeyEvent.VK_R]; controls.tick(left, right, up, sprint, space, pause, reload); } } package com.seaney.ld30.input; public class Controller { public static boolean right = false; public static boolean left = false; public static boolean jump = false; public static boolean sprint = false; public static boolean canJump = true; public static boolean punch = false; public static boolean pause = false; public static boolean reload = false; public void tick(boolean left, boolean right, boolean jump, boolean sprint,boolean space, boolean esc, boolean reload) { if (left) { Controller.left = true; } if (right) { Controller.right = true; } if(sprint) { Controller.sprint = true; } if(!left) { Controller.left = false; } if(!right) { Controller.right = false; } if(!sprint) { Controller.sprint = false; } if(jump && canJump){ Controller.jump = true; } if(!jump){ Controller.jump = false; } if(space){ punch = true; } if(!space){ punch = false; } if(esc){ pause = true; } if(!esc){ pause = false; } if(reload){ Controller.reload = true; } if(!reload){ Controller.reload = false; } } } package com.seaney.ld30.GUI; import java.awt.Color; import java.awt.Dimension; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import com.seaney.ld30.RunGame; public class LevelSelector extends JFrame{ private static final long serialVersionUID = 1L; protected JPanel window = new JPanel(); private JButton[] butons = new JButton[2]; private Button[] buttons = new Button[10]; private Button bac; private Rectangle rbac; private Rectangle[] rButtons = new Rectangle[10]; private JButton back; private int width = 650; private int height = 400; protected int bigButtonWidth = 200; protected int bigButtonHeight = 50; protected int buttonWidth = 60; protected int buttonHeight = 50; final String[] levels = new String[6]; public LevelSelector(){ FileReader pr; try { pr = new FileReader(System.getProperty("user.dir") + "\\res\\data\\levels.txt"); BufferedReader p = new BufferedReader(pr); int i = 0; String level = p.readLine(); while(level != null){ levels[i] = level; i++; level = p.readLine(); } } catch(IOException e){ } setTitle("Select Level"); setSize (new Dimension(width, height)); setDefaultCloseOperation(EXIT_ON_CLOSE); getContentPane().add(window); setLocationRelativeTo(null); setResizable(false); setVisible(true); window.setLayout(null); window.setBackground(Color.black); bac = new Button("back"); rbac = new Rectangle(10, 10, 80, 40); bac.setBounds(rbac); bac.setBackground(Color.black); bac.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ dispose(); new Launcher(); } }); back = new JButton(new ImageIcon(System.getProperty("user.dir") + "\\res\\images\\space.png")); back.setBounds(0, 0, width, height); back.setBorder(BorderFactory.createEmptyBorder()); back.setContentAreaFilled(false); butons[0] = new JButton(new ImageIcon(System.getProperty("user.dir") + "\\res\\images\\planet1.png")); butons[0].setBounds(30, 100, new ImageIcon(System.getProperty("user.dir") + "\\res\\images\\planet1.png").getImage().getWidth(null), new ImageIcon(System.getProperty("user.dir") + "\\res\\images\\planet1.png").getImage().getHeight(null)); butons[0].setBorder(BorderFactory.createEmptyBorder()); butons[0].setContentAreaFilled(false); butons[0].addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ for(int i = 0; i < 2; i++){ butons[i].setVisible(false); } window.removeAll(); buttons[0] = new Button("1"); rButtons[0] = new Rectangle(100, 175, buttonWidth, buttonHeight); buttons[0].setBounds(rButtons[0]); buttons[0].addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ dispose(); new RunGame(0,0); } }); if(levels[0].contains("0")){ buttons[0].setEnabled(false); } buttons[1] = new Button("2"); rButtons[1] = new Rectangle(200, 175, buttonWidth, buttonHeight); buttons[1].setBounds(rButtons[1]); buttons[1].addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ dispose(); new RunGame(0,1); } }); if(levels[1].contains("0")){ buttons[1].setEnabled(false); } buttons[2] = new Button("3"); rButtons[2] = new Rectangle(300, 175, buttonWidth, buttonHeight); buttons[2].setBounds(rButtons[2]); buttons[2].addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ dispose(); new RunGame(0,2); } }); if(levels[2].contains("0")){ buttons[2].setEnabled(false); } buttons[3] = new Button("back"); rButtons[3] = new Rectangle(10, 10, 80, buttonHeight); buttons[3].setBounds(rButtons[3]); buttons[3].addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ dispose(); new LevelSelector(); } }); for (int i = 0; i < 4; i++){ window.add(buttons[i]); buttons[i].setBackground(Color.black); } } }); butons[1] = new JButton(new ImageIcon(System.getProperty("user.dir") + "\\res\\images\\planet2.png")); butons[1].setBounds(300, 100, new ImageIcon(System.getProperty("user.dir") + "\\res\\images\\planet2.png").getImage().getWidth(null), new ImageIcon(System.getProperty("user.dir") + "\\res\\images\\planet2.png").getImage().getHeight(null)); butons[1].setBorder(BorderFactory.createEmptyBorder()); butons[1].setContentAreaFilled(false); butons[1].addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ for(int i = 0; i < 2; i++){ butons[i].setVisible(false); } window.removeAll(); buttons[0] = new Button("1"); rButtons[0] = new Rectangle(100, 175, buttonWidth, buttonHeight); buttons[0].setBounds(rButtons[0]); buttons[0].addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ dispose(); new RunGame(1,0); } }); if(levels[3].contains("0")){ buttons[0].setEnabled(false); } buttons[1] = new Button("2"); rButtons[1] = new Rectangle(200, 175, buttonWidth, buttonHeight); buttons[1].setBounds(rButtons[1]); buttons[1].addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ dispose(); new RunGame(1,1); } }); if(levels[4].contains("0")){ buttons[1].setEnabled(false); } buttons[2] = new Button("3 final level"); rButtons[2] = new Rectangle(300, 175, 120, buttonHeight); buttons[2].setBounds(rButtons[2]); buttons[2].addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ dispose(); new RunGame(1,2); } }); if(levels[5].contains("0")){ buttons[2].setEnabled(false); } buttons[3] = new Button("back"); rButtons[3] = new Rectangle(10, 10, 80, buttonHeight); buttons[3].setBounds(rButtons[3]); buttons[3].addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ dispose(); new LevelSelector(); } }); for (int i = 0; i < 4; i++){ window.add(buttons[i]); buttons[i].setBackground(Color.black); } } }); for (int ii = 0; ii < 2; ii++){ window.add(butons[ii]); } window.add(bac); window.add(back); } } package com.seaney.ld30.GUI; import java.awt.Color; import java.awt.Dimension; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.UIManager; public class Launcher extends JFrame{ private static final long serialVersionUID = 1L; protected JPanel window = new JPanel(); private Button play, howToPlay, bac; private Rectangle rplay, rhelp, rbac; private JButton back; private int width = 650; private int height = 400; protected int button_width = 80; protected int button_height = 40; public Launcher(){ setTitle("Connect Planets"); setSize (new Dimension(width, height)); setDefaultCloseOperation(EXIT_ON_CLOSE); getContentPane().add(window); setLocationRelativeTo(null); setResizable(false); setVisible(true); window.setLayout(null); window.setBackground(Color.gray); play = new Button("Play"); rplay = new Rectangle(width/2 - button_width/2, 90, button_width, button_height); play.setBounds(rplay); play.setBackground(Color.black); back = new JButton(new ImageIcon(System.getProperty("user.dir") + "\\res\\images\\space.png")); back.setBounds(0, 0, width, height); back.setBorder(BorderFactory.createEmptyBorder()); back.setContentAreaFilled(false); howToPlay = new Button("How to Play"); rhelp = new Rectangle(width/2 - 120/2, 190, 120, button_height); howToPlay.setBounds(rhelp); howToPlay.setBackground(Color.black); window.add(play); window.add(howToPlay); window.add(back); play.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ dispose(); new LevelSelector(); } }); howToPlay.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ UIManager.put("OptionPane.background", Color.black); UIManager.put("Panel.background", Color.black); UIManager.put("OptionPane.messageForeground", Color.white); JOptionPane.showMessageDialog(null, "Aliens have started to take over the planets in your solar system.\nYour People have sent you to fend them off.\nPress play then choose a planet to go to, then a level on that planet.\nOn each level you will have to clear out all the aliens then get to the ship at the end for extraction.\nYou can do this anyway you choose, stealth or just go and shoot them.\nOn each level there are alien guards on patroll.\nYou will remain undetected until they see you.\nIf they see you they will alert the others.\nIf they see a dead body they will become suspicious and start to look around.\nIf you run into an alien they will try to punch you.\nAt the end of the final level there is a boss.\nYou start with a shotgun and will get better guns as you go on.\nGood Luck\n\nControls:\nA/D - Left/Right\nW - jump\nShift - Sprint\nSpace - jump\n Mouse - aim\n Left Click - shoot\n Right Click - Change Weapon", "How to Play", JOptionPane.INFORMATION_MESSAGE); } }); } } package com.seaney.ld30.GUI; import java.awt.Color; import java.awt.Cursor; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; import java.awt.RenderingHints; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.util.ArrayList; import javax.swing.JButton; public class Button extends JButton implements MouseListener{ private static final long serialVersionUID = 1L; private Dimension size = new Dimension(36,36); private ArrayList<ActionListener> listeners = new ArrayList<ActionListener>(); public String text; private boolean mouseEntered = false; public Button(String text) { super(); enableInputMethods(true); addMouseListener(this); this.text = text; setSize(size.width, size.height); setFocusable(true); } public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D antiAlias = (Graphics2D)g; antiAlias.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); if(!mouseEntered){ g.setColor(Color.decode("#FFFFFF")); g.drawLine(0, getHeight()/2, 20, getHeight()/2); g.drawLine(getWidth()-20, getHeight()/2, getWidth(), getHeight()/2); g.drawString(text, 28,getHeight()/2 + 3); } else{ g.setColor(Color.decode("#0099FF")); g.drawLine(0, getHeight()/2, 10, getHeight()/2); g.drawLine(getWidth()-10, getHeight()/2, getWidth(), getHeight()/2); g.drawString(text, 28,getHeight()/2 + 3); } } public void paintBorder(Graphics g) { } public void mouseClicked(MouseEvent e) { } public void mouseEntered(MouseEvent e) { if(isEnabled()){ mouseEntered = true; setCursor(new Cursor(Cursor.HAND_CURSOR)); } repaint(); } public void mouseExited(MouseEvent e) { mouseEntered = false; setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); repaint(); } public void mousePressed(MouseEvent e) { if(isEnabled()){ notifyListeners(e); } repaint(); } public void mouseReleased(MouseEvent e) { setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); repaint(); } public void addActionListener(ActionListener listener) { listeners.add(listener); } private void notifyListeners(MouseEvent e) { ActionEvent evt = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, new String(), e.getWhen(), e.getModifiers()); synchronized(listeners) { for (int i = 0; i < listeners.size(); i++) { ActionListener tmp = listeners.get(i); tmp.actionPerformed(evt); } } } public Dimension getPreferredSize() { return new Dimension(getWidth(), getHeight()); } public Dimension getMinimumSize() { return getPreferredSize(); } public Dimension getMaximumSize() { return getPreferredSize(); } } package com.seaney.ld30.input; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.awt.event.MouseWheelEvent; import java.awt.event.MouseWheelListener; public class InputHandler implements KeyListener, MouseListener, MouseMotionListener, FocusListener{ public boolean[] key= new boolean[68836]; public static int mouseX; public static int mouseY; public static int mouseButton; public static boolean clicked = false; public static boolean right = false; int sTime; int oTime; @Override public void mouseDragged(MouseEvent e) { // TODO Auto-generated method stub mouseX = e.getX(); mouseY = e.getY(); } @Override public void mouseMoved(MouseEvent e) { // TODO Auto-generated method stub mouseX = e.getX(); mouseY = e.getY(); } @Override public void mouseClicked(MouseEvent e) { } @Override public void mouseEntered(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mouseExited(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mousePressed(MouseEvent e) { mouseButton = e.getButton(); if (mouseButton == 1) { clicked = true; } if (mouseButton == MouseEvent.BUTTON3) { right = true; } } @Override public void mouseReleased(MouseEvent e) { mouseButton = e.getButton(); if (mouseButton == 1) { clicked = false; } if (mouseButton == MouseEvent.BUTTON3) { right = false; } } @Override public void keyPressed(KeyEvent e) { int keycode = e.getKeyCode(); if (keycode > 0 && keycode < key.length) { key[keycode] = true; } } @Override public void keyReleased(KeyEvent e) { int keycode = e.getKeyCode(); if (keycode > 0 && keycode < key.length) { key[keycode] = false; } } @Override public void keyTyped(KeyEvent e) { // TODO Auto-generated method stub } @Override public void focusGained(FocusEvent e) { // TODO Auto-generated method stub } @Override public void focusLost(FocusEvent e) { for (int i = 0; i < key.length; i++) { key[i] = false; } } } package com.seaney.ld30; import javax.swing.JFrame; import com.seaney.ld30.Display; import com.seaney.ld30.GUI.LevelSelector; public class RunGame { public static final String title = "Connect planets"; public static JFrame frame = new JFrame(); public RunGame(int grid, int level){ Display game = new Display(grid, level); frame.add(game); frame.setSize(Display.width, Display.height); frame.setResizable(false); frame.setVisible(true); frame.setTitle(title); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); game.start(); } public static void dispose(){ frame.dispose(); new LevelSelector(); } } package com.semcom.lde; import java.awt.Canvas; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.Graphics; import java.awt.Image; import java.awt.Toolkit; import java.awt.image.*; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JOptionPane; import javax.swing.UIManager; import com.semcom.lde.input.Controller; import com.semcom.lde.input.InputHandler; import com.semcom.lde.GUI.Launcher; import com.semcom.lde.graphics.Animation; import com.semcom.lde.graphics.Sprite; public class display extends Canvas implements Runnable { static Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); private static final long serialVersionUID = 1L; public static int width = 1280; public static int height = 720; public static Sprite[] platform = new Sprite[11]; public static Sprite dot; public static Sprite end; public static Sprite guard1; public static Sprite guard2; public static Sprite guard3; public static int level; public static Level[] levels = new Level[10]; public static Level[] levelsA = new Level[10]; public static boolean phased; public static boolean paused; public static boolean guard1Dead = false; public static boolean guard2Dead = false; public static boolean guard3Dead = false; public static int guard1Limit1; public static int guard1Limit2; public static int guard2Limit1; public static int guard2Limit2; public static int guard3Limit1; public static int guard3Limit2; public static Image help; private Thread thread; private boolean running = false; private Game game; private InputHandler input; private Image back; private Image dotI; private Image platformI; private Animation dotA; private Animation platformA; private long passedTime; private float gravity; private float gravitya; private boolean gravityActive = true; private Image endI; public display(int i) { Dimension size = new Dimension(width, height); setPreferredSize(size); setMinimumSize(size); setMaximumSize(size); game = new Game(); level = i; input = new InputHandler(); addKeyListener(input); addMouseListener(input); addFocusListener(input); addMouseMotionListener(input); loadImages(); initialProcesses(); } public void loadImages(){ back = new ImageIcon("res\\images\\back.png").getImage(); dotI = new ImageIcon("res\\images\\dot.gif").getImage(); platformI = new ImageIcon("res\\images\\platform.png").getImage(); endI = new ImageIcon("res\\images\\end.png").getImage(); Image guardI = new ImageIcon("res\\images\\guard.gif").getImage(); dotA = new Animation(); dotA.addScene(dotI, 250); dot = new Sprite(dotA); platformA = new Animation(); platformA.addScene(platformI, 250); for (int i = 0; i < platform.length; i++){ platform[i] = new Sprite(platformA); } Animation guardA = new Animation(); guardA.addScene(guardI, 250); guard1 = new Sprite(guardA); guard2 = new Sprite(guardA); guard3 = new Sprite(guardA); Animation endA = new Animation(); endA.addScene(endI, 250); end = new Sprite(endA); guard1.setVelocityX(0.0000001f); guard2.setVelocityX(0.0000001f); guard3.setVelocityX(0.0000001f); } private void initialProcesses(){ gravitya = 0.0000000000000000007f; levels[0] = new Level(50,300,30,400,130,400,230,400,400,400,510,300,630,400,630,200,730,400,900,600,1000,500,1100,400,1150,400 - end.getHeight(),0,0,0,0,0,0,0,0,0,0,0,0); levels[1] = new Level(50,300,30,400,130,400,630,400,730,400,830,300,930,400,1030,200,1100,400,0,0,0,0,0,0,1150,400 - end.getHeight(),0,0,0,0,0,0,0,0,0,0,0,0); levels[2] = new Level(50,300,30,400,230,200,350,600,500,400,650,500,800,300,900,400,1100,400,0,0,0,0,0,0,1150,400 - end.getHeight(),0,0,0,0,0,0,0,0,0,0,0,0); levels[3] = new Level(50,300,30,400,130,400,430,400,530,400,830,400,930,400,0,0,0,0,0,0,0,0,0,0,1150,400 - end.getHeight(),930,400 - guard1.getHeight(),0,0,0,0,830,1030,0,0,0,0); levels[4] = new Level(50,300,30,400,300,400,750,400,1150,400,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1150,400 - end.getHeight(),350,400 - guard1.getHeight(),800,400 - guard1.getHeight(),0,0,300,400,750,850,0,0); levels[5] = new Level(50,300,30,400,450,500,650,450,650,350,1100,400,0,0,0,0,0,0,0,0,0,0,0,0,1150,400 - end.getHeight(),650,450 - guard1.getHeight(),0,0,0,0,650,750,0,0,0,0); levels[6] = new Level(50,300,30,400,400,500,700,600,500,200,750,200,1000,600,1000,470,1100,400,0,0,0,0,0,0,1150,400 - end.getHeight(),550,200 - guard1.getHeight(),1050,600 - guard1.getHeight(),0,0,500,600,1000,1100,0,0); levels[7] = new Level(50,300,30,400,700,400,950,300,700,200,900,100,1100,100,0,0,0,0,0,0,0,0,0,0,1150,100 - end.getHeight(),1000,300 - guard1.getHeight(),950,100 - guard1.getHeight(),0,0,950,1050,900,1000,0,0); levels[8] = new Level(50,300,30,400,300,200,550,350,600,600,800,225,950,350,1100,400,0,0,0,0,0,0,0,0,1150,400 - end.getHeight(),350,200 - guard1.getHeight(),850,225 - guard1.getHeight(),0,0,300,400,800,900,0,0); levels[9] = new Level(50,300,30,400,300,200,800,500,900,300,1100,400,0,0,0,0,0,0,0,0,0,0,0,0,1150,400 - end.getHeight(),350,200 - guard1.getHeight(),850,500 - guard1.getHeight(),950,300 - guard1.getHeight(),300,400,800,900,900,1000); levelsA[0] = new Level(50,300,30,400,130,400,230,400,400,400,510,300,630,400,630,200,730,400,900,600,1000,500,1100,400,1150,400 - end.getHeight(),0,0,0,0,0,0,0,0,0,0,0,0); levelsA[1] = new Level(50,300,30,400,130,400,230,400,400,400, 510,300,630,400,630,200,0,0,0,0,0,0,0,0,1150,400 - end.getHeight(),0,0,0,0,0,0,0,0,0,0,0,0); levelsA[2] = new Level(50,300,130,300,425,500,525,500,650,350,775,450,1000,400,0,0,0,0,0,0,0,0,0,0,1150,400 - end.getHeight(),0,0,0,0,0,0,0,0,0,0,0,0); levelsA[3] = new Level(50,300,230,400,330,400,630,400,730,400,1030,400,1130,400,0,0,0,0,0,0,0,0,0,0,1150,400 - end.getHeight(),0,0,0,0,0,0,0,0,0,0,0,0); levelsA[4] = new Level(50,300,150,350,400,350,600,600,750,500,900,300,0,0,0,0,0,0,0,0,0,0,0,0,1150,400 - end.getHeight(),0,0,0,0,0,0,0,0,0,0,0,0); levelsA[5] = new Level(50,300,240,450,500,250,700,200,800,200,900,400,0,0,0,0,0,0,0,0,0,0,0,0,1150,400 - end.getHeight(),0,0,0,0,0,0,0,0,0,0,0,0); levelsA[6] = new Level(50,300,200,450,400,300,500,400,850,550,1100,535,0,0,0,0,0,0,0,0,0,0,0,0,1150,400 - end.getHeight(),0,0,0,0,0,0,0,0,0,0,0,0); levelsA[7] = new Level(50,300,30,400,200,300,500,500,1000,400,900,200,0,0,0,0,0,0,0,0,0,0,0,0,1150,100 - end.getHeight(),0,0,0,0,0,0,0,0,0,0,0,0); levelsA[8] = new Level(50,300,150,300,300,500,400,400,650,275,800,450,0,0,0,0,0,0,0,0,0,0,0,0,1150,400 - end.getHeight(),0,0,0,0,0,0,0,0,0,0,0,0); levelsA[9] = new Level(50,300,150,300,700,600,800,400,1000,200,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1150,400 - end.getHeight(),0,0,0,0,0,0,0,0,0,0,0,0); levels[level].activate(); } public void run() { double unprocessedSeconds = 0; long previousTime = System.nanoTime(); double secondsPerTick = 1 / 60.0; int tickCount = 0; boolean ticked = false; while(running) { long currentTime = System.nanoTime(); passedTime = currentTime - previousTime; previousTime = currentTime; unprocessedSeconds += passedTime / 1000000000.0; requestFocus(); while(unprocessedSeconds > secondsPerTick) { tick(); unprocessedSeconds -= secondsPerTick; ticked = true; tickCount++; if(tickCount % 60 == 0) { previousTime += 1000; } } if(ticked) { render(); } render(); loop(); } } private void tick() { game.tick(input.key); } public void loop(){ if (!paused){ gravityActive = true; Controller.canJump = false; for (int i = 0; i < platform.length; i++){ if (collision(dot,platform[i])){ if (dot.getVelocityY() > 0 && dot.getY() + dot.getHeight() < platform[i].getY() + 5){ gravityActive = false; Controller.canJump = true; dot.setVelocityY(0); } } } if (Controller.left){ if (Controller.runWalk){ dot.setVelocityX(-0.0000003f); } else{ dot.setVelocityX(-0.0000002f); } } else if (Controller.right){ if (Controller.runWalk){ dot.setVelocityX(0.0000003f); } else{ dot.setVelocityX(0.0000002f); } } else{ dot.setVelocityX(0); } if (Controller.jump){ gravity = 0; dot.setVelocityY(-0.0000004f); Controller.canJump = false; Controller.jump = false; gravityActive = true; } if (Controller.phase && level != 0){ if (phased){ phased = false; } else if (!phased){ phased = true; } Controller.canPhase = false; Controller.phase = false; } if (phased){ back = new ImageIcon("res\\images\\backI.png").getImage(); platformI = new ImageIcon("res\\images\\platformI.png").getImage(); endI = new ImageIcon("res\\images\\endI.png").getImage(); levelsA[level].phase(); } else{ back = new ImageIcon("res\\images\\back.png").getImage(); platformI = new ImageIcon("res\\images\\platform.png").getImage(); endI = new ImageIcon("res\\images\\end.png").getImage(); levels[level].phase(); } if (dot.getY() > 800){ gravity = 0; levels[level].reset(); } if (gravityActive == true){ gravity += gravitya; } else{ gravity = 0; } if (guard1.getX() < guard1Limit1){ guard1.setX(guard1Limit1); guard1.setVelocityX(-guard1.getVelocityX()); } if (guard1.getX() + guard1.getWidth() > guard1Limit2){ guard1.setX(guard1Limit2 - guard1.getWidth()); guard1.setVelocityX(-guard1.getVelocityX()); } if (guard2.getX() < guard2Limit1){ guard2.setX(guard2Limit1); guard2.setVelocityX(-guard2.getVelocityX()); } if (guard2.getX() + guard2.getWidth() > guard2Limit2){ guard2.setX(guard2Limit2 - guard2.getWidth()); guard2.setVelocityX(-guard2.getVelocityX()); } if (guard3.getX() < guard3Limit1){ guard3.setX(guard3Limit1); guard3.setVelocityX(-guard3.getVelocityX()); } if (guard3.getX() + guard3.getWidth() > guard3Limit2){ guard3.setX(guard3Limit2 - guard3.getWidth()); guard3.setVelocityX(-guard3.getVelocityX()); } if (collision(dot,guard1)){ if (dot.getY() + dot.getHeight() < guard1.getY() + (guard1.getHeight()/2)&& dot.getVelocityY() > 0){ guard1Dead = true; guard1.hidden = true; guard1.setVelocityX(0); } else{ levels[level].reset(); } } if (collision(dot,guard2)){ if (dot.getY() + dot.getHeight() < guard2.getY() + (guard2.getHeight()/2)&& dot.getVelocityY() > 0){ guard2Dead = true; guard2.hidden = true; } else{ levels[level].reset(); } } if (collision(dot,guard3)){ if (dot.getY() + dot.getHeight() < guard3.getY() + (guard3.getHeight()/2)&& dot.getVelocityY() > 0){ guard3Dead = true; guard3.hidden = true; } else{ levels[level].reset(); } } if(level == 0){ help = new ImageIcon("res\\images\\help1.gif").getImage(); } if(level == 1){ help = new ImageIcon("res\\images\\help2.gif").getImage(); } if(level == 2){ help = new ImageIcon("res\\images\\help3.gif").getImage(); } if(level == 3){ help = new ImageIcon("res\\images\\help4.gif").getImage(); } if(level == 4){ help = new ImageIcon("res\\images\\help5.gif").getImage(); } if(level == 5){ help = new ImageIcon("").getImage(); } if (collision(dot,end) && dot.hidden == false){ levels[level].completed = true; dot.hidden = true; UIManager.put("OptionPane.background", Color.black); UIManager.put("Panel.background", Color.black); UIManager.put("OptionPane.messageForeground", Color.red); if (level != 9){ Object[] options = { "Select a level", "Continue" }; Icon face = new ImageIcon("res\\images\\face.png"); int option; option = JOptionPane.showOptionDialog(null, "You completed the level, and are one step closer to freedom!!!", "Well Done", JOptionPane.DEFAULT_OPTION, JOptionPane.OK_CANCEL_OPTION,face, options, options[0]); if (option == 0){ Object[] optionsa = null; if (levels[0].completed == true){ Object[] optionsb = { "1","2" }; optionsa = optionsb; } if (levels[1].completed == true){ Object[] optionsb = { "1","2","3" }; optionsa = optionsb; } if (levels[2].completed == true){ Object[] optionsb = { "1","2","3","4" }; optionsa = optionsb; } if (levels[3].completed == true){ Object[] optionsb = { "1","2","3","4","5" }; optionsa = optionsb; } if (levels[4].completed == true){ Object[] optionsb = { "1","2","3","4","5","6" }; optionsa = optionsb; } if (levels[5].completed == true){ Object[] optionsb = { "1","2","3","4","5","6","7" }; optionsa = optionsb; } if (levels[6].completed == true){ Object[] optionsb = { "1","2","3","4","5","6","7","8" }; optionsa = optionsb; } if (levels[7].completed == true){ Object[] optionsb = { "1","2","3","4","5","6","7","8","9" }; optionsa = optionsb; } if (levels[8].completed == true){ Object[] optionsb = { "1","2","3","4","5","6","7","8","9", "10" }; optionsa = optionsb; } int leveli = JOptionPane.showOptionDialog(null, "Which level would you like to select", "Select a Level", JOptionPane.DEFAULT_OPTION, JOptionPane.OK_CANCEL_OPTION,face, optionsa, optionsa[0]); if (leveli < 10 && leveli > -1){ level = leveli; } } if (option == 1){ level++; } dot.hidden = false; levels[level].activate(); System.out.println(guard1.getX()); guard1.setVelocityX(0.0000001f); guard2.setVelocityX(0.0000001f); guard3.setVelocityX(0.0000001f); } else{ Object[] options = { "Select a level"}; Icon face = new ImageIcon("res\\images\\face.png"); int option; option = JOptionPane.showOptionDialog(null, "You have escaped and are free!!!", "Congradulations", JOptionPane.DEFAULT_OPTION, JOptionPane.OK_CANCEL_OPTION,face, options, options[0]); if (option == 0){ Object[] optionsa = { "1","2","3","4","5","6","7","8","9", "10" }; int leveli = JOptionPane.showOptionDialog(null, "Which level would you like to select", "Select a Level", JOptionPane.DEFAULT_OPTION, JOptionPane.OK_CANCEL_OPTION,face, optionsa, optionsa[0]); if (leveli < 10 && leveli > -1){ level = leveli; } } dot.hidden = false; levels[level].activate(); } } dot.setVelocityY(dot.getVelocityY() + (gravity * passedTime)); dot.update(passedTime); guard1.update(passedTime); guard2.update(passedTime); guard3.update(passedTime); } if (Controller.pause){ if (paused){ paused = false; } else if (!paused){ paused = true; gravityActive = false; dot.setVelocityY(0); UIManager.put("OptionPane.background", Color.black); UIManager.put("Panel.background", Color.black); UIManager.put("OptionPane.messageForeground", Color.red); Object[] options = { "Select a level", "Continue" }; Icon pause = new ImageIcon("res\\images\\pause.png"); int option; option = JOptionPane.showOptionDialog(null, "You have paused the game, what would you like to do", "Paused", JOptionPane.DEFAULT_OPTION, JOptionPane.OK_CANCEL_OPTION,pause, options, options[0]); if (option == 0){ Object[] optionsa = null; if (levels[0].completed == true){ Object[] optionsb = { "1","2" }; optionsa = optionsb; } if (levels[1].completed == true){ Object[] optionsb = { "1","2","3" }; optionsa = optionsb; } if (levels[2].completed == true){ Object[] optionsb = { "1","2","3","4" }; optionsa = optionsb; } if (levels[3].completed == true){ Object[] optionsb = { "1","2","3","4","5" }; optionsa = optionsb; } if (levels[4].completed == true){ Object[] optionsb = { "1","2","3","4","5","6" }; optionsa = optionsb; } if (levels[5].completed == true){ Object[] optionsb = { "1","2","3","4","5","6","7" }; optionsa = optionsb; } if (levels[6].completed == true){ Object[] optionsb = { "1","2","3","4","5","6","7","8" }; optionsa = optionsb; } if (levels[7].completed == true){ Object[] optionsb = { "1","2","3","4","5","6","7","8","9" }; optionsa = optionsb; } if (levels[8].completed == true){ Object[] optionsb = { "1","2","3","4","5","6","7","8","9", "10" }; optionsa = optionsb; } else { Object[] optionsb = { "1" }; optionsa = optionsb; } level = JOptionPane.showOptionDialog(null, "Which level would you like to select", "Select a Level", JOptionPane.DEFAULT_OPTION, JOptionPane.OK_CANCEL_OPTION,pause, optionsa, optionsa[0]); levels[level].activate(); paused = false; } else { paused = false; System.out.println("work"); } } Controller.canPause = false; Controller.pause = false; } } private boolean collision(Sprite s1, Sprite s2){ if (s1.getX() < s2.getX() + s2.getWidth() && s1.getX() + s1.getWidth() > s2.getX() && s1.getY() < s2.getY() + s2.getHeight() && s1.getY() + s1.getHeight() > s2.getY() && s1.hidden == false && s2.hidden == false){ return true; } return false; } private void render() { BufferStrategy bs = this.getBufferStrategy(); if(bs == null) { createBufferStrategy(3); return; } Graphics g = bs.getDrawGraphics(); g.drawImage(back, 0, 0,null); for(int i = 0; i < platform.length; i++){ if (platform[i].hidden == false){ g.drawImage(platformI, Math.round(platform[i].getX()),Math.round(platform[i].getY()), null); } } if (end.hidden == false){ g.drawImage(endI, Math.round(end.getX()),Math.round(end.getY()), null); } if (dot.hidden == false){ g.drawImage(dot.getImage(), Math.round(dot.getX()),Math.round(dot.getY()), null); } if (guard1.hidden == false){ g.drawImage(guard1.getImage(), Math.round(guard1.getX()),Math.round(guard1.getY()), null); } if (guard2.hidden == false){ g.drawImage(guard2.getImage(), Math.round(guard2.getX()),Math.round(guard2.getY()), null); } if (guard3.hidden == false){ g.drawImage(guard3.getImage(), Math.round(guard3.getX()),Math.round(guard3.getY()), null); } g.drawImage(help,10, 10, null); g.setFont(new Font("Verdana", 0, 20)); g.setColor(Color.YELLOW); g.dispose(); bs.show(); } public synchronized void start() { if (running) { return; } running = true; thread = new Thread(this); thread.start(); } public synchronized void stop() { if (!running) { return; } running = false; try { thread.join(); } catch(Exception e) { e.printStackTrace(); System.exit(1); } } public static void main(String[] args) { new Launcher(); } }
Optional Paste Settings
Category:
None
Cryptocurrency
Cybersecurity
Fixit
Food
Gaming
Haiku
Help
History
Housing
Jokes
Legal
Money
Movies
Music
Pets
Photo
Science
Software
Source Code
Spirit
Sports
Travel
TV
Writing
Tags:
Syntax Highlighting:
None
Bash
C
C#
C++
CSS
HTML
JSON
Java
JavaScript
Lua
Markdown (PRO members only)
Objective C
PHP
Perl
Python
Ruby
Swift
4CS
6502 ACME Cross Assembler
6502 Kick Assembler
6502 TASM/64TASS
ABAP
AIMMS
ALGOL 68
APT Sources
ARM
ASM (NASM)
ASP
ActionScript
ActionScript 3
Ada
Apache Log
AppleScript
Arduino
Asymptote
AutoIt
Autohotkey
Avisynth
Awk
BASCOM AVR
BNF
BOO
Bash
Basic4GL
Batch
BibTeX
Blitz Basic
Blitz3D
BlitzMax
BrainFuck
C
C (WinAPI)
C Intermediate Language
C for Macs
C#
C++
C++ (WinAPI)
C++ (with Qt extensions)
C: Loadrunner
CAD DCL
CAD Lisp
CFDG
CMake
COBOL
CSS
Ceylon
ChaiScript
Chapel
Clojure
Clone C
Clone C++
CoffeeScript
ColdFusion
Cuesheet
D
DCL
DCPU-16
DCS
DIV
DOT
Dart
Delphi
Delphi Prism (Oxygene)
Diff
E
ECMAScript
EPC
Easytrieve
Eiffel
Email
Erlang
Euphoria
F#
FO Language
Falcon
Filemaker
Formula One
Fortran
FreeBasic
FreeSWITCH
GAMBAS
GDB
GDScript
Game Maker
Genero
Genie
GetText
Go
Godot GLSL
Groovy
GwBasic
HQ9 Plus
HTML
HTML 5
Haskell
Haxe
HicEst
IDL
INI file
INTERCAL
IO
ISPF Panel Definition
Icon
Inno Script
J
JCL
JSON
Java
Java 5
JavaScript
Julia
KSP (Kontakt Script)
KiXtart
Kotlin
LDIF
LLVM
LOL Code
LScript
Latex
Liberty BASIC
Linden Scripting
Lisp
Loco Basic
Logtalk
Lotus Formulas
Lotus Script
Lua
M68000 Assembler
MIX Assembler
MK-61/52
MPASM
MXML
MagikSF
Make
MapBasic
Markdown (PRO members only)
MatLab
Mercury
MetaPost
Modula 2
Modula 3
Motorola 68000 HiSoft Dev
MySQL
Nagios
NetRexx
Nginx
Nim
NullSoft Installer
OCaml
OCaml Brief
Oberon 2
Objeck Programming Langua
Objective C
Octave
Open Object Rexx
OpenBSD PACKET FILTER
OpenGL Shading
Openoffice BASIC
Oracle 11
Oracle 8
Oz
PARI/GP
PCRE
PHP
PHP Brief
PL/I
PL/SQL
POV-Ray
ParaSail
Pascal
Pawn
Per
Perl
Perl 6
Phix
Pic 16
Pike
Pixel Bender
PostScript
PostgreSQL
PowerBuilder
PowerShell
ProFTPd
Progress
Prolog
Properties
ProvideX
Puppet
PureBasic
PyCon
Python
Python for S60
QBasic
QML
R
RBScript
REBOL
REG
RPM Spec
Racket
Rails
Rexx
Robots
Roff Manpage
Ruby
Ruby Gnuplot
Rust
SAS
SCL
SPARK
SPARQL
SQF
SQL
SSH Config
Scala
Scheme
Scilab
SdlBasic
Smalltalk
Smarty
StandardML
StoneScript
SuperCollider
Swift
SystemVerilog
T-SQL
TCL
TeXgraph
Tera Term
TypeScript
TypoScript
UPC
Unicon
UnrealScript
Urbi
VB.NET
VBScript
VHDL
VIM
Vala
Vedit
VeriLog
Visual Pro Log
VisualBasic
VisualFoxPro
WHOIS
WhiteSpace
Winbatch
XBasic
XML
XPP
Xojo
Xorg Config
YAML
YARA
Z80 Assembler
ZXBasic
autoconf
jQuery
mIRC
newLISP
q/kdb+
thinBasic
Paste Expiration:
Never
Burn after read
10 Minutes
1 Hour
1 Day
1 Week
2 Weeks
1 Month
6 Months
1 Year
Paste Exposure:
Public
Unlisted
Private
Folder:
(members only)
Password
NEW
Enabled
Disabled
Burn after read
NEW
Paste Name / Title:
Create New Paste
Hello
Guest
Sign Up
or
Login
Sign in with Facebook
Sign in with Twitter
Sign in with Google
You are currently not logged in, this means you can not edit or delete anything you paste.
Sign Up
or
Login
Public Pastes
Untitled
JSON | 1 hour ago | 45.87 KB
Amazon Product: 160GB MP3 Player with Bluetoo...
JSON | 2 hours ago | 9.16 KB
Untitled
JSON | 3 hours ago | 45.65 KB
Looks_Patchy.py
Python | 4 hours ago | 7.10 KB
Untitled
C++ | 4 hours ago | 1.08 KB
dom.rab
C | 4 hours ago | 0.53 KB
ToanBreak Violence District Killer Script
Lua | 5 hours ago | 8.64 KB
Polymorphism
Java | 5 hours ago | 3.83 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the
Cookies Policy
.
OK, I Understand
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!