Merge branch 'main' of github.com:Wil-Ro/gamejam2024

This commit is contained in:
James 2024-04-21 16:47:37 +01:00
commit 37ec466241
6 changed files with 65 additions and 1 deletions

BIN
assets/shope.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
assets/shope_die_border.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

@ -17,10 +17,16 @@ public class Face extends Actor{
private final List<Pip> pips = new ArrayList<>();
private static Texture blankFaceSprite;
private static Texture pipSprite;
int faceNumber;
public Face(int pipCount) {
addPipsForValue(pipCount);
Random rand = new Random();
faceNumber = rand.nextInt(0, 5);
}
public Face(int pipCount, Transform transform) {
addPipsForValue(pipCount);
@ -97,6 +103,10 @@ public class Face extends Actor{
pipSprite = sprite;
}
public Transform getTransform() {
return transform;
}
public Vector2 calculatePipLocation(Vector2 percentages) {
double radians = Math.toRadians(transform.rotation);

View file

@ -31,6 +31,7 @@ public class Game extends ApplicationAdapter {
private UI ui;
private SegmentUI segUi;
private ShopeUi shopeUi;
@Override
public void create() {
@ -42,12 +43,17 @@ public class Game extends ApplicationAdapter {
ui = new UI(this, 50, 280);
shopeUi = new ShopeUi();
ShopeUi.setGame(this);
Face.setBlankFaceSprite(new Texture("blank_die_faces_sheet.png"));
Face.setPipSprite(new Texture("pip.png"));
Die.setLockedSprite(new Texture("locked_die_border.png"));
UI.setRerollTexture(new Texture("reroll_symbol.png"));
SegmentUI.setCriteriaSheet(new Texture("criteria.png"));
ShopeUi.setBacking(new Texture("shope.png"));
ShopeUi.setFaceBacking(new Texture("shope_die_border.png"));
// SegmentUI.setCriteriaSheet(""); not made yet
// setting up font
@ -158,6 +164,8 @@ public class Game extends ApplicationAdapter {
segUi.render(batch);
shopeUi.render(batch);
batch.end();
}
@ -223,7 +231,7 @@ public class Game extends ApplicationAdapter {
int x = 64, y = 64;
while (shope.size() < 3) {
Face ware = new Face(1 + random.nextInt(6), new Transform(x += 96, y, 64, 64));//TODO RO FIX plz i beg!!!!
Face ware = new Face(1 + random.nextInt(6));//TODO RO FIX plz i beg!!!!
shope.add(ware);
}
}

View file

@ -0,0 +1,46 @@
package com.monjaro.gamejam.main;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import java.util.List;
public class ShopeUi extends Actor{
private static Texture backing;
private static Texture faceBacking;
public static void setFaceBacking(Texture faceBacking) {
ShopeUi.faceBacking = faceBacking;
}
private static Game game;
public static void setGame(Game game) {
ShopeUi.game = game;
}
public static void setBacking(Texture backing) {
ShopeUi.backing = backing;
}
@Override
public void tick() {
}
@Override
public void render(SpriteBatch batch) {
batch.draw(backing, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()/4);
List<Face> shope = game.getShope();
for (int i = 0; i < shope.size(); i++) {
Face face = shope.get(i);
face.setTransform(new Transform(((Gdx.graphics.getWidth()/4)*i)+(Gdx.graphics.getWidth()/4), Gdx.graphics.getHeight()/8, 64, 64));
face.render(batch);
batch.draw(faceBacking, face.getTransform().x-faceBacking.getWidth()/2, face.getTransform().y-faceBacking.getHeight()/2);
}
}
}