This commit is contained in:
Simisays
2023-02-14 09:26:31 +01:00
parent ecd72c6444
commit 68079ac908
2 changed files with 16 additions and 8 deletions

View File

@@ -8,7 +8,6 @@ import com.badlogic.gdx.utils.Array;
import forge.adventure.stage.SpriteGroup; import forge.adventure.stage.SpriteGroup;
import forge.adventure.util.Config; import forge.adventure.util.Config;
import java.util.HashMap; import java.util.HashMap;
/** /**
* CharacterSprite base class for animated sprites on the map * CharacterSprite base class for animated sprites on the map
*/ */
@@ -34,8 +33,12 @@ public class CharacterSprite extends MapActor {
} }
@Override @Override
void updateBoundingRect() { //We want a slimmer box for the player entity so it can navigate terrain without getting stuck. void updateBoundingRect() {
boundingRect.set(getX() + 4, getY(), getWidth() - 6, getHeight() * collisionHeight); float scale = 1f;
if (this instanceof EnemySprite) {
scale = ((EnemySprite) this).getData().scale;
}//We want a slimmer box for the player entity so it can navigate terrain without getting stuck.
boundingRect.set(getX() + 4, getY(), getWidth()*scale - 6, getHeight() * collisionHeight * scale);
} }
protected void load(String path) { protected void load(String path) {
@@ -226,9 +229,11 @@ public class CharacterSprite extends MapActor {
setWidth(currentFrame.getRegionWidth()); setWidth(currentFrame.getRegionWidth());
Color oldColor=batch.getColor().cpy(); Color oldColor=batch.getColor().cpy();
batch.setColor(getColor()); batch.setColor(getColor());
batch.draw(currentFrame, getX(), getY()); float scale = 1f;
float scale = this instanceof EnemySprite ? 2f : 1f ; if (this instanceof EnemySprite) {
batch.draw(currentFrame, getX(), getY(), getWidth()*scale, getHeight()*scale); scale = ((EnemySprite) this).getData().scale;
}
batch.draw(currentFrame, getX(), getY(), getWidth()*scale, getHeight()*scale);
batch.setColor(oldColor); batch.setColor(oldColor);
super.draw(batch,parentAlpha); super.draw(batch,parentAlpha);
//batch.draw(getDebugTexture(),getX(),getY()); //batch.draw(getDebugTexture(),getX(),getY());

View File

@@ -35,7 +35,7 @@ public class EnemyData {
deck = enemyData.deck; deck = enemyData.deck;
ai = enemyData.ai; ai = enemyData.ai;
boss = enemyData.boss; boss = enemyData.boss;
flying = enemyData.flying; flying = enemyData.flying;
spawnRate = enemyData.spawnRate; spawnRate = enemyData.spawnRate;
copyPlayerDeck = enemyData.copyPlayerDeck; copyPlayerDeck = enemyData.copyPlayerDeck;
difficulty = enemyData.difficulty; difficulty = enemyData.difficulty;
@@ -46,6 +46,9 @@ public class EnemyData {
colors = enemyData.colors; colors = enemyData.colors;
teamNumber = enemyData.teamNumber; teamNumber = enemyData.teamNumber;
nextEnemy =enemyData.nextEnemy==null?null: new EnemyData(enemyData.nextEnemy); nextEnemy =enemyData.nextEnemy==null?null: new EnemyData(enemyData.nextEnemy);
if(enemyData.scale == 0.0f) {
scale=1.0f;
}
if(enemyData.rewards == null) { if(enemyData.rewards == null) {
rewards=null; rewards=null;
} else { } else {