how do I sprite cranberry and why to people keep asking if I wanna?
This commit is contained in:
commit
dbb7868659
8 changed files with 161 additions and 30 deletions
|
@ -3,12 +3,13 @@ package com.monjaro.gamejam;
|
|||
import com.badlogic.gdx.ApplicationAdapter;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Input;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.utils.ScreenUtils;
|
||||
import com.monjaro.gamejam.segment.DualSegment;
|
||||
import com.monjaro.gamejam.segment.KinSegment;
|
||||
import com.monjaro.gamejam.segment.Segment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
@ -20,9 +21,9 @@ public class Game extends ApplicationAdapter {
|
|||
private final Set<Actor> actors = new HashSet<>();
|
||||
|
||||
private final List<Die> dice = new ArrayList<>();
|
||||
private final List<Segment> segments = new ArrayList<>();
|
||||
|
||||
private SpriteBatch batch;
|
||||
private BitmapFont font;
|
||||
private Texture img;
|
||||
|
||||
private final static int TICKS_PER_SECOND = 60;
|
||||
|
@ -31,7 +32,6 @@ public class Game extends ApplicationAdapter {
|
|||
@Override
|
||||
public void create() {
|
||||
batch = new SpriteBatch();
|
||||
font = new BitmapFont();
|
||||
img = new Texture("badlogic.jpg");
|
||||
|
||||
Face.setBlankFaceSprite(new Texture("blank_die_face.png"));
|
||||
|
@ -43,6 +43,12 @@ public class Game extends ApplicationAdapter {
|
|||
for (int i = 0; i < 5; i++) {
|
||||
dice.add(new Die(divide * (i + 1), 350, 64, 64));
|
||||
}
|
||||
|
||||
for (int i = 1; i <= 5; i++) {
|
||||
segments.add(new KinSegment(i));
|
||||
}
|
||||
segments.add(new DualSegment(false));
|
||||
segments.add(new DualSegment(true));
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
|
@ -54,10 +60,16 @@ public class Game extends ApplicationAdapter {
|
|||
public void processInput() {
|
||||
Input input = Gdx.input;
|
||||
|
||||
if (input.isKeyJustPressed(Input.Keys.R)) { //reroll dice
|
||||
dice.forEach(Die::roll);
|
||||
if (input.isKeyJustPressed(Input.Keys.R)) { //reroll dice that aren't locked
|
||||
dice.stream().filter(d -> !d.isLocked()).forEach(Die::roll);
|
||||
|
||||
System.out.println("=".repeat(100));
|
||||
for (Segment segment : segments) {
|
||||
System.out.println(segment.getName() + ": " + segment.isDestroyedBy(dice));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < dice.size(); i++) { //lock dice, iterating over for each keycode
|
||||
Die die = dice.get(i); //die iterator is looking at
|
||||
int keyCode = Input.Keys.NUM_1 + i; //keycode for the current die, 1, 2...9, 0 on keyboard
|
||||
|
@ -82,7 +94,6 @@ public class Game extends ApplicationAdapter {
|
|||
actors.forEach(a -> a.render(batch));
|
||||
|
||||
//TODO debug
|
||||
int x = 100;
|
||||
for (Die die : dice) {
|
||||
die.render(batch);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue