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.util.Config;
import java.util.HashMap;
/**
* CharacterSprite base class for animated sprites on the map
*/
@@ -34,8 +33,12 @@ public class CharacterSprite extends MapActor {
}
@Override
void updateBoundingRect() { //We want a slimmer box for the player entity so it can navigate terrain without getting stuck.
boundingRect.set(getX() + 4, getY(), getWidth() - 6, getHeight() * collisionHeight);
void updateBoundingRect() {
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) {
@@ -226,8 +229,10 @@ public class CharacterSprite extends MapActor {
setWidth(currentFrame.getRegionWidth());
Color oldColor=batch.getColor().cpy();
batch.setColor(getColor());
batch.draw(currentFrame, getX(), getY());
float scale = this instanceof EnemySprite ? 2f : 1f ;
float scale = 1f;
if (this instanceof EnemySprite) {
scale = ((EnemySprite) this).getData().scale;
}
batch.draw(currentFrame, getX(), getY(), getWidth()*scale, getHeight()*scale);
batch.setColor(oldColor);
super.draw(batch,parentAlpha);

View File

@@ -46,6 +46,9 @@ public class EnemyData {
colors = enemyData.colors;
teamNumber = enemyData.teamNumber;
nextEnemy =enemyData.nextEnemy==null?null: new EnemyData(enemyData.nextEnemy);
if(enemyData.scale == 0.0f) {
scale=1.0f;
}
if(enemyData.rewards == null) {
rewards=null;
} else {