added particles
This commit is contained in:
@@ -4,6 +4,8 @@ import de.miaurizius.jgame2d.core.GamePanel;
|
||||
import de.miaurizius.jgame2d.core.enums.EntityType;
|
||||
import de.miaurizius.jgame2d.entity.Entity;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class DryTreeTI extends InteractiveTile{
|
||||
|
||||
GamePanel panel;
|
||||
@@ -31,4 +33,16 @@ public class DryTreeTI extends InteractiveTile{
|
||||
public InteractiveTile getDestroyedForm() {
|
||||
return new TrunkIT(panel, worldX/panel.tileSize, worldY/panel.tileSize);
|
||||
}
|
||||
public Color getParticleColor() {
|
||||
return new Color(65, 50,30);
|
||||
}
|
||||
public int getParticleSize() {
|
||||
return 6; //in pixels
|
||||
}
|
||||
public int getParticleSpeed() {
|
||||
return 1;
|
||||
}
|
||||
public int getParticleMaxLife() {
|
||||
return 20;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
package de.miaurizius.jgame2d.tile.interactive;
|
||||
|
||||
import de.miaurizius.jgame2d.core.GamePanel;
|
||||
import de.miaurizius.jgame2d.core.enums.Direction;
|
||||
import de.miaurizius.jgame2d.core.enums.EntityType;
|
||||
import de.miaurizius.jgame2d.entity.Entity;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class InteractiveTile extends Entity {
|
||||
|
||||
GamePanel panel;
|
||||
@@ -14,6 +18,7 @@ public class InteractiveTile extends Entity {
|
||||
}
|
||||
|
||||
// GENERAL
|
||||
@Override
|
||||
public void update() {
|
||||
// INVINCIBLE COUNTER
|
||||
if(!invincible) return;
|
||||
@@ -23,6 +28,20 @@ public class InteractiveTile extends Entity {
|
||||
invincibleCount = 0;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void draw(Graphics2D graphics2D) {
|
||||
int screenX = worldX - panel.player.worldX + panel.player.screenX;
|
||||
int screenY = worldY - panel.player.worldY + panel.player.screenY;
|
||||
|
||||
if(worldX + panel.tileSize > panel.player.worldX - panel.player.screenX &&
|
||||
worldX - panel.tileSize < panel.player.worldX + panel.player.screenX &&
|
||||
worldY + panel.tileSize > panel.player.worldY - panel.player.screenY &&
|
||||
worldY - panel.tileSize < panel.player.worldY + panel.player.screenY
|
||||
) {
|
||||
graphics2D.drawImage(down1, screenX, screenY, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// PRE-CONFIGURED
|
||||
public void playSE() {}
|
||||
|
||||
Reference in New Issue
Block a user