added coin entity

This commit is contained in:
Asecave 2021-06-30 17:14:43 +02:00
parent 3a65c74546
commit f386ef49f6
3 changed files with 28 additions and 1 deletions

View File

@ -37,6 +37,7 @@ public abstract class AnimatedEntity extends Entity {
@Override
public void zeichnen(Graphics2D g, BoundingRechteck r) {
super.zeichnen(g, r);
if (Main.SHOW_DEBUG) {
g.setColor(Color.CYAN);
g.drawRect((int) actionFigur.positionX(), (int) actionFigur.positionY(),
@ -45,7 +46,6 @@ public abstract class AnimatedEntity extends Entity {
g.drawRect((int) ((posX - width / 2) * World.SCALE), (int) ((posY - height / 2) * World.SCALE),
(int) (width * World.SCALE), (int) (height * World.SCALE));
}
super.zeichnen(g, r);
}
};
}

View File

@ -0,0 +1,27 @@
package main.entities;
import main.SheetLoader;
public class Coin extends AnimatedEntity {
private static SheetLoader loader = new SheetLoader("/res/images/coins.png");
public Coin() {
loader.generateFigures(8, 8, new int[] {8, 8, 1});
actionFigur.neuerZustand(loader.getFigur(0), "gold");
actionFigur.neuerZustand(loader.getFigur(1), "silver");
actionFigur.neuerZustand(loader.getFigur(2), "bronze");
zustandSetzen("gold");
posX = 4f;
posY = 4f;
width = 0.375f;
height = 0.25f;
spriteOffsetY = -0.1f;
}
@Override
protected void update() {
super.update();
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 B