| @@ -0,0 +1,61 @@ | ||
| package com.vexoid.game; | ||
|
|
||
| import com.badlogic.gdx.ApplicationAdapter; | ||
| import com.badlogic.gdx.Gdx; | ||
| import com.badlogic.gdx.audio.Music; | ||
| import com.badlogic.gdx.graphics.GL20; | ||
| import com.badlogic.gdx.graphics.g2d.SpriteBatch; | ||
| import com.vexoid.game.screen.MenuScreen; | ||
| import com.vexoid.game.screen.ScreenManager; | ||
|
|
||
| public class MainGame extends ApplicationAdapter { | ||
|
|
||
| public static int WIDTH = 800, HEIGHT = 600; | ||
| private SpriteBatch batch; | ||
|
|
||
| private static String difficulty = "medium"; | ||
|
|
||
| static Music CurrentMusic; | ||
| ScreenManager screenManager = new ScreenManager(); | ||
|
|
||
| public void create () { | ||
| batch = new SpriteBatch(); | ||
| screenManager.setScreen(new MenuScreen(), difficulty); | ||
|
|
||
| System.out.println("Difficulty = " + difficulty); | ||
| } | ||
| public void render () { | ||
| screenManager.screenManagement(); | ||
| Gdx.gl.glClearColor(0, 0, 0, 1); | ||
| Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); | ||
|
|
||
| if (screenManager.getCurrentScreen() !=null) { | ||
| screenManager.getCurrentScreen().update(); | ||
| screenManager.getCurrentScreen().render(batch); | ||
| } else {System.out.println("Screen not there");} | ||
| } | ||
|
|
||
| public static void setDifficulty(String difficulty){ | ||
| MainGame.difficulty = difficulty; | ||
| } | ||
| public static String getGameDifficulty(){ | ||
| return difficulty; | ||
| } | ||
| public void dispose() { | ||
| if (screenManager.getCurrentScreen() !=null) | ||
| screenManager.getCurrentScreen().dispose(); | ||
| batch.dispose(); | ||
| } | ||
| public void resize(int width, int height) { | ||
| if (screenManager.getCurrentScreen() !=null) | ||
| screenManager.getCurrentScreen().resize(width, height); | ||
| } | ||
| public void pause() { | ||
| if (screenManager.getCurrentScreen() !=null) | ||
| screenManager.getCurrentScreen().pause(); | ||
| } | ||
| public void resume() { | ||
| if (screenManager.getCurrentScreen() !=null) | ||
| screenManager.getCurrentScreen().resume(); | ||
| } | ||
| } |
| @@ -0,0 +1,55 @@ | ||
| package com.vexoid.game; | ||
|
|
||
| import com.badlogic.gdx.Gdx; | ||
| import com.badlogic.gdx.audio.Music; | ||
| import com.badlogic.gdx.audio.Sound; | ||
|
|
||
| public class SoundManager { | ||
|
|
||
| private static Music CurrentMusic = null; | ||
|
|
||
| public static Music menuMusic = Gdx.audio.newMusic(Gdx.files.internal("assets/asdd - main 2.mp3")); | ||
| public static Music gameMusic = Gdx.audio.newMusic(Gdx.files.internal("assets/asdd - main.mp3")); | ||
| public static Music endMusic = Gdx.audio.newMusic(Gdx.files.internal("assets/end_game.mp3")); | ||
|
|
||
| public static Sound startSound = Gdx.audio.newSound(Gdx.files.internal("assets/start_game.mp3")); | ||
|
|
||
| public static Sound hit1 = Gdx.audio.newSound(Gdx.files.internal("assets/hit1.mp3")); | ||
| public static Sound hit2 = Gdx.audio.newSound(Gdx.files.internal("assets/hit2.mp3")); | ||
| public static Sound hit3 = Gdx.audio.newSound(Gdx.files.internal("assets/hit3.mp3")); | ||
| public static Sound hit4 = Gdx.audio.newSound(Gdx.files.internal("assets/hit4.mp3")); | ||
|
|
||
|
|
||
| public static Sound shot1 = Gdx.audio.newSound(Gdx.files.internal("assets/shot1.mp3")); | ||
| public static Sound shot2 = Gdx.audio.newSound(Gdx.files.internal("assets/shot2.mp3")); | ||
| public static Sound shot3 = Gdx.audio.newSound(Gdx.files.internal("assets/shot3.mp3")); | ||
|
|
||
| public static Sound laserShot1 = Gdx.audio.newSound(Gdx.files.internal("assets/laser_shot.mp3")); | ||
|
|
||
| public static Sound warning1 = Gdx.audio.newSound(Gdx.files.internal("assets/warning.mp3")); | ||
| public static Sound liveLost = Gdx.audio.newSound(Gdx.files.internal("assets/live_lost.mp3")); | ||
|
|
||
| public static Sound sound1 = Gdx.audio.newSound(Gdx.files.internal("assets/sound1.mp3")); | ||
|
|
||
| public static void stopASound(Sound sound){ | ||
| sound.stop(); | ||
| } | ||
| public static void playMusic(){ | ||
| CurrentMusic.play(); | ||
| } | ||
| public static void stopMusic(){ | ||
| CurrentMusic.stop(); | ||
| } | ||
| public static void pauseMusic(){ | ||
| CurrentMusic.pause(); | ||
| } | ||
| public static void setMusic(Music music, float vol, boolean loop){ | ||
| CurrentMusic = music; | ||
| CurrentMusic.play(); | ||
| CurrentMusic.setVolume(vol); | ||
| CurrentMusic.setLooping(loop); | ||
| } | ||
| public static Music getMusic(){ | ||
| return CurrentMusic; | ||
| } | ||
| } |
| @@ -0,0 +1,83 @@ | ||
| package com.vexoid.game; | ||
|
|
||
| import com.badlogic.gdx.Gdx; | ||
| import com.badlogic.gdx.graphics.Texture; | ||
|
|
||
| public class TextureManager { | ||
|
|
||
| public static Texture TITLE_IMAGE = new Texture(Gdx.files.internal("assets/image/Vexoids Title.png")); | ||
|
|
||
| public static Texture PLAYER = new Texture(Gdx.files.internal("assets/image/ship2.png")); | ||
|
|
||
| public static Texture BASIC_ENEMY = new Texture(Gdx.files.internal("assets/image/jellies2.png")); | ||
| public static Texture ADVANCED_ENEMY = new Texture(Gdx.files.internal("assets/image/jellies3.png")); | ||
| public static Texture LASER_ENEMY = new Texture(Gdx.files.internal("assets/image/enemyship_2.png")); | ||
|
|
||
| public static Texture BOSS_1 = new Texture(Gdx.files.internal("assets/image/jelly boss blue.png")); | ||
|
|
||
| // Bullets | ||
| // Player Bullets | ||
| public static Texture BULLET1 = new Texture(Gdx.files.internal("assets/image/bullets/bullet1.png")); | ||
| public static Texture BULLET1r = new Texture(Gdx.files.internal("assets/image/bullets/bullet1-r.png")); | ||
| public static Texture BULLET1y = new Texture(Gdx.files.internal("assets/image/bullets/bullet1-y.png")); | ||
| public static Texture BULLET1g = new Texture(Gdx.files.internal("assets/image/bullets/bullet1-g.png")); | ||
| public static Texture BULLET1b = new Texture(Gdx.files.internal("assets/image/bullets/bullet1-b.png")); | ||
|
|
||
| // Enemy Bullets | ||
| public static Texture BLUE_BULLET2 = new Texture(Gdx.files.internal("assets/image/bullets/blue-bullet2.png")); | ||
| public static Texture RED_BULLET2 = new Texture(Gdx.files.internal("assets/image/bullets/red-bullet2.png")); | ||
| public static Texture YELLOW_BULLET2 = new Texture(Gdx.files.internal("assets/image/bullets/yellow-bullet2.png")); | ||
|
|
||
| public static Texture LASER_BULLET = new Texture(Gdx.files.internal("assets/image/bullets/laser1.png")); | ||
| public static Texture LASER_BULLET1 = new Texture(Gdx.files.internal("assets/image/bullets/laser2.png")); | ||
| public static Texture LASER_BULLET2 = new Texture(Gdx.files.internal("assets/image/bullets/laser3.png")); | ||
| public static Texture LASER_BULLET3 = new Texture(Gdx.files.internal("assets/image/bullets/laser4.png")); | ||
| public static Texture LASER_BULLET4 = new Texture(Gdx.files.internal("assets/image/bullets/laser5.png")); | ||
|
|
||
| // General Effects | ||
| // Laser Warning effect | ||
| public static Texture LASER_WARNING1 = new Texture(Gdx.files.internal("assets/image/bullets/laser-indicator1.png")); | ||
| public static Texture LASER_WARNING2 = new Texture(Gdx.files.internal("assets/image/bullets/laser-indicator2.png")); | ||
|
|
||
| // Red effect | ||
| public static Texture RED_EFFECT1 = new Texture(Gdx.files.internal("assets/image/effects/red-effect1.png")); | ||
| public static Texture RED_EFFECT2 = new Texture(Gdx.files.internal("assets/image/effects/red-effect2.png")); | ||
| public static Texture RED_EFFECT3 = new Texture(Gdx.files.internal("assets/image/effects/red-effect3.png")); | ||
| public static Texture RED_EFFECT4 = new Texture(Gdx.files.internal("assets/image/effects/red-effect4.png")); | ||
| public static Texture RED_EFFECT5 = new Texture(Gdx.files.internal("assets/image/effects/red-effect5.png")); | ||
|
|
||
| // Blue effect | ||
| public static Texture BLUE_EFFECT1 = new Texture(Gdx.files.internal("assets/image/effects/blue-effect1.png")); | ||
| public static Texture BLUE_EFFECT2 = new Texture(Gdx.files.internal("assets/image/effects/blue-effect2.png")); | ||
| public static Texture BLUE_EFFECT3 = new Texture(Gdx.files.internal("assets/image/effects/blue-effect3.png")); | ||
| public static Texture BLUE_EFFECT4 = new Texture(Gdx.files.internal("assets/image/effects/blue-effect4.png")); | ||
| public static Texture BLUE_EFFECT5 = new Texture(Gdx.files.internal("assets/image/effects/blue-effect5.png")); | ||
|
|
||
| // Yellow effect | ||
| public static Texture YELLOW_EFFECT1 = new Texture(Gdx.files.internal("assets/image/effects/yellow-effect1.png")); | ||
| public static Texture YELLOW_EFFECT2 = new Texture(Gdx.files.internal("assets/image/effects/yellow-effect2.png")); | ||
| public static Texture YELLOW_EFFECT3 = new Texture(Gdx.files.internal("assets/image/effects/yellow-effect3.png")); | ||
| public static Texture YELLOW_EFFECT4 = new Texture(Gdx.files.internal("assets/image/effects/yellow-effect4.png")); | ||
| public static Texture YELLOW_EFFECT5 = new Texture(Gdx.files.internal("assets/image/effects/yellow-effect5.png")); | ||
|
|
||
|
|
||
| // Stars | ||
| public static Texture STAR1 = new Texture(Gdx.files.internal("assets/image/stars/star-1.png")); | ||
| public static Texture STAR2 = new Texture(Gdx.files.internal("assets/image/stars/star-2.png")); | ||
| public static Texture STAR3 = new Texture(Gdx.files.internal("assets/image/stars/star-3.png")); | ||
| public static Texture STAR4 = new Texture(Gdx.files.internal("assets/image/stars/star-4.png")); | ||
| public static Texture STAR5 = new Texture(Gdx.files.internal("assets/image/stars/star-5.png")); | ||
| public static Texture STARS = new Texture(Gdx.files.internal("assets/image/stars/stars.png")); | ||
|
|
||
| // Planets | ||
| public static Texture PLANET1 = new Texture(Gdx.files.internal("assets/image/stars/planet1.png")); | ||
| public static Texture PLANET1_1 = new Texture(Gdx.files.internal("assets/image/stars/planet1-1.png")); | ||
| public static Texture PLANET2 = new Texture(Gdx.files.internal("assets/image/stars/planet2.png")); | ||
| public static Texture PLANET2_2 = new Texture(Gdx.files.internal("assets/image/stars/planet2-1.png")); | ||
|
|
||
| /* | ||
| * The artwork for this project was created and donated by Frank Porcello. If this project is to generate any sum of currency | ||
| * some amount greater than 20% of the sum generated from this project must be sent to Frank Porcello for compensation. | ||
| * Failure to follow this procedure will result in lawsuit. | ||
| */ | ||
| } |
| @@ -0,0 +1,76 @@ | ||
| package com.vexoid.game.camera; | ||
|
|
||
| import com.badlogic.gdx.graphics.OrthographicCamera; | ||
| import com.badlogic.gdx.math.Matrix4; | ||
| import com.badlogic.gdx.math.Vector2; | ||
| import com.badlogic.gdx.math.Vector3; | ||
| import com.vexoid.game.MainGame; | ||
|
|
||
| public class OrthoCamera extends OrthographicCamera { | ||
|
|
||
| Vector3 tmp = new Vector3(); | ||
| Vector2 origin = new Vector2(); | ||
| VirtualViewport virtualViewport; | ||
| Vector2 pos = new Vector2(); | ||
|
|
||
| public OrthoCamera() { | ||
| this(new VirtualViewport(MainGame.WIDTH, MainGame.HEIGHT)); | ||
| } | ||
|
|
||
| public OrthoCamera(VirtualViewport virtualViewport) { | ||
| this(virtualViewport, 0f, 0f); | ||
| } | ||
|
|
||
| public OrthoCamera(VirtualViewport virtualViewport, float cx, float cy) { | ||
| this.virtualViewport = virtualViewport; | ||
| this.origin.set(cx, cy); | ||
| } | ||
|
|
||
| public void setVirtualViewport(VirtualViewport virtualViewport) { | ||
| this.virtualViewport = virtualViewport; | ||
| } | ||
|
|
||
| public void setPosition(float x, float y) { | ||
| position.set(x - viewportWidth * origin.x, y - viewportHeight * origin.y, 0f); | ||
| pos.set(x, y); | ||
| } | ||
|
|
||
| public Vector2 getPos() { | ||
| return pos; | ||
| } | ||
|
|
||
| @Override | ||
| public void update() { | ||
| float left = zoom * -viewportWidth / 2 + virtualViewport.getVirtualWidth() * origin.x; | ||
| float right = zoom * viewportWidth / 2 + virtualViewport.getVirtualWidth() * origin.x; | ||
| float top = zoom * viewportHeight / 2 + virtualViewport.getVirtualHeight() * origin.y; | ||
| float bottom = zoom * -viewportHeight / 2 + virtualViewport.getVirtualHeight() * origin.y; | ||
|
|
||
| projection.setToOrtho(left, right, bottom, top, Math.abs(near), Math.abs(far)); | ||
| view.setToLookAt(position, tmp.set(position).add(direction), up); | ||
| combined.set(projection); | ||
| Matrix4.mul(combined.val, view.val); | ||
| invProjectionView.set(combined); | ||
| Matrix4.inv(invProjectionView.val); | ||
| frustum.update(invProjectionView); | ||
| } | ||
|
|
||
| /** | ||
| * This must be called in ApplicationListener.resize() in order to correctly update the camera viewport. | ||
| */ | ||
| public void updateViewport() { | ||
| setToOrtho(false, virtualViewport.getWidth(), virtualViewport.getHeight()); | ||
| } | ||
|
|
||
| public Vector2 unprojectCoordinates(float x, float y) { | ||
| Vector3 rawtouch = new Vector3(x, y,0); | ||
| unproject(rawtouch); | ||
| return new Vector2(rawtouch.x, rawtouch.y); | ||
| } | ||
|
|
||
| public void resize() { | ||
| VirtualViewport virtualViewport = new VirtualViewport(MainGame.WIDTH, MainGame.HEIGHT); | ||
| setVirtualViewport(virtualViewport); | ||
| updateViewport(); | ||
| } | ||
| } |
| @@ -0,0 +1,71 @@ | ||
| package com.vexoid.game.camera; | ||
|
|
||
| import com.badlogic.gdx.Gdx; | ||
|
|
||
| public class VirtualViewport { | ||
|
|
||
| float virtualWidth; | ||
| float virtualHeight; | ||
|
|
||
| public float getVirtualWidth() { | ||
| return virtualWidth; | ||
| } | ||
|
|
||
| public float getVirtualHeight() { | ||
| return virtualHeight; | ||
| } | ||
|
|
||
| public VirtualViewport(float virtualWidth, float virtualHeight) { | ||
| this(virtualWidth, virtualHeight, false); | ||
| } | ||
|
|
||
| public VirtualViewport(float virtualWidth, float virtualHeight, boolean shrink) { | ||
| this.virtualWidth = virtualWidth; | ||
| this.virtualHeight = virtualHeight; | ||
| } | ||
|
|
||
| public float getWidth() { | ||
| return getWidth(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); | ||
| } | ||
|
|
||
| public float getHeight() { | ||
| return getHeight(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); | ||
| } | ||
|
|
||
| /** | ||
| * Returns the view port width to let all the virtual view port to be shown on the screen. | ||
| * | ||
| * @param screenWidth | ||
| * The screen width. | ||
| * @param screenHeight | ||
| * The screen Height. | ||
| */ | ||
| public float getWidth(float screenWidth, float screenHeight) { | ||
| float virtualAspect = virtualWidth / virtualHeight; | ||
| float aspect = screenWidth / screenHeight; | ||
| if (aspect > virtualAspect || (Math.abs(aspect - virtualAspect) < 0.01f)) { | ||
| return virtualHeight * aspect; | ||
| } else { | ||
| return virtualWidth; | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Returns the view port height to let all the virtual view port to be shown on the screen. | ||
| * | ||
| * @param screenWidth | ||
| * The screen width. | ||
| * @param screenHeight | ||
| * The screen Height. | ||
| */ | ||
| public float getHeight(float screenWidth, float screenHeight) { | ||
| float virtualAspect = virtualWidth / virtualHeight; | ||
| float aspect = screenWidth / screenHeight; | ||
| if (aspect > virtualAspect || (Math.abs(aspect - virtualAspect) < 0.01f)) { | ||
| return virtualHeight; | ||
| } else { | ||
| return virtualWidth / aspect; | ||
| } | ||
| } | ||
|
|
||
| } |
| @@ -0,0 +1,218 @@ | ||
| package com.vexoid.game.entity; | ||
|
|
||
| import com.badlogic.gdx.math.MathUtils; | ||
| import com.badlogic.gdx.math.Vector2; | ||
| import com.vexoid.game.MainGame; | ||
| import com.vexoid.game.SoundManager; | ||
| import com.vexoid.game.TextureManager; | ||
| import com.vexoid.game.entity.bullets.bullet1; | ||
| import com.vexoid.game.screen.GameScreen; | ||
|
|
||
| public class AdvancedEnemy extends Entity { | ||
|
|
||
| private String gameDifficulty; | ||
| private long lastFire; | ||
| private int firePower = 4; | ||
| public int timeDelay; | ||
| public int shotDelay; | ||
| private int ranLimit; | ||
| private int ran; | ||
| float initSpeed = (gameDifficulty == "hard"? 0.75f : (gameDifficulty== "medium"? 0.3f : (gameDifficulty== "easy"? 0.25f : 0.25f))); | ||
|
|
||
| public AdvancedEnemy(Vector2 pos, Vector2 direction, EntityManager entityManager, String difficulty) { | ||
| super(TextureManager.ADVANCED_ENEMY, pos, direction); | ||
| this.entityManager = entityManager; | ||
| gameDifficulty = difficulty; | ||
|
|
||
| if (gameDifficulty == "hard") { | ||
| firePower = MathUtils.random(4,7); | ||
| timeDelay = 1500; | ||
| shotDelay = MathUtils.random(0,20); | ||
| ranLimit = 3; | ||
| } | ||
| if (gameDifficulty == "medium") { | ||
| firePower = MathUtils.random(3,5); | ||
| timeDelay = 2000; | ||
| shotDelay = MathUtils.random(10,30); | ||
| ranLimit = 3; | ||
| } | ||
| if (gameDifficulty == "easy") { | ||
| firePower = MathUtils.random(2,4); | ||
| timeDelay = 3000; | ||
| shotDelay = MathUtils.random(20,40); | ||
| ranLimit = 2; | ||
| } | ||
| } | ||
|
|
||
| //health stuff | ||
| float healthPercent = 100; | ||
| boolean entityDied = false; | ||
| public void health(){ | ||
| if(healthPercent >= 100.000) | ||
| healthPercent=100.0f; | ||
| } | ||
| public void increaseHealth(float ammount){ | ||
| healthPercent += ammount; | ||
| if(healthPercent >= 100.0) | ||
| healthPercent=100; | ||
| } | ||
| public void decreaseHealth(float ammount){ | ||
| healthPercent -= ammount; | ||
| if(healthPercent <= 0) | ||
| entityDied = true; | ||
| } | ||
| public float getHealth(){ | ||
| return healthPercent; | ||
| } | ||
| public boolean entityDied(){ | ||
| return entityDied; | ||
| } | ||
|
|
||
| private final EntityManager entityManager; | ||
| int count = 0, time = 0, shooting = 0, spread, speed; | ||
| float xMovement; | ||
| float yMovement; | ||
| float xSpeed = MathUtils.random(0.5f,2.0f); | ||
| float ySpeed = 8 * initSpeed; | ||
| private int xTarget = MathUtils.random(0, MainGame.WIDTH - TextureManager.BASIC_ENEMY.getWidth()); | ||
| private int yTarget = MathUtils.random(MainGame.HEIGHT/2, MainGame.HEIGHT - TextureManager.BASIC_ENEMY.getHeight()); | ||
| boolean x = true; | ||
|
|
||
| public void update() { | ||
| time = GameScreen.count; | ||
| if (x){ran = MathUtils.random(1,ranLimit);} | ||
| x=false; | ||
| //Movement controlling what a bitch | ||
| if (gameDifficulty == "hard"){ | ||
| // X movement | ||
| if (pos.x > xTarget+5 || pos.x < xTarget-5){ | ||
| if (pos.x > xTarget) { | ||
| xMovement = -xSpeed; | ||
| } else { | ||
| xMovement = xSpeed; | ||
| } | ||
| } else{ | ||
| xTarget = MathUtils.random(0, MainGame.WIDTH-TextureManager.BASIC_ENEMY.getWidth()); | ||
| xSpeed = MathUtils.random(1.0f,3.0f); | ||
| } | ||
| // Y movement | ||
| if (pos.y > yTarget+5 || pos.y < yTarget-5){ | ||
| if (pos.y > yTarget) { | ||
| yMovement = -ySpeed; | ||
| } else { | ||
| yMovement = ySpeed; | ||
| } | ||
| } else{ | ||
| yTarget = MathUtils.random(MainGame.HEIGHT/2, MainGame.HEIGHT - TextureManager.BASIC_ENEMY.getHeight()); | ||
| ySpeed = MathUtils.random(1.0f,2.0f); | ||
| } | ||
| pos.add(direction.set(xMovement, yMovement)); | ||
| } | ||
|
|
||
| if (gameDifficulty == "medium"){ | ||
| if (pos.x > xTarget+5 || pos.x < xTarget-5){ | ||
| if (pos.x > xTarget) { | ||
| xMovement = -xSpeed; | ||
| } else { | ||
| xMovement = xSpeed; | ||
| } | ||
| } else{ | ||
| xTarget = MathUtils.random(0, MainGame.WIDTH-TextureManager.BASIC_ENEMY.getWidth()); | ||
| xSpeed = MathUtils.random(1.0f,2.0f); | ||
| } | ||
| // Y movement | ||
| if (pos.y > yTarget+5 || pos.y < yTarget-5){ | ||
| if (pos.y > yTarget) { | ||
| yMovement = -ySpeed; | ||
| } else { | ||
| yMovement = ySpeed; | ||
| } | ||
| } else{ | ||
| yTarget = MathUtils.random(MainGame.HEIGHT/2, MainGame.HEIGHT - TextureManager.BASIC_ENEMY.getHeight()); | ||
| ySpeed = MathUtils.random(0.5f,1.5f); | ||
| } | ||
| pos.add(direction.set(xMovement, yMovement)); | ||
| } | ||
|
|
||
| if (gameDifficulty == "easy"){ | ||
| if (pos.x > xTarget+5 || pos.x < xTarget-5){ | ||
| if (pos.x > xTarget) { | ||
| xMovement = -xSpeed; | ||
| } else { | ||
| xMovement = xSpeed; | ||
| } | ||
| } else{ | ||
| xTarget = MathUtils.random(0, MainGame.WIDTH-TextureManager.BASIC_ENEMY.getWidth()); | ||
| xSpeed = MathUtils.random(0.5f,1.0f); | ||
| } | ||
| // Y movement | ||
| if (pos.y > yTarget+5 || pos.y < yTarget-5){ | ||
| if (pos.y > yTarget) { | ||
| yMovement = -ySpeed; | ||
| } else { | ||
| yMovement = ySpeed; | ||
| } | ||
| } else{ | ||
| yTarget = MathUtils.random(MainGame.HEIGHT/2, MainGame.HEIGHT - TextureManager.BASIC_ENEMY.getHeight()); | ||
| ySpeed = MathUtils.random(0.2f,0.5f); | ||
| } | ||
| pos.add(direction.set(xMovement, yMovement)); | ||
| } | ||
|
|
||
| // detects when the enemy is within bounds and controls shooting | ||
| if (pos.y < MainGame.HEIGHT-TextureManager.BASIC_ENEMY.getHeight()) { | ||
| if (System.currentTimeMillis() - lastFire >= MathUtils.random(timeDelay, timeDelay+1500)) { | ||
| shooting ++; | ||
| if(shooting >= shotDelay+5 && ran == 1) { | ||
| count ++; | ||
| spread = 5; | ||
| speed = 5; | ||
| entityManager.addEntity(new bullet1(pos.cpy().add(15, 30), spread, speed)); | ||
| entityManager.addEntity(new bullet1(pos.cpy().add(15, 30), spread, speed)); | ||
| entityManager.addEntity(new bullet1(pos.cpy().add(15, 30), spread, speed)); | ||
| entityManager.addEntity(new bullet1(pos.cpy().add(15, 30), spread, speed)); | ||
| entityManager.addEntity(new bullet1(pos.cpy().add(15, 30), spread, speed)); | ||
| SoundManager.shot1.play(0.4f); | ||
| if (count >= firePower/2) { | ||
| count = 0; | ||
| lastFire = System.currentTimeMillis()+1000; | ||
| } | ||
| shooting = 0; | ||
| } | ||
| if(ran == 2) { | ||
| count ++; | ||
| spread = 4; | ||
| speed = 4; | ||
| if (count >=2){ | ||
| entityManager.addEntity(new bullet1(pos.cpy().add(15, 30), spread, speed)); | ||
| SoundManager.shot1.play(0.4f); | ||
| } | ||
| if (count >= firePower*5) { | ||
| count = 0; | ||
| lastFire = System.currentTimeMillis()+2000; | ||
| } | ||
| shooting = 0; | ||
| } | ||
| if(ran ==3) { | ||
| count ++; | ||
| spread = 1; | ||
| speed = 3; | ||
| entityManager.addEntity(new bullet1(pos.cpy().add(15, 30), spread, speed)); | ||
| SoundManager.shot1.play(0.4f); | ||
| if (count >= firePower*2) { | ||
| count = 0; | ||
| lastFire = System.currentTimeMillis()-1000; | ||
| } | ||
| shooting = 0; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| //detects if the enemy has fallen down off screen and resets it back up at the top with a random X | ||
| if (pos.y <= -TextureManager.BASIC_ENEMY.getHeight()) { | ||
| float x = MathUtils.random(0, MainGame.WIDTH - TextureManager.BASIC_ENEMY.getWidth()); | ||
| pos.set(x, MainGame.HEIGHT); | ||
| } | ||
| } | ||
|
|
||
| } |
| @@ -0,0 +1,202 @@ | ||
| package com.vexoid.game.entity; | ||
|
|
||
| import com.badlogic.gdx.math.MathUtils; | ||
| import com.badlogic.gdx.math.Vector2; | ||
| import com.vexoid.game.MainGame; | ||
| import com.vexoid.game.SoundManager; | ||
| import com.vexoid.game.TextureManager; | ||
| import com.vexoid.game.entity.bullets.bullet1; | ||
|
|
||
| public class BasicEnemy extends Entity { | ||
|
|
||
| private String gameDifficulty; | ||
| private long lastFire; | ||
|
|
||
| public int timeDelay, shotDelay; | ||
| private int ranLimit, ran, firePower = 4; | ||
|
|
||
| float initSpeed = (gameDifficulty == "hard"? 0.75f : (gameDifficulty== "medium"? 0.3f : (gameDifficulty== "easy"? 0.25f : 0.25f))); | ||
|
|
||
| public BasicEnemy(Vector2 pos, Vector2 direction, EntityManager entityManager, String difficulty) { | ||
| super(TextureManager.BASIC_ENEMY, pos, direction); | ||
| this.entityManager = entityManager; | ||
| gameDifficulty = difficulty; | ||
|
|
||
| if (gameDifficulty == "hard") { | ||
| firePower = MathUtils.random(4,7); | ||
| timeDelay = 1500; | ||
| shotDelay = MathUtils.random(0,20); | ||
| ranLimit = 2; | ||
| } | ||
| if (gameDifficulty == "medium") { | ||
| firePower = MathUtils.random(3,5); | ||
| timeDelay = 2000; | ||
| shotDelay = MathUtils.random(10,30); | ||
| ranLimit = 2; | ||
| } | ||
| if (gameDifficulty == "easy") { | ||
| firePower = MathUtils.random(2,4); | ||
| timeDelay = 3000; | ||
| shotDelay = MathUtils.random(20,40); | ||
| ranLimit = 1; | ||
| } | ||
| } | ||
|
|
||
| //health stuff | ||
| float healthPercent = 100; | ||
| boolean entityDied = false; | ||
| public void health(){ | ||
| if(healthPercent >= 100.000) | ||
| healthPercent=100.0f; | ||
| } | ||
| public void increaseHealth(float ammount){ | ||
| healthPercent += ammount; | ||
| if(healthPercent >= 100.0) | ||
| healthPercent=100; | ||
| } | ||
| public void decreaseHealth(float ammount){ | ||
| healthPercent -= ammount; | ||
| if(healthPercent <= 0) | ||
| entityDied = true; | ||
| } | ||
| public float getHealth(){ | ||
| return healthPercent; | ||
| } | ||
| public boolean entityDied(){ | ||
| return entityDied; | ||
| } | ||
|
|
||
| private final EntityManager entityManager; | ||
| private int count = 0, shooting = 0, spread, speed; | ||
| float xMovement; | ||
| float yMovement; | ||
| float xSpeed = MathUtils.random(0.5f,2.0f); | ||
| float ySpeed = 8 * initSpeed; | ||
| private int xTarget = MathUtils.random(0, MainGame.WIDTH - TextureManager.BASIC_ENEMY.getWidth()); | ||
| private int yTarget = MathUtils.random(MainGame.HEIGHT/2, MainGame.HEIGHT - TextureManager.BASIC_ENEMY.getHeight()); | ||
| boolean x = true; | ||
|
|
||
| public void update() { | ||
| if (x){ran = MathUtils.random(1,ranLimit);} | ||
| x=false; | ||
|
|
||
| //Movement controlling what a bitch | ||
| if (gameDifficulty == "hard"){ | ||
| // X movement | ||
| if (pos.x > xTarget+5 || pos.x < xTarget-5){ | ||
| if (pos.x > xTarget) { | ||
| xMovement = -xSpeed; | ||
| } else { | ||
| xMovement = xSpeed; | ||
| } | ||
| } else{ | ||
| xTarget = MathUtils.random(0, MainGame.WIDTH-TextureManager.BASIC_ENEMY.getWidth()); | ||
| xSpeed = MathUtils.random(0.5f,5.0f); | ||
| } | ||
| // Y movement | ||
| if (pos.y > yTarget+5 || pos.y < yTarget-5){ | ||
| if (pos.y > yTarget) { | ||
| yMovement = -ySpeed; | ||
| } else { | ||
| yMovement = ySpeed; | ||
| } | ||
| } else{ | ||
| yTarget = MathUtils.random(MainGame.HEIGHT/2, MainGame.HEIGHT - TextureManager.BASIC_ENEMY.getHeight()); | ||
| ySpeed = MathUtils.random(1.0f,3.0f); | ||
| } | ||
| pos.add(direction.set(xMovement, yMovement)); | ||
| } | ||
|
|
||
| if (gameDifficulty == "medium"){ | ||
| if (pos.x > xTarget+5 || pos.x < xTarget-5){ | ||
| if (pos.x > xTarget) { | ||
| xMovement = -xSpeed; | ||
| } else { | ||
| xMovement = xSpeed; | ||
| } | ||
| } else{ | ||
| xTarget = MathUtils.random(0, MainGame.WIDTH-TextureManager.BASIC_ENEMY.getWidth()); | ||
| xSpeed = MathUtils.random(0.5f,3.5f); | ||
| } | ||
| // Y movement | ||
| if (pos.y > yTarget+5 || pos.y < yTarget-5){ | ||
| if (pos.y > yTarget) { | ||
| yMovement = -ySpeed; | ||
| } else { | ||
| yMovement = ySpeed; | ||
| } | ||
| } else{ | ||
| yTarget = MathUtils.random(MainGame.HEIGHT/2, MainGame.HEIGHT - TextureManager.BASIC_ENEMY.getHeight()); | ||
| ySpeed = MathUtils.random(1.0f,2.0f); | ||
| } | ||
| pos.add(direction.set(xMovement, yMovement)); | ||
| } | ||
|
|
||
| if (gameDifficulty == "easy"){ | ||
| if (pos.x > xTarget+5 || pos.x < xTarget-5){ | ||
| if (pos.x > xTarget) { | ||
| xMovement = -xSpeed; | ||
| } else { | ||
| xMovement = xSpeed; | ||
| } | ||
| } else{ | ||
| xTarget = MathUtils.random(0, MainGame.WIDTH-TextureManager.BASIC_ENEMY.getWidth()); | ||
| xSpeed = MathUtils.random(0.5f,2.0f); | ||
| } | ||
| // Y movement | ||
| if (pos.y > yTarget+5 || pos.y < yTarget-5){ | ||
| if (pos.y > yTarget) { | ||
| yMovement = -ySpeed; | ||
| } else { | ||
| yMovement = ySpeed; | ||
| } | ||
| } else{ | ||
| yTarget = MathUtils.random(MainGame.HEIGHT/2, MainGame.HEIGHT - TextureManager.BASIC_ENEMY.getHeight()); | ||
| ySpeed = MathUtils.random(1.0f,1.5f); | ||
| } | ||
| pos.add(direction.set(xMovement, yMovement)); | ||
| } | ||
|
|
||
| // detects when the enemy is within bounds and controls shooting | ||
| if (pos.y < MainGame.HEIGHT-TextureManager.BASIC_ENEMY.getHeight()) { | ||
| if (System.currentTimeMillis() - lastFire >= MathUtils.random(timeDelay, timeDelay+1500)) { | ||
| shooting ++; | ||
| if(shooting >= shotDelay+2 && ran ==1) { | ||
| count ++; | ||
| spread = 3; | ||
| speed = 7; | ||
| entityManager.addEntity(new bullet1(pos.cpy().add(15, 30), spread, speed)); | ||
| SoundManager.shot1.play(0.4f); | ||
| if (count >= firePower) { | ||
| count = 0; | ||
| lastFire = System.currentTimeMillis(); | ||
| } | ||
| shooting = 0; | ||
| } | ||
| if(shooting >= shotDelay+5 && ran == 2) { | ||
| count ++; | ||
| spread = 5; | ||
| speed = 5; | ||
| entityManager.addEntity(new bullet1(pos.cpy().add(15, 30), spread, speed)); | ||
| entityManager.addEntity(new bullet1(pos.cpy().add(15, 30), spread, speed)); | ||
| entityManager.addEntity(new bullet1(pos.cpy().add(15, 30), spread, speed)); | ||
| entityManager.addEntity(new bullet1(pos.cpy().add(15, 30), spread, speed)); | ||
| entityManager.addEntity(new bullet1(pos.cpy().add(15, 30), spread, speed)); | ||
| SoundManager.shot1.play(0.4f); | ||
| if (count >= firePower/2) { | ||
| count = 0; | ||
| lastFire = System.currentTimeMillis()+1000; | ||
| } | ||
| shooting = 0; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| //detects if the enemy has fallen down off screen and resets it back up at the top with a random X | ||
| if (pos.y <= -TextureManager.BASIC_ENEMY.getHeight()) { | ||
| float x = MathUtils.random(0, MainGame.WIDTH - TextureManager.BASIC_ENEMY.getWidth()); | ||
| pos.set(x, MainGame.HEIGHT); | ||
| } | ||
| } | ||
|
|
||
| } |
| @@ -0,0 +1,148 @@ | ||
| package com.vexoid.game.entity; | ||
|
|
||
| import com.badlogic.gdx.math.MathUtils; | ||
| import com.badlogic.gdx.math.Vector2; | ||
| import com.vexoid.game.MainGame; | ||
| import com.vexoid.game.SoundManager; | ||
| import com.vexoid.game.TextureManager; | ||
| import com.vexoid.game.entity.bullets.LaserBullet1; | ||
| import com.vexoid.game.entity.effects.BlastEffect; | ||
| import com.vexoid.game.entity.effects.Effect1; | ||
| import com.vexoid.game.entity.effects.Effect3_LaserWarning; | ||
|
|
||
| public class BasicLaserEnemy extends Entity { | ||
| String gameDifficulty; | ||
| int timeDelay=0,textureVariation = 2,textureVariation2 = 4,stageDelay = 600; | ||
| public static int basicLaserEnemyHealth; | ||
| BlastEffect blast; | ||
|
|
||
| public BasicLaserEnemy(Vector2 pos, Vector2 direction, EntityManager entityManager, String difficulty) { | ||
| super(TextureManager.LASER_ENEMY, pos, direction); | ||
| this.entityManager = entityManager; | ||
| gameDifficulty = difficulty; | ||
| stageDelay = MathUtils.random(450,600); | ||
| if (gameDifficulty == "hard") { | ||
| timeDelay = 300; | ||
| } | ||
| if (gameDifficulty == "medium") { | ||
| timeDelay = 300; | ||
| } | ||
| if (gameDifficulty == "easy") { | ||
| timeDelay = 300; | ||
| } | ||
| } | ||
|
|
||
| //health stuff | ||
| float healthPercent = 100; | ||
| boolean entityDied = false; | ||
| public void health(){ | ||
| if(healthPercent >= 100.000) | ||
| healthPercent=100.0f; | ||
| } | ||
| public void increaseHealth(float ammount){ | ||
| healthPercent += ammount; | ||
| if(healthPercent >= 100.0) | ||
| healthPercent=100; | ||
| } | ||
| public void decreaseHealth(float ammount){ | ||
| healthPercent -= ammount; | ||
| if(healthPercent <= 0) | ||
| entityDied = true; | ||
| } | ||
| public float getHealth(){ | ||
| return healthPercent; | ||
| } | ||
| public boolean entityDied(){ | ||
| SoundManager.laserShot1.stop(); | ||
| return entityDied; | ||
| } | ||
|
|
||
| private final EntityManager entityManager; | ||
| float xMovement; | ||
| float yMovement; | ||
| float xSpeed = 2; | ||
| float ySpeed = 2; | ||
| private int xTarget = (int) Player.PositionX; | ||
| private int yTarget = MathUtils.random(MainGame.HEIGHT - 100, MainGame.HEIGHT - TextureManager.LASER_ENEMY.getHeight()); | ||
| private int adjustment = MathUtils.random(-150, 150); | ||
| private int firemode = 0; | ||
| int internalClock = 0; | ||
| int internalClock2 = 0; | ||
| boolean sound = true; | ||
|
|
||
| public void update() { | ||
| if (firemode == 0){ | ||
| internalClock2 = 0; | ||
| xTarget = (int) Player.PositionX + adjustment; | ||
| if(xTarget <= 0){ | ||
| adjustment = MathUtils.random(1, 150); | ||
| xTarget = (int) Player.PositionX + adjustment; | ||
| } | ||
| if(xTarget >= MainGame.WIDTH){ | ||
| adjustment = MathUtils.random(-150, -1); | ||
| xTarget = (int) Player.PositionX + adjustment; | ||
| } | ||
| if (pos.x > xTarget+2 || pos.x < xTarget-2){ | ||
| if (pos.x > xTarget){ | ||
| xMovement = -xSpeed; | ||
| } else { | ||
| xMovement = xSpeed; | ||
| } | ||
| } else { | ||
| xMovement = 0; | ||
| adjustment = MathUtils.random(-150, 150); | ||
| xSpeed = MathUtils.random(1.3f, 2); | ||
| } | ||
|
|
||
| // Y movement | ||
| if (pos.y > yTarget+5 || pos.y < yTarget-5){ | ||
| if (pos.y > yTarget) { | ||
| yMovement = -ySpeed; | ||
| } else { | ||
| yMovement = ySpeed; | ||
| } | ||
| } else{ | ||
| yTarget = MathUtils.random(MainGame.HEIGHT - 100, MainGame.HEIGHT - TextureManager.LASER_ENEMY.getHeight()); | ||
| ySpeed = MathUtils.random(0.1f,0.8f); | ||
| } | ||
| pos.add(direction.set(xMovement, yMovement)); | ||
| } | ||
|
|
||
| if (pos.y < MainGame.HEIGHT){ | ||
| internalClock ++; | ||
| if (internalClock >= stageDelay) | ||
| firemode =1; | ||
| if (firemode ==1 && internalClock >= stageDelay) { | ||
| internalClock = 0; | ||
| firemode = 2; | ||
| SoundManager.warning1.play(0.6f); | ||
| } | ||
| if (firemode >= 1){ | ||
| entityManager.addEntity(new Effect1(pos.cpy().add(TextureManager.LASER_ENEMY.getWidth()/2 + MathUtils.random(-70, 70), | ||
| -MathUtils.random(-30,70)), new Vector2(pos.x+(TextureManager.LASER_ENEMY.getWidth()/2),pos.y))); | ||
|
|
||
| entityManager.addEntity(new Effect3_LaserWarning(pos.cpy().add(TextureManager.LASER_ENEMY.getHeight()/2 - textureVariation, | ||
| -TextureManager.LASER_WARNING1.getHeight()+10+textureVariation2), direction)); | ||
| } | ||
| // 3rd state of shooting | ||
| if (firemode == 2 && internalClock >= 60){ | ||
| if (sound){ | ||
| SoundManager.laserShot1.play(0.25f); | ||
| sound = false; | ||
| } | ||
| entityManager.addEntity(new LaserBullet1(pos.cpy().add(TextureManager.LASER_ENEMY.getHeight()/2-8- textureVariation, | ||
| -TextureManager.LASER_BULLET.getHeight()+10+textureVariation2))); | ||
| internalClock2 ++; | ||
|
|
||
| if (internalClock2 > 275){ | ||
| internalClock = 0; | ||
| firemode =0; | ||
| sound = true; | ||
| } | ||
| } | ||
|
|
||
| } | ||
|
|
||
| } | ||
|
|
||
| } |
| @@ -0,0 +1,35 @@ | ||
| package com.vexoid.game.entity; | ||
|
|
||
| import com.badlogic.gdx.Gdx; | ||
| import com.badlogic.gdx.graphics.Texture; | ||
| import com.badlogic.gdx.graphics.g2d.SpriteBatch; | ||
| import com.badlogic.gdx.math.Rectangle; | ||
| import com.badlogic.gdx.math.Vector2; | ||
|
|
||
| public abstract class Entity { | ||
|
|
||
| protected Texture texture; | ||
| protected Vector2 pos, direction; | ||
|
|
||
| public Entity(Texture texture, Vector2 pos, Vector2 direction) { | ||
| this.texture = texture; | ||
| this.pos = pos; | ||
| this.direction = direction; | ||
| } | ||
| public abstract void update(); | ||
|
|
||
| public void render(SpriteBatch sb) { | ||
| sb.draw(texture, pos.x, pos.y); | ||
| } | ||
| public Vector2 getPosition() { | ||
| return pos; | ||
| } | ||
| public Rectangle getBounds() { | ||
| return new Rectangle((pos.x + (texture.getWidth()/3)), (pos.y + (texture.getHeight()/3)), | ||
| (texture.getWidth()/3), texture.getHeight()/3); | ||
| } | ||
| public void setDirection(float x, float y) { | ||
| direction.set(x, y); | ||
| direction.scl(Gdx.graphics.getDeltaTime()); | ||
| } | ||
| } |
| @@ -0,0 +1,227 @@ | ||
| package com.vexoid.game.entity; | ||
|
|
||
| import com.badlogic.gdx.Gdx; | ||
| import com.badlogic.gdx.Input.Keys; | ||
| import com.badlogic.gdx.math.MathUtils; | ||
| import com.badlogic.gdx.math.Rectangle; | ||
| import com.badlogic.gdx.math.Vector2; | ||
| import com.vexoid.game.MainGame; | ||
| import com.vexoid.game.SoundManager; | ||
| import com.vexoid.game.TextureManager; | ||
| import com.vexoid.game.camera.OrthoCamera; | ||
| import com.vexoid.game.entity.bullets.Blue_Bullet2; | ||
| import com.vexoid.game.entity.bullets.Red_Bullet2; | ||
| import com.vexoid.game.entity.bullets.Yellow_Bullet2; | ||
|
|
||
| public class Player extends Entity{ | ||
|
|
||
| private final EntityManager entityManager; | ||
| private long lastFire; | ||
| private final OrthoCamera camera; | ||
| public static float PositionX; | ||
| private int shootDelay = 20; | ||
| private float spread = 0.5f; | ||
| static String shootingMode = "narrow", bulletMode = "light"; | ||
| String difficulty; | ||
|
|
||
| public Player(Vector2 pos, Vector2 direction, EntityManager entityManager, OrthoCamera camera) { | ||
| super(TextureManager.PLAYER, pos, direction); | ||
| this.entityManager = entityManager; | ||
| this.camera = camera; | ||
| PositionX = pos.x; | ||
| } | ||
|
|
||
| // Health stuff | ||
| float healthPercent = 100; | ||
| int clock = 0; | ||
| boolean playerDied = false, playerOutOfLives = false; | ||
| public void health(){ | ||
| clock ++; | ||
| if(healthPercent >= 100.000) | ||
| healthPercent=100.0f; | ||
| if(clock > 750){ | ||
| for(int i=(int) healthPercent; i< 100; i++){ | ||
| healthPercent += 0.01f; | ||
| } | ||
| if(healthPercent >= 100) | ||
| clock=0; | ||
| } | ||
| } | ||
| public void increaseHealth(float ammount){ | ||
| healthPercent += ammount; | ||
| if(healthPercent >= 100.0) | ||
| healthPercent=100; | ||
| } | ||
| public void decreaseHealth(float ammount){ | ||
| clock=0; | ||
| healthPercent -= ammount; | ||
| if(healthPercent <= 0) | ||
| playerDied = true; | ||
| } | ||
| public float getHealth(){ | ||
| return healthPercent; | ||
| } | ||
|
|
||
| boolean tookLives = false; | ||
| public void liveSystem(){ | ||
| if (playerDied && !tookLives){ | ||
| tookLives = true; | ||
| healthPercent = 100.0f; | ||
| EntityManager.lives --; | ||
| playerDied = false; | ||
| } | ||
| } | ||
| public boolean playerOutOfLives(){ | ||
| return playerOutOfLives; | ||
| } | ||
|
|
||
| // Player hitbox | ||
| public Rectangle getBounds() { | ||
| return new Rectangle((pos.x + ((texture.getWidth()/2)/1.25f)), (pos.y + ((texture.getHeight()/2)/1.25f)), | ||
| (texture.getWidth()- (texture.getWidth()/1.25f)), (texture.getHeight()-(texture.getHeight()/1.25f))); | ||
| } | ||
|
|
||
| public String shootingMode(){ | ||
| return shootingMode; | ||
| } | ||
| public String bulletMode(){ | ||
| return bulletMode; | ||
| } | ||
| int Switch = 0, Toggle = 1, Switch2 = 0, Toggle2 = 1; | ||
| public void update() { | ||
|
|
||
| if (canPlayerMove){ | ||
| pos.add(direction); | ||
| PositionX = pos.x; | ||
| health(); | ||
| liveSystem(); | ||
| int dir = 0; | ||
| if (Gdx.input.isTouched()) { | ||
| Vector2 touch = camera.unprojectCoordinates(Gdx.input.getX(), Gdx.input.getY()); | ||
| if (touch.x < MainGame.WIDTH / 2 && pos.x > 0) | ||
| dir = 1; | ||
| else | ||
| if(pos.x < (MainGame.WIDTH - TextureManager.PLAYER.getWidth())) | ||
| dir = 2; | ||
| } | ||
|
|
||
| /* * * * * * * * | ||
| * Here is the * | ||
| * controls of * | ||
| * the player * | ||
| * * * * * * * */ | ||
| if ((Gdx.input.isKeyPressed(Keys.A)&&!Gdx.input.isKeyPressed(Keys.D))&&(pos.x > 0)||(dir == 1)|| | ||
| ((Gdx.input.isKeyPressed(Keys.LEFT)&&!Gdx.input.isKeyPressed(Keys.RIGHT))&&(pos.x > 0))) { | ||
| setDirection(-400, 0); | ||
| } else { | ||
| if ((Gdx.input.isKeyPressed(Keys.D)&&!Gdx.input.isKeyPressed(Keys.A)) | ||
| &&(pos.x < MainGame.WIDTH - this.texture.getWidth())||(dir ==2) | ||
| ||((Gdx.input.isKeyPressed(Keys.RIGHT)&&!Gdx.input.isKeyPressed(Keys.LEFT)) | ||
| &&(pos.x < MainGame.WIDTH - this.texture.getWidth()))) { | ||
| setDirection(400, 0); | ||
| } else { | ||
| if ((Gdx.input.isKeyPressed(Keys.W)&&!Gdx.input.isKeyPressed(Keys.S)) | ||
| &&(pos.y < MainGame.HEIGHT - this.texture.getHeight()) | ||
| || (Gdx.input.isKeyPressed(Keys.UP)&&!Gdx.input.isKeyPressed(Keys.DOWN)) | ||
| &&(pos.y < MainGame.HEIGHT - this.texture.getHeight())) { | ||
| setDirection(0, 400); | ||
| } else { | ||
| if ((Gdx.input.isKeyPressed(Keys.S)&&!Gdx.input.isKeyPressed(Keys.W)) | ||
| &&(pos.y > 0)|| (Gdx.input.isKeyPressed(Keys.DOWN)&&!Gdx.input.isKeyPressed(Keys.UP))&&(pos.y > 0)) { | ||
| setDirection(0, -400); | ||
| } else { | ||
| setDirection(0,0); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // Shooting modes | ||
| if (Gdx.input.isKeyPressed(Keys.B)&& Switch != 1 && Toggle == 1){ | ||
| shootingMode = "Wide"; | ||
| spread = 3.5f; | ||
| SoundManager.sound1.play(1); | ||
| Toggle = 2; | ||
| } else | ||
| if (Gdx.input.isKeyPressed(Keys.B)&& Switch != 1 && Toggle == 2){ | ||
| shootingMode = "Narrow"; | ||
| spread = 0.5f; | ||
| SoundManager.sound1.play(1); | ||
| Toggle = 1; | ||
| } | ||
| if (Gdx.input.isKeyPressed(Keys.B)) | ||
| Switch = 1; | ||
| else | ||
| Switch = 0; | ||
|
|
||
| // Switch Bullets | ||
| if (Gdx.input.isKeyPressed(Keys.F)&& Switch2 != 1 && Toggle2 == 1){ | ||
| bulletMode = "energy"; | ||
| shootDelay = 10; | ||
| SoundManager.sound1.play(1); | ||
| Toggle2 = 2; | ||
| } else | ||
| if (Gdx.input.isKeyPressed(Keys.F)&& Switch2 != 1 && Toggle2 == 2){ | ||
| bulletMode = "heavy"; | ||
| shootDelay = 50; | ||
| SoundManager.sound1.play(1); | ||
| Toggle2 = 3; | ||
| } else | ||
| if (Gdx.input.isKeyPressed(Keys.F)&& Switch2 != 1 && Toggle2 == 3){ | ||
| bulletMode = "light"; | ||
| shootDelay = 17; | ||
| SoundManager.sound1.play(1); | ||
| Toggle2 = 1; | ||
| } | ||
| if (Gdx.input.isKeyPressed(Keys.F)) | ||
| Switch2 = 1; | ||
| else | ||
| Switch2 = 0; | ||
|
|
||
| // Shoot bullets | ||
| Vector2 point1 = new Vector2(pos.cpy().add(-14, TextureManager.PLAYER.getHeight()/2)); | ||
| Vector2 point2 = new Vector2(pos.cpy().add(TextureManager.PLAYER.getWidth()-17,TextureManager.PLAYER.getHeight()/2)); | ||
| float var = MathUtils.random(2,6); | ||
| float var2 = 3; | ||
|
|
||
| if (Gdx.input.isKeyPressed(Keys.SPACE) || dir ==1 || dir == 2){ | ||
| if(bulletMode == "light") | ||
| if (System.currentTimeMillis() - lastFire >= shootDelay) { | ||
| int r = MathUtils.random(0,1); | ||
| if(r==0) | ||
| entityManager.addEntity(new Blue_Bullet2(point1, new Vector2(MathUtils.random(-spread, spread+var2), 18))); | ||
| if(r==1) | ||
| entityManager.addEntity(new Blue_Bullet2(point2, new Vector2(MathUtils.random(-spread-var2, spread), 18))); | ||
|
|
||
| SoundManager.shot2.play(0.2f); | ||
| lastFire = System.currentTimeMillis(); | ||
| } | ||
| if(bulletMode == "heavy") | ||
| if (System.currentTimeMillis() - lastFire >= shootDelay) { | ||
| int r = MathUtils.random(0,1); | ||
| if(r==0) | ||
| entityManager.addEntity(new Red_Bullet2(point1, new Vector2(MathUtils.random(-spread, spread+var2), 18))); | ||
| if(r==1) | ||
| entityManager.addEntity(new Red_Bullet2(point2, new Vector2(MathUtils.random(-spread-var2, spread), 18))); | ||
|
|
||
| SoundManager.shot2.play(0.2f); | ||
| lastFire = System.currentTimeMillis(); | ||
| } | ||
| if(bulletMode == "energy") | ||
| if (System.currentTimeMillis() - lastFire >= shootDelay) { | ||
| int r = MathUtils.random(0,1); | ||
| if(r==0) | ||
| entityManager.addEntity(new Yellow_Bullet2(point1, new Vector2(MathUtils.random(-spread-var, spread), 10))); | ||
| if(r==1) | ||
| entityManager.addEntity(new Yellow_Bullet2(point2, new Vector2(MathUtils.random(-spread, spread+var), 10))); | ||
| SoundManager.shot3.play(0.1f); | ||
| lastFire = System.currentTimeMillis(); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| boolean canPlayerMove = true; | ||
| public void playerCanMove(boolean moving) { | ||
| canPlayerMove = moving; | ||
| } | ||
| } |
| @@ -0,0 +1,241 @@ | ||
| package com.vexoid.game.entity; | ||
|
|
||
| import com.badlogic.gdx.math.MathUtils; | ||
| import com.vexoid.game.MainGame; | ||
| import com.vexoid.game.SoundManager; | ||
| import com.vexoid.game.TextureManager; | ||
| import com.vexoid.game.screen.GameOverScreen; | ||
| import com.vexoid.game.screen.GameScreen; | ||
| import com.vexoid.game.screen.ScreenManager; | ||
|
|
||
| public class TimeManager{ | ||
|
|
||
| private final ScreenManager screenManager; | ||
| private int internalCounter = 0; | ||
| private int COUNTER = 0; | ||
| private int distance = 0; | ||
| private int counterScore = 0; | ||
| private int level = 0; | ||
| private String difficulty; | ||
| int step = 1,modifier = 0,basicEnemiesCount = 3,AdvancedEnemiesCount = -2,LaserEnemiesCount=-1, | ||
| secondIncrease = 30,ran = MathUtils.random(0,3); | ||
| // EntityManager entityManager; | ||
|
|
||
| public TimeManager(ScreenManager screenManager,String difficulty) { | ||
| this.screenManager = screenManager; | ||
| this.difficulty = difficulty; | ||
| if(difficulty=="hard"){ | ||
| modifier = 1; | ||
| } | ||
| if(difficulty=="medium"){ | ||
| modifier = 0; | ||
| } | ||
| if(difficulty=="easy"){ | ||
| modifier = 0; | ||
| } | ||
| } | ||
| private int[] oneTimeFires = {0,0,0}; // Have 2 | ||
| private int [] bossOneTimeFires = {0,0}; // Have 1 | ||
| public void update(){ | ||
| internalCounter ++; | ||
|
|
||
| final int internalCounterLimit = 70; // This is the internal counter in seconds | ||
| final int counterScoreLimit = 2; // This is the seconds to increase the distance | ||
|
|
||
| if (internalCounter >= internalCounterLimit) { | ||
| internalCounter = 0; | ||
| COUNTER ++; | ||
| counterScore ++; | ||
| //System.out.println("Count: " + COUNTER); | ||
| } | ||
| if (counterScore >= counterScoreLimit && level > 0) { | ||
| counterScore = 0; | ||
| distance ++; | ||
| } | ||
| if(GameScreen.isGameOver()){ | ||
| if(oneTimeFires[1] == 0){ | ||
| COUNTER = 0; | ||
| SoundManager.stopMusic(); | ||
| oneTimeFires[1] = 1; | ||
| } | ||
| level=-1; | ||
| } | ||
| // conditions for certain levels | ||
| if(level == -1){ | ||
| if(COUNTER >= 5){ | ||
| screenManager.setScreen(new GameOverScreen(), difficulty); | ||
| } | ||
| } | ||
| // Start levels | ||
| if(level == 0){ | ||
| if(oneTimeFires[0] == 0){ | ||
| EntityManager.movePlayer(-100, -100, false); | ||
| SoundManager.startSound.play(); | ||
| oneTimeFires[0] = 1; | ||
| } | ||
| if(COUNTER >= 10) { | ||
| EntityManager.movePlayer(((MainGame.WIDTH/2) - (TextureManager.PLAYER.getWidth()/2)), 100, true); | ||
| SoundManager.setMusic(SoundManager.gameMusic, 0.8f, true); | ||
| level = 1; | ||
| COUNTER = 0; | ||
| } | ||
| } | ||
| /* | ||
| * Level 1 | ||
| */ | ||
| if(level == 1){ | ||
| if(step == 1) | ||
| if(noEnemies()){ | ||
| for (int i = 0; i <2 + modifier; i++) { | ||
| addBasicEnemy(); | ||
| } | ||
| if(COUNTER >= 15){ | ||
| step = 2; | ||
| COUNTER = 15; | ||
| } | ||
| } | ||
| if(step ==2) | ||
| if(noEnemies()){ | ||
| for (int i = 0; i <3 + modifier; i++) { | ||
| addBasicEnemy(); | ||
| } | ||
| if(COUNTER >= 30){ | ||
| step = 3; | ||
| COUNTER=0; | ||
| } | ||
| } | ||
| if(step ==3){ | ||
| if(noEnemies()){ | ||
| addBasicLaserEnemy(); | ||
| addBasicEnemy(); | ||
| } | ||
| if(COUNTER >= 15){ | ||
| step = 4; | ||
| } | ||
| } | ||
| if(step ==4){ | ||
| if(noEnemies()){ | ||
| addBasicLaserEnemy(); | ||
| addAdvancedEnemy(); | ||
| } | ||
| if(COUNTER >= 30) | ||
| step = 5; | ||
| } | ||
| if(step ==5){ | ||
| if(noEnemies()){ | ||
| for (int i = 0; i < 2 + modifier; i++) { | ||
| addBasicEnemy(); | ||
| } | ||
| addAdvancedEnemy(); | ||
| if(COUNTER >= 70){ | ||
| step = 6; | ||
| COUNTER = 0; | ||
| } | ||
| } | ||
| } | ||
| if(step ==6){ | ||
| if(noEnemies()){ | ||
| for (int i = 0; i <3 + modifier; i++) { | ||
| addBasicEnemy(); | ||
| } | ||
| if(COUNTER >= 10){ | ||
| step = 7; | ||
| } | ||
| } | ||
| } | ||
| if(step ==7){ | ||
| if(noEnemies()){ | ||
| for (int i = 0; i <3 + modifier; i++) { | ||
| addBasicEnemy(); | ||
| } | ||
| addBasicLaserEnemy(); | ||
| if(COUNTER >= 20){ | ||
| step = 8; | ||
| } | ||
| } | ||
| } | ||
| if(step ==8){ | ||
| if(noEnemies()){ | ||
| for (int i = 0; i <4 + modifier; i++) { | ||
| addBasicEnemy(); | ||
| } | ||
| if(COUNTER >= 30){ | ||
| addBasicLaserEnemy(); | ||
| } | ||
| if(COUNTER >= 40){ | ||
| addBasicLaserEnemy(); | ||
| } | ||
| if(COUNTER >= 100){ | ||
| step = 9; | ||
| COUNTER = 0; | ||
| } | ||
| } | ||
| } | ||
| if(step == 9){ | ||
| if(noEnemies()){ | ||
| if(bossOneTimeFires[0] == 0){ | ||
| addBoss(1); | ||
| bossOneTimeFires[0] = 1; | ||
| } | ||
| if(COUNTER >= 10){ | ||
| COUNTER = 0; | ||
| step = 10; | ||
| } | ||
| } | ||
| } | ||
| if(step == 10){ | ||
| if(COUNTER >= 10){ | ||
| COUNTER = 0; | ||
| step = 10; | ||
| level = 9; | ||
| } | ||
| } | ||
| } | ||
| if(level == 9) | ||
| if(noEnemies()){ | ||
| ran = MathUtils.random(0,3); | ||
| if (COUNTER >= secondIncrease){ | ||
| basicEnemiesCount += 1; | ||
| secondIncrease += 45; | ||
| } | ||
| for (int i = 0; i <basicEnemiesCount; i++) { | ||
| addBasicEnemy(); | ||
| } | ||
| for (int i = 0; i <AdvancedEnemiesCount; i++) { | ||
| addAdvancedEnemy(); | ||
| } | ||
| if (ran >= 1) | ||
| addBasicLaserEnemy(); | ||
| if (ran >= 2) | ||
| AdvancedEnemiesCount += 1; | ||
| } | ||
| } | ||
| public void addBasicEnemy(){ | ||
| GameScreen.addEnemies(1); | ||
| } | ||
| public void addAdvancedEnemy(){ | ||
| GameScreen.addEnemies(2); | ||
| } | ||
| public void addBasicLaserEnemy(){ | ||
| GameScreen.addEnemies(3); | ||
| } | ||
| public void addBoss(int bossNumber){ | ||
| GameScreen.addBoss(bossNumber); | ||
| } | ||
|
|
||
| public boolean noEnemies(){ | ||
| if(GameScreen.getEnemies() <= 0) | ||
| return true; | ||
| else | ||
| return false; | ||
| } | ||
| public int getDistance(){ | ||
| return distance; | ||
| } | ||
| public int getCount(){ | ||
| return COUNTER; | ||
| } | ||
| public int getLevel(){ | ||
| return level; | ||
| } | ||
| } |
| @@ -0,0 +1,164 @@ | ||
| package com.vexoid.game.entity.bosses; | ||
|
|
||
| import com.badlogic.gdx.math.MathUtils; | ||
| import com.badlogic.gdx.math.Rectangle; | ||
| import com.badlogic.gdx.math.Vector2; | ||
| import com.vexoid.game.MainGame; | ||
| import com.vexoid.game.SoundManager; | ||
| import com.vexoid.game.TextureManager; | ||
| import com.vexoid.game.entity.Entity; | ||
| import com.vexoid.game.entity.EntityManager; | ||
| import com.vexoid.game.entity.bullets.bullet1; | ||
|
|
||
| public class Boss1 extends Entity{ | ||
|
|
||
| private final EntityManager entityManager; | ||
| private int count = 0, shooting = 0; | ||
| private float spread, speed; | ||
| private long lastFire; | ||
| int timeDelay=0, stageDelay = 600; | ||
|
|
||
| private int ran = 1, firePower = 24, shotDelay = 0; | ||
|
|
||
| String difficulty; | ||
|
|
||
| public Boss1(Vector2 pos, Vector2 direction, EntityManager entityManager,String difficulty) { | ||
| super(TextureManager.BOSS_1, pos, direction); | ||
| this.entityManager = entityManager; | ||
| this.difficulty = difficulty; | ||
| stageDelay = MathUtils.random(450,600); | ||
| if (this.difficulty == "hard") { | ||
| timeDelay = 250; | ||
| firePower = 24; | ||
| additionalHealth = 500; | ||
| } | ||
| if (this.difficulty == "medium") { | ||
| timeDelay = 500; | ||
| firePower = 14; | ||
| additionalHealth = 0; | ||
| } | ||
| if (this.difficulty == "easy") { | ||
| timeDelay = 800; | ||
| firePower = 8; | ||
| additionalHealth = 0; | ||
| } | ||
| healthPercent = 1500 + additionalHealth; | ||
| } | ||
|
|
||
| //health stuff | ||
| float additionalHealth = 0; | ||
| float healthPercent = 1500 +(additionalHealth); | ||
| boolean entityDied = false; | ||
| public void health(){ | ||
| if(healthPercent >= 1500.0 +(additionalHealth)) | ||
| healthPercent = 1500.0f + (additionalHealth); | ||
| } | ||
| public void increaseHealth(float ammount){ | ||
| healthPercent += ammount; | ||
| } | ||
| public void decreaseHealth(float ammount){ | ||
| healthPercent -= ammount; | ||
| if(healthPercent <= 0) | ||
| entityDied = true; | ||
| } | ||
| public float getHealth(){ | ||
| return healthPercent; | ||
| } | ||
| public boolean entityDied(){ | ||
| return entityDied; | ||
| } | ||
| public Rectangle getBounds() { | ||
| return new Rectangle(pos.x, (pos.y + ((texture.getHeight()/2)/1.25f)), | ||
| texture.getWidth(), (texture.getHeight()-(texture.getHeight()/1.25f))); | ||
| } | ||
|
|
||
| float xMovement; | ||
| float yMovement; | ||
| float xSpeed = 2; | ||
| float ySpeed = 2; | ||
| private int xTarget = MathUtils.random(0, MainGame.WIDTH - TextureManager.BOSS_1.getWidth()); | ||
| private int yTarget = MathUtils.random(MainGame.HEIGHT - TextureManager.BOSS_1.getHeight(), MainGame.HEIGHT - 200); | ||
| private int firemode = 0; | ||
| Vector2 midWay = new Vector2(((TextureManager.BOSS_1.getWidth()/2 )- 20), (TextureManager.BOSS_1.getHeight()/2)); | ||
| boolean sound = true; | ||
|
|
||
| public void update() { | ||
| health(); | ||
|
|
||
| // X movement | ||
| if (pos.x > xTarget+2 || pos.x < xTarget-2){ | ||
| if (pos.x > xTarget){ | ||
| xMovement = -xSpeed; | ||
| } else { | ||
| xMovement = xSpeed; | ||
| } | ||
| } else { | ||
| xSpeed = MathUtils.random(0.3f, 0.5f); | ||
| xTarget = MathUtils.random(0, MainGame.WIDTH - TextureManager.BOSS_1.getWidth()); | ||
| } | ||
|
|
||
| // Y movement | ||
| if (pos.y > yTarget+5 || pos.y < yTarget-5){ | ||
| if (pos.y > yTarget) { | ||
| yMovement = -ySpeed; | ||
| } else { | ||
| yMovement = ySpeed; | ||
| } | ||
| } else{ | ||
| yTarget = MathUtils.random(MainGame.HEIGHT - TextureManager.BOSS_1.getHeight(), MainGame.HEIGHT - 200); | ||
| ySpeed = 0.1f; | ||
| } | ||
| pos.add(direction.set(xMovement, yMovement)); | ||
|
|
||
| // Shooting and stuff | ||
|
|
||
| if (pos.y < MainGame.HEIGHT - (TextureManager.BOSS_1.getHeight()/2)){ | ||
| if (System.currentTimeMillis() - lastFire >= MathUtils.random(timeDelay, timeDelay+1500)) { | ||
| shooting ++; | ||
| if(shooting >= shotDelay+2 && ran <= 1) { | ||
| count ++; | ||
| spread = 4; | ||
| speed = MathUtils.random(2.2f, 2.8f); | ||
| entityManager.addEntity(new bullet1(pos.cpy().add(midWay), spread, speed)); | ||
| SoundManager.shot1.play(0.4f); | ||
| if (count >= firePower*2) { | ||
| count = 0; | ||
| lastFire = System.currentTimeMillis(); | ||
| ran = MathUtils.random(0,4); | ||
| } | ||
| shooting = 0; | ||
| } | ||
| if(shooting >= shotDelay && ran <= 3 && ran >= 2) { | ||
| count ++; | ||
| spread = 5; | ||
| speed = 7; | ||
| entityManager.addEntity(new bullet1(pos.cpy().add(midWay), spread, speed)); | ||
| SoundManager.shot1.play(0.4f); | ||
| if (count >= firePower) { | ||
| count = 0; | ||
| lastFire = System.currentTimeMillis(); | ||
| ran = MathUtils.random(0,4); | ||
| } | ||
| shooting = 0; | ||
| } | ||
| if(shooting >= shotDelay+8 && ran == 4) { | ||
| count ++; | ||
| spread = 7; | ||
| speed = 5; | ||
| entityManager.addEntity(new bullet1(pos.cpy().add(midWay), spread, speed)); | ||
| entityManager.addEntity(new bullet1(pos.cpy().add(midWay), spread, speed)); | ||
| entityManager.addEntity(new bullet1(pos.cpy().add(midWay), spread, speed)); | ||
| entityManager.addEntity(new bullet1(pos.cpy().add(midWay), spread, speed)); | ||
| entityManager.addEntity(new bullet1(pos.cpy().add(midWay), spread, speed)); | ||
| SoundManager.shot1.play(0.4f); | ||
| if (count >= firePower) { | ||
| count = 0; | ||
| lastFire = System.currentTimeMillis()+1000; | ||
| ran = MathUtils.random(0,4); | ||
| } | ||
| shooting = 0; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
| @@ -0,0 +1,21 @@ | ||
| package com.vexoid.game.entity.bullets; | ||
|
|
||
| import com.badlogic.gdx.math.Vector2; | ||
| import com.vexoid.game.MainGame; | ||
| import com.vexoid.game.TextureManager; | ||
| import com.vexoid.game.entity.Entity; | ||
|
|
||
| public class Blue_Bullet2 extends Entity { | ||
|
|
||
| public Blue_Bullet2(Vector2 pos, Vector2 direction) { | ||
| super(TextureManager.BLUE_BULLET2, pos, direction); | ||
| } | ||
|
|
||
| public void update() { | ||
| pos.add(direction); | ||
| } | ||
|
|
||
| public boolean checkEnd() { | ||
| return pos.y >= MainGame.HEIGHT; | ||
| } | ||
| } |
| @@ -0,0 +1,49 @@ | ||
| package com.vexoid.game.entity.bullets; | ||
|
|
||
| import com.badlogic.gdx.graphics.Texture; | ||
| import com.badlogic.gdx.math.MathUtils; | ||
| import com.badlogic.gdx.math.Rectangle; | ||
| import com.badlogic.gdx.math.Vector2; | ||
| import com.vexoid.game.TextureManager; | ||
| import com.vexoid.game.entity.Entity; | ||
|
|
||
| public class LaserBullet1 extends Entity{ | ||
|
|
||
| int internalClock = 0; | ||
| boolean timeUp = false; | ||
| static Texture texture; | ||
|
|
||
| public LaserBullet1(Vector2 pos) { | ||
| super(getTexture(), pos, new Vector2(0, 0)); | ||
| } | ||
| public static Texture getTexture(){ | ||
| int text = MathUtils.random(1,5); | ||
| if(text==1) | ||
| return TextureManager.LASER_BULLET; | ||
| else | ||
| if(text==2) | ||
| return TextureManager.LASER_BULLET1; | ||
| else | ||
| if(text==3) | ||
| return TextureManager.LASER_BULLET2; | ||
| else | ||
| if(text==4) | ||
| return TextureManager.LASER_BULLET3; | ||
| else | ||
| if(text==5) | ||
| return TextureManager.LASER_BULLET4; | ||
| else | ||
| return TextureManager.LASER_BULLET; | ||
| } | ||
| public void update() { | ||
| internalClock ++; | ||
| if (internalClock >=5) | ||
| timeUp = true; | ||
| } | ||
| public boolean destroyTime() { | ||
| return timeUp; | ||
| } | ||
| public Rectangle getBounds(){ | ||
| return new Rectangle(pos.x, pos.y, getTexture().getWidth()/1.25f, getTexture().getHeight()/1.25f); | ||
| } | ||
| } |
| @@ -0,0 +1,23 @@ | ||
| package com.vexoid.game.entity.bullets; | ||
|
|
||
| import com.badlogic.gdx.math.Vector2; | ||
| import com.vexoid.game.MainGame; | ||
| import com.vexoid.game.TextureManager; | ||
| import com.vexoid.game.entity.Entity; | ||
|
|
||
| public class Red_Bullet2 extends Entity { | ||
|
|
||
| public Red_Bullet2(Vector2 pos, Vector2 direction) { | ||
| super(TextureManager.RED_BULLET2, pos, direction); | ||
| } | ||
|
|
||
| public void update() { | ||
| pos.add(direction); | ||
|
|
||
| } | ||
|
|
||
| public boolean checkEnd() { | ||
| return pos.y >= MainGame.HEIGHT; | ||
| } | ||
|
|
||
| } |
| @@ -0,0 +1,27 @@ | ||
| package com.vexoid.game.entity.bullets; | ||
|
|
||
| import com.badlogic.gdx.math.MathUtils; | ||
| import com.badlogic.gdx.math.Vector2; | ||
| import com.vexoid.game.MainGame; | ||
| import com.vexoid.game.TextureManager; | ||
| import com.vexoid.game.entity.Entity; | ||
|
|
||
| public class Yellow_Bullet2 extends Entity{ | ||
|
|
||
| public Yellow_Bullet2(Vector2 pos, Vector2 direction) { | ||
| super(TextureManager.YELLOW_BULLET2, pos, direction); | ||
| } | ||
|
|
||
| private int count = 0; | ||
| public void update() { | ||
| count++; | ||
| if(count < 15) | ||
| pos.add(direction.x, direction.y - MathUtils.random(5,9)); | ||
| if(count > 15) | ||
| pos.add(-(direction.x), direction.y += 0.2); | ||
| } | ||
|
|
||
| public boolean checkEnd() { | ||
| return pos.y >= MainGame.HEIGHT; | ||
| } | ||
| } |
| @@ -0,0 +1,24 @@ | ||
| package com.vexoid.game.entity.bullets; | ||
|
|
||
| import com.badlogic.gdx.graphics.g2d.SpriteBatch; | ||
| import com.badlogic.gdx.math.MathUtils; | ||
| import com.badlogic.gdx.math.Vector2; | ||
| import com.vexoid.game.TextureManager; | ||
| import com.vexoid.game.entity.Entity; | ||
|
|
||
| public class bullet1 extends Entity { | ||
| public bullet1(Vector2 pos, float spread, float speed) { | ||
| super(TextureManager.BULLET1, pos, new Vector2(MathUtils.random(-spread,spread), -speed)); | ||
| } | ||
|
|
||
| public void update() { | ||
| pos.add(direction); | ||
| } | ||
| public void render(SpriteBatch sb){ | ||
| sb.draw(texture, pos.x, pos.y); | ||
|
|
||
| } | ||
| public boolean checkEnd() { | ||
| return pos.y <= 0 -this.texture.getHeight(); | ||
| } | ||
| } |
| @@ -0,0 +1,90 @@ | ||
| package com.vexoid.game.entity.effects; | ||
|
|
||
| import com.badlogic.gdx.graphics.Texture; | ||
| import com.badlogic.gdx.math.MathUtils; | ||
| import com.badlogic.gdx.math.Vector2; | ||
| import com.vexoid.game.TextureManager; | ||
| import com.vexoid.game.entity.Entity; | ||
|
|
||
| public class BlastEffect extends Entity{ | ||
| private int internalClock = 0; | ||
| private boolean timeUp = false; | ||
| private float speed; | ||
| static String Color; | ||
| public BlastEffect(Vector2 pos, Vector2 direction, float Speed, String color) { | ||
| super(getTexture(), pos, direction); | ||
| speed = Speed; | ||
| Color = color; | ||
| xMovement = MathUtils.random(-speed, speed); | ||
| yMovement = MathUtils.random(-speed, speed); | ||
| } | ||
|
|
||
| public static Texture getTexture(){ | ||
| int text = MathUtils.random(1,5); | ||
| if(Color == "red"){ | ||
| if(text==1) | ||
| return TextureManager.RED_EFFECT1; | ||
| else | ||
| if(text==2) | ||
| return TextureManager.RED_EFFECT2; | ||
| else | ||
| if(text==3) | ||
| return TextureManager.RED_EFFECT3; | ||
| else | ||
| if(text==4) | ||
| return TextureManager.RED_EFFECT4; | ||
| else | ||
| if(text==5) | ||
| return TextureManager.RED_EFFECT5; | ||
| else | ||
| return TextureManager.RED_EFFECT1; | ||
| } else | ||
| if(Color == "blue"){ | ||
| if(text==1) | ||
| return TextureManager.BLUE_EFFECT1; | ||
| else | ||
| if(text==2) | ||
| return TextureManager.BLUE_EFFECT2; | ||
| else | ||
| if(text==3) | ||
| return TextureManager.BLUE_EFFECT3; | ||
| else | ||
| if(text==4) | ||
| return TextureManager.BLUE_EFFECT4; | ||
| else | ||
| if(text==5) | ||
| return TextureManager.BLUE_EFFECT5; | ||
| else | ||
| return TextureManager.BLUE_EFFECT1; | ||
| } else | ||
| if(Color == "yellow"){ | ||
| if(text==1) | ||
| return TextureManager.YELLOW_EFFECT1; | ||
| else | ||
| if(text==2) | ||
| return TextureManager.YELLOW_EFFECT2; | ||
| else | ||
| if(text==3) | ||
| return TextureManager.YELLOW_EFFECT3; | ||
| else | ||
| if(text==4) | ||
| return TextureManager.YELLOW_EFFECT4; | ||
| else | ||
| if(text==5) | ||
| return TextureManager.YELLOW_EFFECT5; | ||
| else | ||
| return TextureManager.YELLOW_EFFECT1; | ||
| } else | ||
| return TextureManager.RED_EFFECT1; | ||
| } | ||
| private float xMovement = MathUtils.random(-speed, speed), yMovement = MathUtils.random(-speed, speed); | ||
| public void update() { | ||
| pos.add(direction.set(xMovement, yMovement)); | ||
| internalClock ++; | ||
| if (internalClock >=17) | ||
| timeUp = true; | ||
| } | ||
| public boolean destroyTime() { | ||
| return timeUp; | ||
| } | ||
| } |
| @@ -0,0 +1,70 @@ | ||
| package com.vexoid.game.entity.effects; | ||
|
|
||
| import com.badlogic.gdx.graphics.Texture; | ||
| import com.badlogic.gdx.math.MathUtils; | ||
| import com.badlogic.gdx.math.Vector2; | ||
| import com.vexoid.game.TextureManager; | ||
| import com.vexoid.game.entity.Entity; | ||
|
|
||
| public class Effect1 extends Entity{ | ||
| int internalClock = 0; | ||
| boolean timeUp = false; | ||
|
|
||
| public Effect1(Vector2 pos, Vector2 direction) { | ||
| super(getTexture(), pos, direction); | ||
| } | ||
|
|
||
| float xMovement; | ||
| float yMovement; | ||
| float xSpeed = 0.9f; | ||
| float ySpeed = 0.9f; | ||
|
|
||
| private int xTarget = (int) direction.x; | ||
| private int yTarget = (int) direction.y; | ||
|
|
||
| public static Texture getTexture(){ | ||
| int text = MathUtils.random(1,5); | ||
| if(text==1) | ||
| return TextureManager.RED_EFFECT1; | ||
| else | ||
| if(text==2) | ||
| return TextureManager.RED_EFFECT2; | ||
| else | ||
| if(text==3) | ||
| return TextureManager.RED_EFFECT3; | ||
| else | ||
| if(text==4) | ||
| return TextureManager.RED_EFFECT4; | ||
| else | ||
| if(text==5) | ||
| return TextureManager.RED_EFFECT5; | ||
| else | ||
| return TextureManager.RED_EFFECT1; | ||
| } | ||
|
|
||
| public void update() { | ||
| if (pos.x > xTarget-2 || pos.x < xTarget+2){ | ||
| if (pos.x > xTarget) { | ||
| xMovement = -xSpeed; | ||
| } else { | ||
| xMovement = xSpeed; | ||
| } | ||
| } | ||
| // Y movement | ||
| if (pos.y > yTarget-2 || pos.y < yTarget+2){ | ||
| if (pos.y > yTarget) { | ||
| yMovement = -ySpeed; | ||
| } else { | ||
| yMovement = ySpeed; | ||
| } | ||
| } | ||
| pos.add(direction.set(xMovement, yMovement)); | ||
|
|
||
| internalClock ++; | ||
| if (internalClock >=25) | ||
| timeUp = true; | ||
| } | ||
| public boolean destroyTime() { | ||
| return timeUp; | ||
| } | ||
| } |
| @@ -0,0 +1,71 @@ | ||
| package com.vexoid.game.entity.effects; | ||
|
|
||
| import com.badlogic.gdx.graphics.Texture; | ||
| import com.badlogic.gdx.math.MathUtils; | ||
| import com.badlogic.gdx.math.Vector2; | ||
| import com.vexoid.game.TextureManager; | ||
| import com.vexoid.game.entity.Entity; | ||
|
|
||
| public class Effect2 extends Entity{ | ||
| int internalClock = 0; | ||
| boolean timeUp = false; | ||
|
|
||
| public Effect2(Vector2 pos, Vector2 direction) { | ||
| super(getTexture(), pos, direction); | ||
| } | ||
|
|
||
| float xMovement; | ||
| float yMovement; | ||
| float xSpeed = 0.9f; | ||
| float ySpeed = 0.9f; | ||
|
|
||
| private int xTarget = (int) direction.x + (TextureManager.LASER_ENEMY.getWidth()/2)+2; | ||
| private int yTarget = (int) direction.y; | ||
|
|
||
| public static Texture getTexture(){ | ||
| int text = MathUtils.random(1,5); | ||
| if(text==1) | ||
| return TextureManager.BLUE_EFFECT1; | ||
| else | ||
| if(text==2) | ||
| return TextureManager.BLUE_EFFECT2; | ||
| else | ||
| if(text==3) | ||
| return TextureManager.BLUE_EFFECT3; | ||
| else | ||
| if(text==4) | ||
| return TextureManager.BLUE_EFFECT4; | ||
| else | ||
| if(text==5) | ||
| return TextureManager.BLUE_EFFECT5; | ||
| else | ||
| return TextureManager.BLUE_EFFECT1; | ||
| } | ||
|
|
||
| public void update() { | ||
|
|
||
| if (pos.x > xTarget || pos.x < xTarget){ | ||
| if (pos.x > xTarget) { | ||
| xMovement = -xSpeed; | ||
| } else { | ||
| xMovement = xSpeed; | ||
| } | ||
| } | ||
| // Y movement | ||
| if (pos.y > yTarget || pos.y < yTarget){ | ||
| if (pos.y > yTarget) { | ||
| yMovement = -ySpeed; | ||
| } else { | ||
| yMovement = ySpeed; | ||
| } | ||
| } | ||
| pos.add(direction.set(xMovement, yMovement)); | ||
|
|
||
| internalClock ++; | ||
| if (internalClock >=25) | ||
| timeUp = true; | ||
| } | ||
| public boolean destroyTime() { | ||
| return timeUp; | ||
| } | ||
| } |
| @@ -0,0 +1,37 @@ | ||
| package com.vexoid.game.entity.effects; | ||
|
|
||
| import com.badlogic.gdx.graphics.Texture; | ||
| import com.badlogic.gdx.math.MathUtils; | ||
| import com.badlogic.gdx.math.Vector2; | ||
| import com.vexoid.game.TextureManager; | ||
| import com.vexoid.game.entity.Entity; | ||
|
|
||
| public class Effect3_LaserWarning extends Entity{ | ||
|
|
||
| int internalClock = 0; | ||
| boolean timeUp = false; | ||
| public Effect3_LaserWarning(Vector2 pos, Vector2 direction) { | ||
| super(getTexture(), pos, direction); | ||
| } | ||
|
|
||
| private static Texture getTexture() { | ||
| int text = MathUtils.random(1,2); | ||
| if(text==1) | ||
| return TextureManager.LASER_WARNING1; | ||
| else | ||
| if(text==2) | ||
| return TextureManager.LASER_WARNING2; | ||
| else | ||
| return TextureManager.LASER_WARNING1; | ||
| } | ||
|
|
||
| public void update() { | ||
| internalClock ++; | ||
| if (internalClock >=5) | ||
| timeUp = true; | ||
| } | ||
| public boolean destroyTime() { | ||
| return timeUp; | ||
| } | ||
|
|
||
| } |
| @@ -0,0 +1,66 @@ | ||
| package com.vexoid.game.entity.stars; | ||
|
|
||
| import com.badlogic.gdx.Gdx; | ||
| import com.badlogic.gdx.graphics.Texture; | ||
| import com.badlogic.gdx.graphics.g2d.SpriteBatch; | ||
| import com.badlogic.gdx.math.MathUtils; | ||
| import com.badlogic.gdx.math.Vector2; | ||
| import com.vexoid.game.MainGame; | ||
| import com.vexoid.game.TextureManager; | ||
|
|
||
| public class Stars_Class{ | ||
| int internalClock = 0; | ||
| boolean timeUp = false; | ||
| protected Texture texture; | ||
| protected Vector2 pos; | ||
| protected Vector2 direction; | ||
|
|
||
| public Stars_Class(Vector2 pos, Vector2 direction, int text) { | ||
| this.texture = getTexture(text); | ||
| this.direction = direction; | ||
| this.pos = pos; | ||
| } | ||
|
|
||
| public static Texture getTexture(int text){ | ||
| int planet = MathUtils.random(1,4); | ||
| if(text<=18) | ||
| return TextureManager.STAR1; | ||
| else | ||
| if(text<=36 && text>18) | ||
| return TextureManager.STAR2; | ||
| else | ||
| if(text<=54 && text>36) | ||
| return TextureManager.STAR3; | ||
| else | ||
| if(text<=72 && text>54) | ||
| return TextureManager.STAR4; | ||
| else | ||
| if(text<=90 && text>72) | ||
| return TextureManager.STAR5; | ||
| else | ||
| if(text==100){ | ||
| if(planet>=3){ | ||
| return TextureManager.PLANET1; | ||
| }else{return TextureManager.PLANET1_1;} | ||
| }else | ||
| if(text==101){ | ||
| if(planet>=3){ | ||
| return TextureManager.PLANET2; | ||
| }else{return TextureManager.PLANET2_2;} | ||
| }else | ||
| return TextureManager.STARS; | ||
| } | ||
| public void update() { | ||
| pos.add(direction); | ||
| } | ||
| public void render(SpriteBatch sb) { | ||
| sb.draw(texture, pos.x, pos.y); | ||
| } | ||
| public void setDirection(float x, float y) { | ||
| direction.set(x, y); | ||
| direction.scl(Gdx.graphics.getDeltaTime()); | ||
| } | ||
| public boolean checkEnd() { | ||
| return (pos.y <= 0-texture.getHeight() || pos.x > MainGame.WIDTH); | ||
| } | ||
| } |
| @@ -0,0 +1,108 @@ | ||
| package com.vexoid.game.screen; | ||
|
|
||
| import com.badlogic.gdx.audio.Music; | ||
| import com.badlogic.gdx.graphics.g2d.BitmapFont; | ||
| import com.badlogic.gdx.graphics.g2d.SpriteBatch; | ||
| import com.badlogic.gdx.scenes.scene2d.InputEvent; | ||
| import com.badlogic.gdx.scenes.scene2d.ui.Skin; | ||
| import com.badlogic.gdx.scenes.scene2d.ui.TextButton; | ||
| import com.badlogic.gdx.scenes.scene2d.ui.TextButton.TextButtonStyle; | ||
| import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; | ||
| import com.vexoid.game.MainGame; | ||
| import com.vexoid.game.SoundManager; | ||
| import com.vexoid.game.camera.OrthoCamera; | ||
|
|
||
| public class GameOverScreen extends Screen{ | ||
| private OrthoCamera camera; | ||
| String gameDifficulty; | ||
| private ScreenManager screenManager; | ||
|
|
||
| BitmapFont displayTitleFont; | ||
| BitmapFont displayGameDifficultyFont; | ||
| BitmapFont displayScoreFont; | ||
| BitmapFont displayDistanceFont; | ||
|
|
||
| String title = "GameOver!"; | ||
| int score, distance; | ||
|
|
||
| TextButton StartButton, OptionsButton, ExitButton; | ||
| TextButtonStyle textButtonStyle; | ||
| Skin buttonSkin; | ||
|
|
||
| public void create(ScreenManager screenManager, String difficulty) { | ||
| this.screenManager = screenManager; | ||
| gameDifficulty = difficulty; | ||
| camera = new OrthoCamera(); | ||
| camera.resize(); | ||
|
|
||
| displayTitleFont = new BitmapFont(); | ||
| displayGameDifficultyFont = new BitmapFont(); | ||
| displayScoreFont = new BitmapFont(); | ||
| displayDistanceFont = new BitmapFont(); | ||
|
|
||
| distance = GameScreen.getDistance(); | ||
| score = GameScreen.getScore(); | ||
|
|
||
| textButtonStyle = new TextButtonStyle(); | ||
| textButtonStyle.font = displayGameDifficultyFont; | ||
|
|
||
| StartButton = new TextButton("Press Enter To Start Again", textButtonStyle); | ||
| StartButton.setPosition((MainGame.WIDTH / 2) - 50, (MainGame.HEIGHT / 2) + 25); | ||
| StartButton.setSize(100, 100); | ||
| StartButton.addListener(new ClickListener() { | ||
| @Override | ||
| public void touchUp(InputEvent e, float x, float y, int point, int button){ | ||
| startButtonClicked(); | ||
| } | ||
| }); | ||
| } | ||
| public void startButtonClicked(){ | ||
| screenManager.setScreen(new MenuScreen(), gameDifficulty); | ||
| } | ||
| public void update() { | ||
| camera.update(); | ||
| } | ||
|
|
||
| public void render(SpriteBatch sb) { | ||
| sb.setProjectionMatrix(camera.combined); | ||
| sb.begin(); | ||
| displayTitleFont.setColor(1.0f, 1.0f, 1.0f, 1.0f); | ||
| displayTitleFont.draw(sb, title, (MainGame.WIDTH / 2) - 50, ((MainGame.HEIGHT / 2)+ (MainGame.HEIGHT /4))); | ||
|
|
||
| displayScoreFont.setColor(1.0f, 1.0f, 1.0f, 1.0f); | ||
| displayScoreFont.draw(sb, "Score: " + score, (MainGame.WIDTH / 2) - 40, ((MainGame.HEIGHT / 2)+ (MainGame.HEIGHT /4))-20); | ||
|
|
||
| displayDistanceFont.setColor(1.0f, 1.0f, 1.0f, 1.0f); | ||
| displayDistanceFont.draw(sb, "Distance: " + distance, (MainGame.WIDTH / 2)-40, ((MainGame.HEIGHT / 2)+ (MainGame.HEIGHT /4))-40); | ||
|
|
||
|
|
||
| StartButton.draw(sb, 1.0f); | ||
| sb.end(); | ||
| } | ||
|
|
||
| public void resize(int width, int height) { | ||
| camera.resize(); | ||
| } | ||
|
|
||
| public void dispose() { | ||
|
|
||
| } | ||
|
|
||
| public void pause() { | ||
|
|
||
| } | ||
|
|
||
| public void resume() { | ||
|
|
||
| } | ||
|
|
||
| public void handleMusic(Music music, float vol, boolean loop) { | ||
| SoundManager.stopMusic(); | ||
| SoundManager.setMusic(music, vol, loop); | ||
| SoundManager.playMusic(); | ||
| } | ||
|
|
||
| public String whatScreen() { | ||
| return "GameOverScreen"; | ||
| } | ||
| } |
| @@ -0,0 +1,171 @@ | ||
| package com.vexoid.game.screen; | ||
|
|
||
| import com.badlogic.gdx.graphics.g2d.BitmapFont; | ||
| import com.badlogic.gdx.graphics.g2d.SpriteBatch; | ||
| import com.vexoid.game.MainGame; | ||
| import com.vexoid.game.SoundManager; | ||
| import com.vexoid.game.camera.OrthoCamera; | ||
| import com.vexoid.game.entity.EntityManager; | ||
| import com.vexoid.game.entity.TimeManager; | ||
|
|
||
| public class GameScreen extends Screen{ | ||
| private OrthoCamera camera; | ||
| private static EntityManager entityManager; | ||
| private static TimeManager timeManager; | ||
| public static int basicEnemiesCount = 4; | ||
| public String gameDifficulty; | ||
| int distance; | ||
| public static int count = 0; | ||
|
|
||
| String displayDistance; | ||
| String displayScore; | ||
| String displayPlayerHealth; | ||
| String displayPlayerShootingMode; | ||
| String displayPlayerLives; | ||
| String displayPlayerBulletMode; | ||
| String displayDifficulty; | ||
| String displayLevel; | ||
| String displayIntroText; | ||
| String infinity = ""; | ||
|
|
||
| BitmapFont displayDistanceFont; | ||
| BitmapFont displayScoreFont; | ||
| BitmapFont displayPlayerHealthFont; | ||
| BitmapFont displayPlayerLivesFont; | ||
| BitmapFont displayPlayerShootingModeFont; | ||
| BitmapFont displayPlayerBulletModeFont; | ||
| BitmapFont displayDifficultyFont; | ||
| BitmapFont displayLevelFont; | ||
| BitmapFont displayIntroTextFont; | ||
|
|
||
| public void create(ScreenManager screenManager, String difficulty) { | ||
| gameDifficulty = difficulty; | ||
| camera = new OrthoCamera(); | ||
| camera.resize(); | ||
|
|
||
| entityManager = new EntityManager(camera,screenManager ,gameDifficulty); | ||
| timeManager = new TimeManager(screenManager, gameDifficulty); | ||
|
|
||
| displayDistanceFont = new BitmapFont(); | ||
| displayScoreFont = new BitmapFont(); | ||
| displayPlayerHealthFont = new BitmapFont(); | ||
| displayPlayerShootingModeFont = new BitmapFont(); | ||
| displayPlayerLivesFont = new BitmapFont(); | ||
| displayPlayerBulletModeFont = new BitmapFont(); | ||
| displayDifficultyFont = new BitmapFont(); | ||
| displayLevelFont = new BitmapFont(); | ||
| displayIntroTextFont = new BitmapFont(); | ||
| } | ||
|
|
||
| public void update() { | ||
| camera.update(); | ||
| entityManager.update(); | ||
| timeManager.update(); | ||
| count = timeManager.getCount(); | ||
| if(timeManager.getLevel() == 0){ | ||
| if(timeManager.getCount() <= 5) | ||
| displayIntroText = "Light Years from home, you fly your ship..."; | ||
| if(timeManager.getCount() > 5) | ||
| displayIntroText = "Get ready to fight..."; | ||
| } | ||
| if(timeManager.getLevel() > 0){ | ||
| entityManager.listenForKeys(); | ||
| } | ||
| if(timeManager.getLevel() == 9) | ||
| infinity = "Infinity"; | ||
| else | ||
| infinity = "" + timeManager.getLevel(); | ||
|
|
||
| displayScore = "Score : " + EntityManager.enemyKillScore(); | ||
| displayPlayerHealth = "Health : " + (int) EntityManager.checkPlayerHealth() + "%"; | ||
| displayPlayerShootingMode = "Spread : " + EntityManager.getPlayerShootingMode(); | ||
| displayPlayerLives = "Lives : " + EntityManager.getPlayerLives(); | ||
| displayPlayerBulletMode = "Mode : " + EntityManager.getPlayerBulletMode(); | ||
| displayDifficulty = "Difficulty : " + gameDifficulty; | ||
| displayDistance = "Distance : " + timeManager.getDistance() + " Km"; | ||
| displayLevel = "Level : " + infinity; | ||
|
|
||
| if(entityManager.isGameOver()){ | ||
| SoundManager.setMusic(SoundManager.endMusic, 0.8f, true); | ||
| } | ||
| } | ||
|
|
||
| public void render(SpriteBatch sb) { | ||
| sb.setProjectionMatrix(camera.combined); | ||
| sb.begin(); | ||
| entityManager.render(sb); | ||
| if(timeManager.getLevel() == 0){ | ||
| displayIntroTextFont.setColor(1.0f, 1.0f, 1.0f, 1.0f); | ||
| displayIntroTextFont.draw(sb, displayIntroText, (MainGame.WIDTH/2)-100, (MainGame.HEIGHT/2)); | ||
| } | ||
| if(timeManager.getLevel() > 0){ | ||
| displayDistanceFont.setColor(1.0f, 1.0f, 1.0f, 1.0f); | ||
| displayDistanceFont.draw(sb, displayDistance, 25, (MainGame.HEIGHT)-20); | ||
|
|
||
| displayScoreFont.setColor(1.0f, 1.0f, 1.0f, 1.0f); | ||
| displayScoreFont.draw(sb, displayScore, (MainGame.WIDTH/2)-50, (MainGame.HEIGHT)-20); | ||
|
|
||
| displayPlayerHealthFont.setColor(1.0f, 1.0f, 1.0f, 1.0f); | ||
| displayPlayerHealthFont.draw(sb, displayPlayerHealth, 25, 35); | ||
|
|
||
| displayPlayerShootingModeFont.setColor(1.0f, 1.0f, 1.0f, 1.0f); | ||
| displayPlayerShootingModeFont.draw(sb, displayPlayerShootingMode, (MainGame.WIDTH)-125, 35); | ||
|
|
||
| displayPlayerBulletModeFont.setColor(1.0f, 1.0f, 1.0f, 1.0f); | ||
| displayPlayerBulletModeFont.draw(sb, displayPlayerBulletMode, (MainGame.WIDTH)-125, 50); | ||
|
|
||
| displayPlayerLivesFont.setColor(1.0f, 1.0f, 1.0f, 1.0f); | ||
| displayPlayerLivesFont.draw(sb, displayPlayerLives, 25, 50); | ||
|
|
||
| displayDifficultyFont.setColor(1.0f, 1.0f, 1.0f, 1.0f); | ||
| displayDifficultyFont.draw(sb, displayDifficulty, (MainGame.WIDTH)-125, (MainGame.HEIGHT)-20); | ||
|
|
||
| displayLevelFont.setColor(1.0f, 1.0f, 1.0f, 1.0f); | ||
| displayLevelFont.draw(sb, displayLevel, (MainGame.WIDTH)-225, (MainGame.HEIGHT)-20); | ||
| } | ||
| sb.end(); | ||
| } | ||
| public static boolean isGameOver(){ | ||
| return entityManager.isGameOver(); | ||
| } | ||
| public static int getEnemies(){ | ||
| return entityManager.getEntities(); | ||
| } | ||
| public static void addEnemies(int i){ | ||
| if(i == 1) | ||
| entityManager.addBasicEnemy(); | ||
| if(i == 2) | ||
| entityManager.addAdvancedEnemy(); | ||
| if(i == 3) | ||
| entityManager.addBasicLaserEnemy(); | ||
| } | ||
| public static void addBoss(int i){ | ||
| if(i == 1) | ||
| entityManager.addBoss1(); | ||
| } | ||
| public static int getDistance(){ | ||
| return timeManager.getDistance(); | ||
| } | ||
| public static int getScore(){ | ||
| return entityManager.getScore(); | ||
| } | ||
|
|
||
| public void resize(int width, int height) { | ||
| camera.resize(); | ||
| } | ||
|
|
||
| public void dispose() { | ||
|
|
||
| } | ||
|
|
||
| public void pause() { | ||
|
|
||
| } | ||
|
|
||
| public void resume() { | ||
|
|
||
| } | ||
| public String whatScreen() { | ||
| return "GameScreen"; | ||
| } | ||
| } |
| @@ -0,0 +1,145 @@ | ||
| package com.vexoid.game.screen; | ||
|
|
||
| import com.badlogic.gdx.Gdx; | ||
| import com.badlogic.gdx.Input.Keys; | ||
| import com.badlogic.gdx.graphics.Texture; | ||
| import com.badlogic.gdx.graphics.g2d.BitmapFont; | ||
| import com.badlogic.gdx.graphics.g2d.SpriteBatch; | ||
| import com.badlogic.gdx.math.MathUtils; | ||
| import com.badlogic.gdx.math.Vector2; | ||
| import com.badlogic.gdx.utils.Array; | ||
| import com.vexoid.game.MainGame; | ||
| import com.vexoid.game.SoundManager; | ||
| import com.vexoid.game.TextureManager; | ||
| import com.vexoid.game.camera.OrthoCamera; | ||
| import com.vexoid.game.entity.stars.Stars_Class; | ||
|
|
||
| public class MenuScreen extends Screen{ | ||
|
|
||
| private OrthoCamera camera; | ||
| String gameDifficulty, Start = "Press Enter"; | ||
| String changeGameDifficulty = "Use Left or Right arrow Key\n to change difficulty"; | ||
|
|
||
| BitmapFont displayGameDifficultyFont; | ||
| BitmapFont displayChangeGameDifficultyFont; | ||
| BitmapFont displayStartFont; | ||
|
|
||
| Texture title = TextureManager.TITLE_IMAGE; | ||
|
|
||
| public void create(ScreenManager screenManager, String difficulty) { | ||
| gameDifficulty = difficulty; | ||
| camera = new OrthoCamera(); | ||
| camera.resize(); | ||
|
|
||
| SoundManager.setMusic(SoundManager.menuMusic, 0.8f, true); | ||
|
|
||
| displayGameDifficultyFont = new BitmapFont(); | ||
| displayChangeGameDifficultyFont = new BitmapFont(); | ||
| displayStartFont = new BitmapFont(); | ||
| } | ||
|
|
||
| int secondIncrease = 30; | ||
| int starcount = 0; | ||
|
|
||
| static boolean clearedEntities = false; | ||
| private int limit=101,starLimit=limit,starToggle=0; | ||
| private final Array<Stars_Class> stars = new Array<Stars_Class>(); | ||
|
|
||
| int Switch = 0, Toggle = 1, Switch2 = 0, Toggle2 = 1; | ||
|
|
||
| private void addStars(Stars_Class entity) { | ||
| stars.add(entity); | ||
| } | ||
| public void update() { | ||
| camera.update(); | ||
| MainGame.setDifficulty(gameDifficulty); | ||
| starcount ++; | ||
| if(starcount == 4) { // Controls spawing ammount | ||
| if(starToggle>=1){ | ||
| starLimit=99; | ||
| starToggle --; | ||
| } else // This controls aditional planets and such | ||
| starLimit=limit; | ||
| int text = MathUtils.random(0,starLimit); | ||
| if(text>=100) | ||
| starToggle=100; // This sets the wait for a planet to spawn | ||
|
|
||
| // Sets the position of the stars and speed | ||
| float y = MathUtils.random(0, MainGame.HEIGHT - TextureManager.STAR1.getHeight()); | ||
| float x = -(MainGame.WIDTH / 2) - TextureManager.STAR1.getWidth(); | ||
| float speedx = MathUtils.random(2.5f,4.5f); | ||
| if(text>=100) | ||
| speedx -= 2; | ||
| addStars(new Stars_Class(new Vector2(x,y), new Vector2(speedx, 0), text)); | ||
| starcount = 0; | ||
| } | ||
| for (Stars_Class s : stars) | ||
| s.update(); | ||
|
|
||
| // Difficulty Switch | ||
| if ((Gdx.input.isKeyPressed(Keys.RIGHT)&& Switch2 != 1 && Toggle2 == 1) || | ||
| (Gdx.input.isKeyPressed(Keys.LEFT)&& Switch2 != 1 && Toggle2 == 1)){ | ||
| gameDifficulty = "hard"; | ||
| SoundManager.sound1.play(1); | ||
| if(Gdx.input.isKeyPressed(Keys.LEFT)) | ||
| Toggle2 = 3; | ||
| else | ||
| Toggle2 = 2; | ||
| } else | ||
| if ((Gdx.input.isKeyPressed(Keys.RIGHT)&& Switch2 != 1 && Toggle2 == 2) || | ||
| (Gdx.input.isKeyPressed(Keys.LEFT)&& Switch2 != 1 && Toggle2 == 2)){ | ||
| gameDifficulty = "easy"; | ||
| SoundManager.sound1.play(1); | ||
| if(Gdx.input.isKeyPressed(Keys.LEFT)) | ||
| Toggle2 = 1; | ||
| else | ||
| Toggle2 = 3; | ||
| } else | ||
| if ((Gdx.input.isKeyPressed(Keys.RIGHT)&& Switch2 != 1 && Toggle2 == 3) || | ||
| (Gdx.input.isKeyPressed(Keys.LEFT)&& Switch2 != 1 && Toggle2 == 3)){ | ||
| gameDifficulty = "medium"; | ||
| SoundManager.sound1.play(1); | ||
| if(Gdx.input.isKeyPressed(Keys.LEFT)) | ||
| Toggle2 = 2; | ||
| else | ||
| Toggle2 = 1; | ||
| } | ||
| if (Gdx.input.isKeyPressed(Keys.RIGHT) || Gdx.input.isKeyPressed(Keys.LEFT)) | ||
| Switch2 = 1; | ||
| else | ||
| Switch2 = 0; | ||
| } | ||
|
|
||
| public void render(SpriteBatch sb) { | ||
| sb.setProjectionMatrix(camera.combined); | ||
| sb.begin(); | ||
| for (Stars_Class s : stars) | ||
| s.render(sb); | ||
| sb.draw(title, 0, (MainGame.HEIGHT / 2)); | ||
|
|
||
| displayStartFont.setColor(1.0f, 1.0f, 1.0f, 1.0f); | ||
| displayStartFont.draw(sb, Start, (MainGame.WIDTH / 2) / 1.2f, ((MainGame.HEIGHT / 2))); | ||
|
|
||
| displayChangeGameDifficultyFont.setColor(1.0f, 1.0f, 1.0f, 1.0f); | ||
| displayChangeGameDifficultyFont.draw(sb, changeGameDifficulty, (MainGame.WIDTH / 2) / 1.35f, ((MainGame.HEIGHT / 2)/1.1f)); | ||
|
|
||
| displayGameDifficultyFont.setColor(1.0f, 1.0f, 1.0f, 1.0f); | ||
| displayGameDifficultyFont.draw(sb, gameDifficulty, (MainGame.WIDTH / 2) / 1.15f, ((MainGame.HEIGHT / 2)/1.3f)); | ||
| sb.end(); | ||
| } | ||
|
|
||
| public void resize(int width, int height) { | ||
| camera.resize(); | ||
| } | ||
|
|
||
| public void dispose() {} | ||
|
|
||
| public void pause() {} | ||
|
|
||
| public void resume() {} | ||
|
|
||
| public String whatScreen() { | ||
| return "MenuScreen"; | ||
| } | ||
|
|
||
| } |
| @@ -0,0 +1,23 @@ | ||
| package com.vexoid.game.screen; | ||
|
|
||
| import com.badlogic.gdx.graphics.g2d.SpriteBatch; | ||
|
|
||
| public abstract class Screen { | ||
|
|
||
| public abstract void create(ScreenManager screenManager,String difficulty); | ||
|
|
||
| public abstract void update(); | ||
|
|
||
| public abstract void render(SpriteBatch sb); | ||
|
|
||
| public abstract void resize(int width, int height); | ||
|
|
||
| public abstract void dispose(); | ||
|
|
||
| public abstract void pause(); | ||
|
|
||
| public abstract void resume(); | ||
|
|
||
| public abstract String whatScreen(); | ||
|
|
||
| } |
| @@ -0,0 +1,42 @@ | ||
| package com.vexoid.game.screen; | ||
|
|
||
| import com.badlogic.gdx.Gdx; | ||
| import com.badlogic.gdx.Input.Keys; | ||
| import com.vexoid.game.MainGame; | ||
| import com.vexoid.game.SoundManager; | ||
|
|
||
| public class ScreenManager { | ||
|
|
||
| private Screen currentScreen; | ||
| private String difficulty; | ||
| private static int wait = 0; | ||
|
|
||
| public void setScreen(Screen screen, String difficulty) { | ||
| this.difficulty = difficulty; | ||
| if (currentScreen !=null) currentScreen.dispose(); | ||
| currentScreen = screen; | ||
| currentScreen.create(this, difficulty); | ||
| } | ||
|
|
||
| public Screen getCurrentScreen() { | ||
| return currentScreen; | ||
| } | ||
| public void screenManagement(){ | ||
| difficulty = MainGame.getGameDifficulty(); | ||
| if(wait > 0){ | ||
| wait --; | ||
| } | ||
| if (Gdx.input.isKeyPressed(Keys.ENTER) && (getCurrentScreen().whatScreen() == "MenuScreen") && wait == 0){ | ||
| getCurrentScreen().dispose(); | ||
| SoundManager.stopMusic(); | ||
| setScreen(new GameScreen(), difficulty); | ||
| wait = 100; | ||
| } | ||
| if (Gdx.input.isKeyPressed(Keys.ENTER) && (getCurrentScreen().whatScreen() == "GameOverScreen") && wait == 0){ | ||
| getCurrentScreen().dispose(); | ||
| SoundManager.stopMusic(); | ||
| setScreen(new MenuScreen(), difficulty); | ||
| wait = 100; | ||
| } | ||
| } | ||
| } |
| @@ -0,0 +1,24 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <classpath> | ||
| <classpathentry kind="output" path="bin"/> | ||
| <classpathentry kind="src" path="src"/> | ||
| <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> | ||
| <classpathentry kind="src" path="/Vexoids-core"/> | ||
| <classpathentry sourcepath="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-backend-lwjgl/1.9.1/a6fd522c0d7260e74d8d47348c3f1488c1d51ffa/gdx-backend-lwjgl-1.9.1-sources.jar" kind="lib" path="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-backend-lwjgl/1.9.1/44e1e89d95df3f095bc0da62688f28f622f52c10/gdx-backend-lwjgl-1.9.1.jar"/> | ||
| <classpathentry kind="lib" path="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-platform/1.9.1/884d35692d1008feb2639dfceb6bb4cddaa28565/gdx-platform-1.9.1-natives-desktop.jar"/> | ||
| <classpathentry kind="lib" path="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-box2d-platform/1.9.1/f20f0f3fbc65d2d4da1147d7e0e6564e05d8b7d9/gdx-box2d-platform-1.9.1-natives-desktop.jar"/> | ||
| <classpathentry sourcepath="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx/1.9.1/967b353957d44206e217414fa0e229f71c6a9dc7/gdx-1.9.1-sources.jar" kind="lib" path="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx/1.9.1/41e844a4849872fdb9c33f3f2790e356f907f491/gdx-1.9.1.jar"/> | ||
| <classpathentry sourcepath="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-box2d/1.9.1/1896d16189007ec66f758a60e287d877f69b4ac6/gdx-box2d-1.9.1-sources.jar" kind="lib" path="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-box2d/1.9.1/efc80b7e8a239404fdcb9816c9d3bad168e148c2/gdx-box2d-1.9.1.jar"/> | ||
| <classpathentry sourcepath="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/org.lwjgl.lwjgl/lwjgl/2.9.2/4d114b5ef3ad3bf571b1f090cb00855991067e0b/lwjgl-2.9.2-sources.jar" kind="lib" path="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/org.lwjgl.lwjgl/lwjgl/2.9.2/a9d80fe5935c7a9149f6584d9777cfd471f65489/lwjgl-2.9.2.jar"/> | ||
| <classpathentry sourcepath="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/org.lwjgl.lwjgl/lwjgl_util/2.9.2/308d4ebe8d7b240d3490b6a7e0424807ea3ad98b/lwjgl_util-2.9.2-sources.jar" kind="lib" path="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/org.lwjgl.lwjgl/lwjgl_util/2.9.2/4b9e37300a87799856e0bd15ed81663cdb6b0947/lwjgl_util-2.9.2.jar"/> | ||
| <classpathentry sourcepath="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/com.badlogicgames.jlayer/jlayer/1.0.1-gdx/f1c4ffebc5e4f68be914404faab580c20de8ea1f/jlayer-1.0.1-gdx-sources.jar" kind="lib" path="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/com.badlogicgames.jlayer/jlayer/1.0.1-gdx/7cca83cec5c1b2f011362f4d85aabd71a73b049d/jlayer-1.0.1-gdx.jar"/> | ||
| <classpathentry sourcepath="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/org.jcraft/jorbis/0.0.17/5446be5d62e4c6b347c8e6cd28dc00a936417ba2/jorbis-0.0.17-sources.jar" kind="lib" path="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/org.jcraft/jorbis/0.0.17/8872d22b293e8f5d7d56ff92be966e6dc28ebdc6/jorbis-0.0.17.jar"/> | ||
| <classpathentry kind="lib" path="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/org.lwjgl.lwjgl/lwjgl-platform/2.9.2/510c7d317f5e9e700b9cfaac5fd38bdebf0702e0/lwjgl-platform-2.9.2-natives-windows.jar"/> | ||
| <classpathentry kind="lib" path="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/org.lwjgl.lwjgl/lwjgl-platform/2.9.2/d276cdf61fe2b516c7b7f4aa1b8dea91dbdc8d56/lwjgl-platform-2.9.2-natives-linux.jar"/> | ||
| <classpathentry kind="lib" path="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/org.lwjgl.lwjgl/lwjgl-platform/2.9.2/d55b46b40b40249d627a83a7f7f22649709d70c3/lwjgl-platform-2.9.2-natives-osx.jar"/> | ||
| <classpathentry sourcepath="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/net.java.jinput/jinput/2.0.5/82604cfeb87b9ab70ed70aa19a137de8ceb21504/jinput-2.0.5-sources.jar" kind="lib" path="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/net.java.jinput/jinput/2.0.5/39c7796b469a600f72380316f6b1f11db6c2c7c4/jinput-2.0.5.jar"/> | ||
| <classpathentry sourcepath="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/net.java.jutils/jutils/1.0.0/d18678a00b216863206a1bb6190507e02a32971b/jutils-1.0.0-sources.jar" kind="lib" path="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/net.java.jutils/jutils/1.0.0/e12fe1fda814bd348c1579329c86943d2cd3c6a6/jutils-1.0.0.jar"/> | ||
| <classpathentry kind="lib" path="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/net.java.jinput/jinput-platform/2.0.5/7ff832a6eb9ab6a767f1ade2b548092d0fa64795/jinput-platform-2.0.5-natives-linux.jar"/> | ||
| <classpathentry kind="lib" path="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/net.java.jinput/jinput-platform/2.0.5/385ee093e01f587f30ee1c8a2ee7d408fd732e16/jinput-platform-2.0.5-natives-windows.jar"/> | ||
| <classpathentry kind="lib" path="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/net.java.jinput/jinput-platform/2.0.5/53f9c919f34d2ca9de8c51fc4e1e8282029a9232/jinput-platform-2.0.5-natives-osx.jar"/> | ||
| </classpath> |
| @@ -0,0 +1,17 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <projectDescription> | ||
| <name>Vexoids-desktop</name> | ||
| <comment></comment> | ||
| <projects> | ||
| </projects> | ||
| <buildSpec> | ||
| <buildCommand> | ||
| <name>org.eclipse.jdt.core.javabuilder</name> | ||
| <arguments> | ||
| </arguments> | ||
| </buildCommand> | ||
| </buildSpec> | ||
| <natures> | ||
| <nature>org.eclipse.jdt.core.javanature</nature> | ||
| </natures> | ||
| </projectDescription> |
| @@ -0,0 +1,13 @@ | ||
| # | ||
| #Tue Feb 09 23:48:03 CST 2016 | ||
| org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
| org.eclipse.jdt.core.compiler.compliance=1.6 | ||
| org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
| org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
| org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 | ||
| org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
| org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
| eclipse.preferences.version=1 | ||
| org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
| org.eclipse.jdt.core.compiler.source=1.6 | ||
| org.eclipse.jdt.core.compiler.problem.assertIdentifier=error |
| @@ -0,0 +1,46 @@ | ||
| apply plugin: "java" | ||
|
|
||
| sourceCompatibility = 1.6 | ||
| sourceSets.main.java.srcDirs = [ "src/" ] | ||
|
|
||
| project.ext.mainClassName = "com.vexoid.game.desktop.DesktopLauncher" | ||
| project.ext.assetsDir = new File("../android/assets"); | ||
|
|
||
| task run(dependsOn: classes, type: JavaExec) { | ||
| main = project.mainClassName | ||
| classpath = sourceSets.main.runtimeClasspath | ||
| standardInput = System.in | ||
| workingDir = project.assetsDir | ||
| ignoreExitValue = true | ||
| } | ||
|
|
||
| task dist(type: Jar) { | ||
| from files(sourceSets.main.output.classesDir) | ||
| from files(sourceSets.main.output.resourcesDir) | ||
| from {configurations.compile.collect {zipTree(it)}} | ||
| from files(project.assetsDir); | ||
|
|
||
| manifest { | ||
| attributes 'Main-Class': project.mainClassName | ||
| } | ||
| } | ||
|
|
||
| dist.dependsOn classes | ||
|
|
||
| eclipse { | ||
| project { | ||
| name = appName + "-desktop" | ||
| linkedResource name: 'assets', type: '2', location: 'PARENT-1-PROJECT_LOC/android/assets' | ||
| } | ||
| } | ||
|
|
||
| task afterEclipseImport(description: "Post processing after project generation", group: "IDE") { | ||
| doLast { | ||
| def classpath = new XmlParser().parse(file(".classpath")) | ||
| new Node(classpath, "classpathentry", [ kind: 'src', path: 'assets' ]); | ||
| def writer = new FileWriter(file(".classpath")) | ||
| def printer = new XmlNodePrinter(new PrintWriter(writer)) | ||
| printer.setPreserveWhitespace(true) | ||
| printer.print(classpath) | ||
| } | ||
| } |
| @@ -0,0 +1,18 @@ | ||
| package com.vexoid.game.desktop; | ||
|
|
||
| import com.badlogic.gdx.backends.lwjgl.LwjglApplication; | ||
| import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; | ||
| import com.vexoid.game.MainGame; | ||
|
|
||
| public class DesktopLauncher { | ||
| public static void main (String[] arg) { | ||
| LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); | ||
| config.title = "Vexoids"; | ||
| config.useGL30 = true; | ||
| config.width = MainGame.WIDTH; | ||
| config.height = MainGame.HEIGHT; | ||
| config.resizable = false; | ||
|
|
||
| new LwjglApplication(new MainGame(), config); | ||
| } | ||
| } |
| @@ -0,0 +1,18 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <classpath> | ||
| <classpathentry kind="output" path="war/WEB-INF/classes"/> | ||
| <classpathentry kind="src" path="src"/> | ||
| <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> | ||
| <classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/> | ||
| <classpathentry kind="src" path="/Vexoids-core"/> | ||
| <classpathentry sourcepath="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-backend-gwt/1.9.1/531fa46e28508eef541f8b5563635a8551e064cb/gdx-backend-gwt-1.9.1-sources.jar" kind="lib" path="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-backend-gwt/1.9.1/24dac00528572240666157dc8036fbfc7b9e7663/gdx-backend-gwt-1.9.1.jar"/> | ||
| <classpathentry sourcepath="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-backend-gwt/1.9.1/531fa46e28508eef541f8b5563635a8551e064cb/gdx-backend-gwt-1.9.1-sources.jar" kind="lib" path="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-backend-gwt/1.9.1/531fa46e28508eef541f8b5563635a8551e064cb/gdx-backend-gwt-1.9.1-sources.jar"/> | ||
| <classpathentry sourcepath="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx/1.9.1/967b353957d44206e217414fa0e229f71c6a9dc7/gdx-1.9.1-sources.jar" kind="lib" path="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx/1.9.1/967b353957d44206e217414fa0e229f71c6a9dc7/gdx-1.9.1-sources.jar"/> | ||
| <classpathentry sourcepath="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx/1.9.1/967b353957d44206e217414fa0e229f71c6a9dc7/gdx-1.9.1-sources.jar" kind="lib" path="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx/1.9.1/41e844a4849872fdb9c33f3f2790e356f907f491/gdx-1.9.1.jar"/> | ||
| <classpathentry sourcepath="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-box2d/1.9.1/1896d16189007ec66f758a60e287d877f69b4ac6/gdx-box2d-1.9.1-sources.jar" kind="lib" path="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-box2d/1.9.1/1896d16189007ec66f758a60e287d877f69b4ac6/gdx-box2d-1.9.1-sources.jar"/> | ||
| <classpathentry sourcepath="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-box2d/1.9.1/1896d16189007ec66f758a60e287d877f69b4ac6/gdx-box2d-1.9.1-sources.jar" kind="lib" path="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-box2d/1.9.1/efc80b7e8a239404fdcb9816c9d3bad168e148c2/gdx-box2d-1.9.1.jar"/> | ||
| <classpathentry sourcepath="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-box2d-gwt/1.9.1/14a59443a6bb4f75ac3e5f0b57465737a41b79a8/gdx-box2d-gwt-1.9.1-sources.jar" kind="lib" path="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-box2d-gwt/1.9.1/14a59443a6bb4f75ac3e5f0b57465737a41b79a8/gdx-box2d-gwt-1.9.1-sources.jar"/> | ||
| <classpathentry sourcepath="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/com.google.gwt/gwt-servlet/2.6.0/7a59cc91e16f255d22b692dcc5839d3eb1d606c6/gwt-servlet-2.6.0-sources.jar" kind="lib" path="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/com.google.gwt/gwt-servlet/2.6.0/d1e40c23bf78192482ee76c93619a10b4ea649f7/gwt-servlet-2.6.0.jar"/> | ||
| <classpathentry sourcepath="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/com.google.gwt/gwt-user/2.6.1/c32cc6470243fe2703e807e1025ec3354fba0ef8/gwt-user-2.6.1-sources.jar" kind="lib" path="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/com.google.gwt/gwt-user/2.6.1/c078b1b8cc0281214b0eb458d2c283d039374fad/gwt-user-2.6.1.jar"/> | ||
| <classpathentry sourcepath="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/com.google.gwt/gwt-codeserver/2.6.0/9be1bd733a55fd4c2cc42b7d377dc9a4296e2d64/gwt-codeserver-2.6.0-sources.jar" kind="lib" path="C:/Users/zachary816/.gradle/caches/modules-2/files-2.1/com.google.gwt/gwt-codeserver/2.6.0/c88f4d9a43a8161317a77c721a75aa3a78952e37/gwt-codeserver-2.6.0.jar"/> | ||
| </classpath> |
| @@ -0,0 +1,25 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <projectDescription> | ||
| <name>Vexoids-html</name> | ||
| <comment/> | ||
| <projects/> | ||
| <natures> | ||
| <nature>org.eclipse.jdt.core.javanature</nature> | ||
| <nature>com.google.gwt.eclipse.core.gwtNature</nature> | ||
| </natures> | ||
| <buildSpec> | ||
| <buildCommand> | ||
| <name>org.eclipse.jdt.core.javabuilder</name> | ||
| <arguments/> | ||
| </buildCommand> | ||
| <buildCommand> | ||
| <name>com.google.gwt.eclipse.core.gwtProjectValidator</name> | ||
| <arguments/> | ||
| </buildCommand> | ||
| <buildCommand> | ||
| <name>com.google.gdt.eclipse.core.webAppProjectValidator</name> | ||
| <arguments/> | ||
| </buildCommand> | ||
| </buildSpec> | ||
| <linkedResources/> | ||
| </projectDescription> |
| @@ -0,0 +1,5 @@ | ||
| #Tue Feb 09 23:48:31 CST 2016 | ||
| warSrcDir=webapp/ | ||
| lastWarOutDir=E\:\\User\\Documents\\Workspaces\\test3\\html\\war | ||
| eclipse.preferences.version=1 | ||
| warSrcDirIsOutput=false |
| @@ -0,0 +1,13 @@ | ||
| # | ||
| #Tue Feb 09 23:48:31 CST 2016 | ||
| org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
| org.eclipse.jdt.core.compiler.compliance=1.6 | ||
| org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
| org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
| org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 | ||
| org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
| org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
| eclipse.preferences.version=1 | ||
| org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
| org.eclipse.jdt.core.compiler.source=1.6 | ||
| org.eclipse.jdt.core.compiler.problem.assertIdentifier=error |
| @@ -0,0 +1,70 @@ | ||
| apply plugin: "java" | ||
| apply plugin: "jetty" | ||
|
|
||
| gwt { | ||
| gwtVersion='2.6.0' // Should match the gwt version used for building the gwt backend | ||
| maxHeapSize="1G" // Default 256m is not enough for gwt compiler. GWT is HUNGRY | ||
| minHeapSize="1G" | ||
|
|
||
| src = files(file("src/")) // Needs to be in front of "modules" below. | ||
| modules 'com.vexoid.game.GdxDefinition' | ||
| devModules 'com.vexoid.game.GdxDefinitionSuperdev' | ||
| project.webAppDirName = 'webapp' | ||
|
|
||
| compiler { | ||
| strict = true; | ||
| enableClosureCompiler = true; | ||
| disableCastChecking = true; | ||
| } | ||
| } | ||
|
|
||
| task draftRun(type: JettyRunWar) { | ||
| dependsOn draftWar | ||
| dependsOn.remove('war') | ||
| webApp=draftWar.archivePath | ||
| daemon=true | ||
| } | ||
|
|
||
| task superDev(type: de.richsource.gradle.plugins.gwt.GwtSuperDev) { | ||
| dependsOn draftRun | ||
| doFirst { | ||
| gwt.modules = gwt.devModules | ||
| } | ||
| } | ||
|
|
||
| task dist(dependsOn: [clean, compileGwt]) { | ||
| doLast { | ||
| file("build/dist").mkdirs() | ||
| copy { | ||
| from "build/gwt/out" | ||
| into "build/dist" | ||
| } | ||
| copy { | ||
| from "webapp" | ||
| into "build/dist" | ||
| } | ||
| copy { | ||
| from "war" | ||
| into "build/dist" | ||
| } | ||
| } | ||
| } | ||
|
|
||
| draftWar { | ||
| from "war" | ||
| } | ||
|
|
||
| task addSource << { | ||
| sourceSets.main.compileClasspath += files(project(':core').sourceSets.main.allJava.srcDirs) | ||
| } | ||
|
|
||
| tasks.compileGwt.dependsOn(addSource) | ||
| tasks.draftCompileGwt.dependsOn(addSource) | ||
|
|
||
| sourceCompatibility = 1.6 | ||
| sourceSets.main.java.srcDirs = [ "src/" ] | ||
|
|
||
|
|
||
| eclipse.project { | ||
| name = appName + "-html" | ||
| } |
| @@ -0,0 +1,11 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit trunk//EN" "http://google-web-toolkit.googlecode.com/svn/trunk/distro-source/core/src/gwt-module.dtd"> | ||
| <module rename-to="html"> | ||
| <inherits name='com.badlogic.gdx.backends.gdx_backends_gwt' /> | ||
| <inherits name='com.badlogic.gdx.physics.box2d.box2d-gwt' /> | ||
|
|
||
| <inherits name='MainGame' /> | ||
| <entry-point class='com.vexoid.game.client.HtmlLauncher' /> | ||
|
|
||
| <set-configuration-property name="gdx.assetpath" value="../android/assets" /> | ||
| </module> |
| @@ -0,0 +1,14 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit trunk//EN" "http://google-web-toolkit.googlecode.com/svn/trunk/distro-source/core/src/gwt-module.dtd"> | ||
| <module rename-to="html"> | ||
| <inherits name='com.badlogic.gdx.backends.gdx_backends_gwt' /> | ||
| <inherits name='com.badlogic.gdx.physics.box2d.box2d-gwt' /> | ||
|
|
||
| <inherits name='com.vexoid.game.GdxDefinition' /> | ||
|
|
||
| <collapse-all-properties /> | ||
|
|
||
| <add-linker name="xsiframe"/> | ||
| <set-configuration-property name="devModeRedirectEnabled" value="true"/> | ||
| <set-configuration-property name='xsiframe.failIfScriptTag' value='FALSE'/> | ||
| </module> |
| @@ -0,0 +1,19 @@ | ||
| package com.vexoid.game.client; | ||
|
|
||
| import com.badlogic.gdx.ApplicationListener; | ||
| import com.badlogic.gdx.backends.gwt.GwtApplication; | ||
| import com.badlogic.gdx.backends.gwt.GwtApplicationConfiguration; | ||
| import com.vexoid.game.MainGame; | ||
|
|
||
| public class HtmlLauncher extends GwtApplication { | ||
|
|
||
| @Override | ||
| public GwtApplicationConfiguration getConfig () { | ||
| return new GwtApplicationConfiguration(480, 320); | ||
| } | ||
|
|
||
| @Override | ||
| public ApplicationListener createApplicationListener () { | ||
| return new MainGame(); | ||
| } | ||
| } |
| @@ -0,0 +1,11 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit trunk//EN" "http://google-web-toolkit.googlecode.com/svn/trunk/distro-source/core/src/gwt-module.dtd"> | ||
| <module rename-to="html"> | ||
| <inherits name='com.badlogic.gdx.backends.gdx_backends_gwt' /> | ||
| <inherits name='com.badlogic.gdx.physics.box2d.box2d-gwt' /> | ||
|
|
||
| <inherits name='MainGame' /> | ||
| <entry-point class='com.vexoid.game.client.HtmlLauncher' /> | ||
|
|
||
| <set-configuration-property name="gdx.assetpath" value="../android/assets" /> | ||
| </module> |
| @@ -0,0 +1,14 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit trunk//EN" "http://google-web-toolkit.googlecode.com/svn/trunk/distro-source/core/src/gwt-module.dtd"> | ||
| <module rename-to="html"> | ||
| <inherits name='com.badlogic.gdx.backends.gdx_backends_gwt' /> | ||
| <inherits name='com.badlogic.gdx.physics.box2d.box2d-gwt' /> | ||
|
|
||
| <inherits name='com.vexoid.game.GdxDefinition' /> | ||
|
|
||
| <collapse-all-properties /> | ||
|
|
||
| <add-linker name="xsiframe"/> | ||
| <set-configuration-property name="devModeRedirectEnabled" value="true"/> | ||
| <set-configuration-property name='xsiframe.failIfScriptTag' value='FALSE'/> | ||
| </module> |
| @@ -0,0 +1,3 @@ | ||
| <?xml version="1.0" ?> | ||
| <web-app> | ||
| </web-app> |
| @@ -0,0 +1,32 @@ | ||
| <!doctype html> | ||
| <html> | ||
| <head> | ||
| <title>Vexoids</title> | ||
| <meta http-equiv="content-type" content="text/html; charset=UTF-8"> | ||
| <link href="styles.css" rel="stylesheet" type="text/css"> | ||
| <script src="soundmanager2-setup.js"></script> | ||
| <script src="soundmanager2-jsmin.js"></script> | ||
| </head> | ||
|
|
||
| <body> | ||
| <a class="superdev" href="javascript:%7B%20window.__gwt_bookmarklet_params%20%3D%20%7B'server_url'%3A'http%3A%2F%2Flocalhost%3A9876%2F'%7D%3B%20var%20s%20%3D%20document.createElement('script')%3B%20s.src%20%3D%20'http%3A%2F%2Flocalhost%3A9876%2Fdev_mode_on.js'%3B%20void(document.getElementsByTagName('head')%5B0%5D.appendChild(s))%3B%7D">↻</a> | ||
| <div align="center" id="embed-html"></div> | ||
| <script type="text/javascript" src="html/html.nocache.js"></script> | ||
| </body> | ||
|
|
||
| <script> | ||
| function handleMouseDown(evt) { | ||
| evt.preventDefault(); | ||
| evt.stopPropagation(); | ||
| evt.target.style.cursor = 'default'; | ||
| } | ||
|
|
||
| function handleMouseUp(evt) { | ||
| evt.preventDefault(); | ||
| evt.stopPropagation(); | ||
| evt.target.style.cursor = ''; | ||
| } | ||
| document.getElementById('embed-html').addEventListener('mousedown', handleMouseDown, false); | ||
| document.getElementById('embed-html').addEventListener('mouseup', handleMouseUp, false); | ||
| </script> | ||
| </html> |