diff --git a/core/src/com/monjaro/gamejam/Actor.java b/core/src/com/monjaro/gamejam/Actor.java index 5172d3b..f27cb5e 100644 --- a/core/src/com/monjaro/gamejam/Actor.java +++ b/core/src/com/monjaro/gamejam/Actor.java @@ -1,9 +1,9 @@ package com.monjaro.gamejam; + import com.badlogic.gdx.graphics.g2d.SpriteBatch; public abstract class Actor { - public abstract void tick(); public abstract void render(SpriteBatch batch); diff --git a/core/src/com/monjaro/gamejam/Die.java b/core/src/com/monjaro/gamejam/Die.java index 76ae04d..68d46b8 100644 --- a/core/src/com/monjaro/gamejam/Die.java +++ b/core/src/com/monjaro/gamejam/Die.java @@ -1,9 +1,11 @@ package com.monjaro.gamejam; +import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.graphics.g2d.SpriteBatch; public class Die extends Actor { + private Rectangle shape; /* 0 1 2 3 4 @@ -16,6 +18,16 @@ public class Die extends Actor { for (int i = 0; i < faces.length; 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 @@ -25,7 +37,9 @@ public class Die extends Actor { @Override public void render(SpriteBatch batch) { - + for (Face face : faces) { + face.render(batch); + } } public void roll() { diff --git a/core/src/com/monjaro/gamejam/Face.java b/core/src/com/monjaro/gamejam/Face.java index e7b7a78..c80aa45 100644 --- a/core/src/com/monjaro/gamejam/Face.java +++ b/core/src/com/monjaro/gamejam/Face.java @@ -1,10 +1,13 @@ package com.monjaro.gamejam; - +import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.math.Rectangle; import java.util.ArrayList; import java.util.Collections; import java.util.List; -public class Face { +public class Face extends Actor{ + + private Rectangle shape; private final List pips = new ArrayList<>(); @@ -43,4 +46,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(SpriteBatch batch) { + + } + }