added coin entity
This commit is contained in:
@@ -37,6 +37,7 @@ public abstract class AnimatedEntity extends Entity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void zeichnen(Graphics2D g, BoundingRechteck r) {
|
public void zeichnen(Graphics2D g, BoundingRechteck r) {
|
||||||
|
super.zeichnen(g, r);
|
||||||
if (Main.SHOW_DEBUG) {
|
if (Main.SHOW_DEBUG) {
|
||||||
g.setColor(Color.CYAN);
|
g.setColor(Color.CYAN);
|
||||||
g.drawRect((int) actionFigur.positionX(), (int) actionFigur.positionY(),
|
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),
|
g.drawRect((int) ((posX - width / 2) * World.SCALE), (int) ((posY - height / 2) * World.SCALE),
|
||||||
(int) (width * World.SCALE), (int) (height * World.SCALE));
|
(int) (width * World.SCALE), (int) (height * World.SCALE));
|
||||||
}
|
}
|
||||||
super.zeichnen(g, r);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
27
Zoelda/src/main/entities/Coin.java
Normal file
27
Zoelda/src/main/entities/Coin.java
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
Zoelda/src/res/images/coins.png
Normal file
BIN
Zoelda/src/res/images/coins.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 414 B |
Reference in New Issue
Block a user