|
@@ -1,5 +1,6 @@
|
|
|
package me.hammerle.supersnuvi.entity;
|
|
|
|
|
|
+import java.util.Random;
|
|
|
import me.hammerle.supersnuvi.entity.components.DefaultHealth;
|
|
|
import me.hammerle.supersnuvi.entity.components.DefaultMovement;
|
|
|
import me.hammerle.supersnuvi.entity.components.Death;
|
|
@@ -52,7 +53,7 @@ public final class EntityBuilder
|
|
|
return hero;
|
|
|
}
|
|
|
|
|
|
- public static Entity buildTest(Level level, double x, double y)
|
|
|
+ public static Entity buildLondoner(Level level, double x, double y, boolean evil)
|
|
|
{
|
|
|
double w = Game.TILE_SIZE;
|
|
|
double h = Game.TILE_SIZE * 2;
|
|
@@ -60,7 +61,7 @@ public final class EntityBuilder
|
|
|
Entity hero = new Entity(level, x, y, w, h, w * 0.4375, h * 0.703125);
|
|
|
hero.animator = new LondonerAnimator(hero);
|
|
|
//hero.controller = new FollowHeroController(hero, 2);
|
|
|
- hero.controller = new LondonerController(hero, true);
|
|
|
+ hero.controller = new LondonerController(hero, evil);
|
|
|
hero.health = new DefaultHealth(hero, Death.NULL, 100.0);
|
|
|
hero.energy = new DefaultEnergy(hero, 100.0);
|
|
|
hero.move = new DefaultMovement(hero, ent -> level.getData().getInt("jump", 24));
|
|
@@ -78,22 +79,18 @@ public final class EntityBuilder
|
|
|
return stone;
|
|
|
}
|
|
|
|
|
|
+ private final static Random RND = new Random();
|
|
|
+
|
|
|
public static Entity fromId(int id, Level level, double x, double y)
|
|
|
{
|
|
|
switch(id)
|
|
|
{
|
|
|
case 1:
|
|
|
- return buildTest(level, x, y);
|
|
|
+ return buildLondoner(level, x, y, RND.nextBoolean());
|
|
|
case 2:
|
|
|
- {
|
|
|
- Entity ent = new Entity(level, x, y, Game.TILE_SIZE, Game.TILE_SIZE * 2);
|
|
|
- ent.animator = new HeroAnimator(ent);
|
|
|
- ent.controller = new WalkController(ent, 1);
|
|
|
- ent.health = new DefaultHealth(ent, Death.NULL, 100.0);
|
|
|
- ent.move = new DefaultMovement(ent, enti -> 12);
|
|
|
- ent.movePenalty = new LandMovement(ent);
|
|
|
- return ent;
|
|
|
- }
|
|
|
+ return buildLondoner(level, x, y, true);
|
|
|
+ case 3:
|
|
|
+ return buildLondoner(level, x, y, false);
|
|
|
}
|
|
|
return null;
|
|
|
}
|