began working on inverted gameplay

This commit is contained in:
Harrison Deng 2017-06-07 23:19:41 -05:00
parent 571c93b77f
commit d0cf02e19a
42 changed files with 125 additions and 34 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 B

After

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 336 B

After

Width:  |  Height:  |  Size: 396 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 B

After

Width:  |  Height:  |  Size: 175 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 361 B

After

Width:  |  Height:  |  Size: 432 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 171 B

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 347 B

After

Width:  |  Height:  |  Size: 419 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 242 B

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 450 B

After

Width:  |  Height:  |  Size: 522 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 297 B

After

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 592 B

After

Width:  |  Height:  |  Size: 683 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 338 B

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 733 B

After

Width:  |  Height:  |  Size: 846 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 KiB

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 133 KiB

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 603 B

After

Width:  |  Height:  |  Size: 523 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 B

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 B

After

Width:  |  Height:  |  Size: 263 B

View File

@ -118,9 +118,9 @@ active: false
active: false
- Tint -
colorsCount: 3
colors0: 0.14901961
colors1: 0.14901961
colors2: 0.14901961
colors0: 0.15294118
colors1: 0.85882354
colors2: 1.0
timelineCount: 1
timeline0: 0.0
- Transparency -
@ -147,7 +147,7 @@ timeline5: 1.0
attached: false
continuous: true
aligned: false
additive: false
additive: true
behind: false
premultipliedAlpha: false
- Image Path -

View File

@ -0,0 +1,79 @@
#extension GL_OES_standard_derivatives : enable
uniform float time;
uniform vec2 mouse;
uniform vec2 resolution;
#define M_PI 3.1415926535897932384626433832795
//#define time (time * time * 0.05)
vec2 rand2(vec2 p)
{
p = vec2(dot(p, vec2(102.9898,78.233)), dot(p, vec2(26.65125, 83.054543)));
return fract(sin(p) * 43758.5453);
}
float rand(vec2 p)
{
return fract(sin(dot(p.xy ,vec2(505.90898,18.233))) * 43037.5453);
}
// Thanks to David Hoskins https://www.shadertoy.com/view/4djGRh
float stars(in vec2 x, float numCells, float size, float br)
{
vec2 n = x * numCells;
vec2 f = floor(n);
float d = 1.0e10;
for (int i = -1; i <= 1; ++i)
{
for (int j = -1; j <= 1; ++j)
{
vec2 g = f + vec2(float(i), float(j));
g = n - g - rand2(mod(g, numCells)) + rand(g);
// Control size
g *= 1. / (numCells * size);
d = min(d, dot(g, g));
}
}
return br * (smoothstep(.95, 1., (1. - sqrt(d))));
}
void main()
{
float res = max(resolution.y, resolution.y);
vec2 coord = gl_FragCoord.xy / resolution;
vec2 tmp = coord;
coord.x = tmp.y;
coord.y = tmp.x;
vec3 result = vec3(0.);
result += stars(vec2(coord.x + time * 2.00,coord.y) , 1., 0.10, 2.) * vec3(.74, .74, .74);
result += stars(vec2(coord.x + time * 1.10,coord.y) , 1., 0.10, 2.) * vec3(.74, .74, .74);
result += stars(vec2(coord.x + time * 0.8,coord.y) , 1., 0.10, 2.) * vec3(.74, .74, .74);
result += stars(vec2(coord.x + time * 0.5,coord.y) , 2., 0.09, 2.) * vec3(.74, .74, .74);
result += stars(vec2(coord.x + time * 0.2,coord.y) , 4., 0.08, 2.) * vec3(.74, .74, .74);
result += stars(vec2(coord.x + time * 0.05,coord.y), 8., 0.05, 1.) * vec3(.74, .74, .74);
result += stars(vec2(coord.x + time * 0.025,coord.y), 10., 0.05,0.8) * vec3(.95, .95, .95);
result += stars(coord , 20., 0.025, 0.5) * vec3(.9, .9, .95);
gl_FragColor = vec4(result,1.);
// bar layer open scene ;
// vec2 bl = gl_FragCoord.xy / resolution.xy;
// if(bl.y>.50-min(time/20.,0.4) ^^ bl.y<0.50+min(time/20.0,.4)) gl_FragColor = vec4(0.0,sqrt(coord.y+0.1),0.3,1.0);
}

View File

@ -15,7 +15,7 @@ import zero1hd.polyjet.entity.enemies.VoidCircle;
public class EntityController {
AssetManager assets;
ShapeRenderer shapes;
public ShapeRenderer shapes;
public Array<Entity> activeAllies;
public Array<Entity> activeEnemies;

View File

@ -76,9 +76,7 @@ public class PolyJetEntity extends Actor implements Entity {
@Override
public void draw(Batch batch, float parentAlpha) {
thrust.draw(batch);
batch.setColor(Color.BLACK);
batch.draw(polyjet, getX(), getY(), getWidth(), getHeight());
batch.setColor(Color.WHITE);
super.draw(batch, parentAlpha);
}

View File

@ -15,7 +15,7 @@ public class CreativeDebugScreen extends ScreenAdapter {
InputMultiplexer inputs;
public CreativeDebugScreen(Polyjet core, MainMenu mainMenu) {
gamePlayArea = new GamePlayArea(core.getAssetManager());
gamePlayArea = new GamePlayArea(core.getAssetManager(), core.getPrefs());
creative = new CreativeStage(core, mainMenu, gamePlayArea);
inputs = new InputMultiplexer(creative, gamePlayArea);

View File

@ -36,7 +36,7 @@ public class GameScreen extends ScreenAdapter implements InputProcessor {
FPSWindow FPSDisplay;
private AudioData music;
public GameScreen(Polyjet polyJet) {
core = polyJet;
@ -97,7 +97,7 @@ public class GameScreen extends ScreenAdapter implements InputProcessor {
(Gdx.graphics.getHeight() - pauseMenu.getHeight()) / 2);
// Continue to add things to input multiplexer
gameArea = new GamePlayArea(polyJet.getAssetManager());
gameArea = new GamePlayArea(polyJet.getAssetManager(), core.getPrefs());
inputs = new InputMultiplexer();
inputs.addProcessor(this);

View File

@ -5,7 +5,6 @@ import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.ScreenAdapter;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.glutils.ShaderProgram;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener;
@ -33,21 +32,10 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
private Polyjet core;
private ShaderProgram invert;
public MainMenu(final Polyjet core) {
this.core = core;
stage = new Stage(new ScreenViewport());
targetPosition = new Vector3(stage.getCamera().position);
invert = new ShaderProgram(Gdx.files.internal("shaders/invert_vert.glsl").readString(), Gdx.files.internal("shaders/invert_frag.glsl").readString());
ShaderProgram.pedantic = false;
if (!invert.isCompiled()) {
System.err.println(invert.getLog());
System.exit(0);
}
if (invert.getLog().length()!=0)
System.out.println(invert.getLog());
stage.getBatch().setShader(invert);
}
public Screen postTransition() {

View File

@ -77,11 +77,13 @@ public class MainPage extends Page {
cyberCircle = new Image(core.getAssetManager().get("Tech-Circle1.png", Texture.class));
cyberCircle.setOrigin(cyberCircle.getWidth() / 2, cyberCircle.getHeight() / 2);
cyberCircle.setColor(0.7f, 0.7f, 0.7f, 0.8f);
cyberCircle.addAction(Actions.forever(Actions.rotateBy(-360f, 10f)));
playButton.addActor(cyberCircle);
playButton.setSize(cyberCircle.getWidth(), cyberCircle.getHeight());
begin = new Label("Play", core.getDefaultSkin(), "special-font", core.getDefaultSkin().getColor("default"));
begin.setColor(1f, 1f, 1f, 1f);
playButton.addActor(begin);
begin.setPosition(((playButton.getWidth() - begin.getWidth()) / 2)-10,
(playButton.getHeight() - begin.getHeight()) / 2);

View File

@ -47,7 +47,7 @@ public class CreativeStage extends Stage implements MiniListener {
beatViewer = new BeatViewer("Beat", core.getDefaultSkin());
graphViewer = new GraphWindow("Peak Values", core.getDefaultSkin());
volumeWindow = new VolumeWindow("Volume adjustments", core.getDefaultSkin(), core.getPrefs());
spawnerWindow = new SpawnerWindow("Spawn Tool", core.getDefaultSkin(), gpa.entityController, gpa);
spawnerWindow = new SpawnerWindow("Spawn Tool", core.getDefaultSkin(), gpa.ec, gpa);
//Back button
TextButton backButton = new TextButton("Back", core.getDefaultSkin());

View File

@ -1,7 +1,9 @@
package zero1hd.polyjet.ui.stages;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Preferences;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.glutils.ShaderProgram;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.utils.viewport.FitViewport;
@ -20,31 +22,47 @@ public class GamePlayArea extends Stage {
public ShapeRenderer shapes;
public EntityController entityController;
public EntityController ec;
private CollisionDetector collisionDetector;
private float maxHealth = 100;
private float yTeleport = Polyjet.GAME_AREA_HEIGHT/2;
private int score;
Texture basicLaserTexture;
public GamePlayArea(AssetManager assetManager) {
private ShaderProgram invert;
public GamePlayArea(AssetManager assetManager, Preferences prefs) {
super(new FitViewport(Polyjet.GAME_AREA_WIDTH, Polyjet.GAME_AREA_HEIGHT));
polyjet = new PolyJetEntity(assetManager, 25f, 25f, "standard");
shapes = new ShapeRenderer();
shapes.setProjectionMatrix(getCamera().combined);
entityController = new EntityController(assetManager, shapes);
collisionDetector = new CollisionDetector(entityController.activeAllies, entityController.activeEnemies);
entityController.activeAllies.add(polyjet);
addActor(polyjet);
if (prefs.getBoolean("invert_shader")) {
invert = new ShaderProgram(Gdx.files.internal("shaders/invert_vert.glsl").readString(), Gdx.files.internal("shaders/invert_frag.glsl").readString());
ShaderProgram.pedantic = false;
if (!invert.isCompiled()) {
System.err.println(invert.getLog());
System.exit(0);
}
if (invert.getLog().length()!=0)
System.out.println(invert.getLog());
getBatch().setShader(invert);
}
shapes = new ShapeRenderer(64, getBatch().getShader());
shapes.setProjectionMatrix(getCamera().combined);
ec = new EntityController(assetManager, shapes);
collisionDetector = new CollisionDetector(ec.activeAllies, ec.activeEnemies);
ec.activeAllies.add(polyjet);
}
@Override
public void act(float delta) {
collisionDetector.collisionCheck();
entityController.deathClean();
ec.deathClean();
if (polyjet.getX() <= 1) {
polyjet.moveLeft = false;
@ -119,7 +137,7 @@ public class GamePlayArea extends Stage {
}
if (keycode == KeyMap.shoot) {
Laser laser = (Laser) entityController.retrieveEntity(Entities.LASER);
Laser laser = (Laser) ec.retrieveEntity(Entities.LASER);
laser.init(polyjet.getX() + (polyjet.getWidth()-laser.getWidth())/2f, polyjet.getY() + polyjet.getHeight()+0.25f, 60f);
addActor(laser);
}
@ -140,4 +158,10 @@ public class GamePlayArea extends Stage {
public float getyTeleport() {
return yTeleport;
}
@Override
public void dispose() {
ec.shapes.dispose();
super.dispose();
}
}