add die
This commit is contained in:
parent
1dfc2b50b1
commit
8e6527afa0
5 changed files with 100 additions and 6 deletions
9
core/src/com/monjaro/gamejam/Actor.java
Normal file
9
core/src/com/monjaro/gamejam/Actor.java
Normal file
|
@ -0,0 +1,9 @@
|
|||
package com.monjaro.gamejam;
|
||||
|
||||
public abstract class Actor {
|
||||
|
||||
public abstract void tick();
|
||||
|
||||
public abstract void render();
|
||||
|
||||
}
|
29
core/src/com/monjaro/gamejam/Die.java
Normal file
29
core/src/com/monjaro/gamejam/Die.java
Normal file
|
@ -0,0 +1,29 @@
|
|||
package com.monjaro.gamejam;
|
||||
|
||||
public class Die extends Actor {
|
||||
|
||||
/*
|
||||
0
|
||||
1 2 3 4
|
||||
5
|
||||
*/
|
||||
private Face[] faces = new Face[6];
|
||||
|
||||
public Die() {
|
||||
int[] pips = {4, 6, 5, 1, 2, 3};
|
||||
for (int i = 0; i < faces.length; i++) {
|
||||
faces[i] = new Face(pips[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render() {
|
||||
|
||||
}
|
||||
|
||||
}
|
38
core/src/com/monjaro/gamejam/Face.java
Normal file
38
core/src/com/monjaro/gamejam/Face.java
Normal file
|
@ -0,0 +1,38 @@
|
|||
package com.monjaro.gamejam;
|
||||
|
||||
public class Face {
|
||||
|
||||
private int pips;
|
||||
|
||||
public Face(int pips) {
|
||||
this.pips = pips;
|
||||
}
|
||||
|
||||
public int getPips() {
|
||||
return pips;
|
||||
}
|
||||
|
||||
public void setPips(int pips) {
|
||||
this.pips = pips;
|
||||
}
|
||||
|
||||
private static class Pip {
|
||||
|
||||
private final double x, y;
|
||||
|
||||
public Pip(double x, double y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public double getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public double getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,22 +1,37 @@
|
|||
package com.monjaro.gamejam;
|
||||
|
||||
import com.badlogic.gdx.ApplicationAdapter;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||
import com.badlogic.gdx.utils.ScreenUtils;
|
||||
|
||||
public class Game extends ApplicationAdapter {
|
||||
SpriteBatch batch;
|
||||
Texture img;
|
||||
|
||||
|
||||
private SpriteBatch batch;
|
||||
private Texture img;
|
||||
|
||||
private static int TICKS_PER_SECOND;
|
||||
private double tickProgress = 0;
|
||||
|
||||
@Override
|
||||
public void create () {
|
||||
public void create() {
|
||||
batch = new SpriteBatch();
|
||||
img = new Texture("badlogic.jpg");
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render () {
|
||||
public void render() {
|
||||
Gdx.graphics.getDeltaTime();
|
||||
while (tickProgress >= 1) { //tick as many times as needed
|
||||
tick();
|
||||
tickProgress--;
|
||||
}
|
||||
|
||||
ScreenUtils.clear(1, 0, 0, 1);
|
||||
batch.begin();
|
||||
batch.draw(img, 0, 0);
|
||||
|
@ -24,8 +39,9 @@ public class Game extends ApplicationAdapter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void dispose () {
|
||||
public void dispose() {
|
||||
batch.dispose();
|
||||
img.dispose();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue