adds shapes to die and their faces
This commit is contained in:
parent
8e6527afa0
commit
291d2abf4a
4 changed files with 42 additions and 10 deletions
|
@ -1,7 +1,8 @@
|
||||||
package com.monjaro.gamejam;
|
package com.monjaro.gamejam;
|
||||||
|
|
||||||
public abstract class Actor {
|
import com.badlogic.gdx.math.Shape2D;
|
||||||
|
|
||||||
|
public abstract class Actor {
|
||||||
public abstract void tick();
|
public abstract void tick();
|
||||||
|
|
||||||
public abstract void render();
|
public abstract void render();
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
package com.monjaro.gamejam;
|
|
||||||
|
|
||||||
public class Dice {
|
|
||||||
static Texture faces;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,7 +1,10 @@
|
||||||
package com.monjaro.gamejam;
|
package com.monjaro.gamejam;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.math.Rectangle;
|
||||||
|
|
||||||
public class Die extends Actor {
|
public class Die extends Actor {
|
||||||
|
|
||||||
|
private Rectangle shape;
|
||||||
/*
|
/*
|
||||||
0
|
0
|
||||||
1 2 3 4
|
1 2 3 4
|
||||||
|
@ -14,6 +17,16 @@ public class Die extends Actor {
|
||||||
for (int i = 0; i < faces.length; i++) {
|
for (int i = 0; i < faces.length; i++) {
|
||||||
faces[i] = new Face(pips[i]);
|
faces[i] = new Face(pips[i]);
|
||||||
}
|
}
|
||||||
|
shape = new Rectangle();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPosition(float x, float y){
|
||||||
|
shape.setX(x);
|
||||||
|
shape.setY(y);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSize(float w, float h){
|
||||||
|
shape.setSize(w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -23,7 +36,9 @@ public class Die extends Actor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render() {
|
public void render() {
|
||||||
|
for (Face face : faces){
|
||||||
|
face.render();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
package com.monjaro.gamejam;
|
package com.monjaro.gamejam;
|
||||||
|
|
||||||
public class Face {
|
import com.badlogic.gdx.math.Rectangle;
|
||||||
|
|
||||||
|
public class Face extends Actor{
|
||||||
|
|
||||||
|
private Rectangle shape;
|
||||||
|
|
||||||
private int pips;
|
private int pips;
|
||||||
|
|
||||||
|
@ -35,4 +39,23 @@ public class Face {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setPosition(float x, float y){
|
||||||
|
shape.setX(x);
|
||||||
|
shape.setY(y);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSize(float w, float h){
|
||||||
|
shape.setSize(w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue