9 changed files with 132 additions and 71 deletions
@ -1,11 +1,13 @@ |
|||
{ |
|||
"hp": 15, |
|||
"damage": 5, |
|||
"sprite": 2, |
|||
"projectileSprite": 12, |
|||
"speed": 0.0035, |
|||
"target range": 10.0, |
|||
"minTargetDist": 5.0, |
|||
"maxTargetDist": 15.0, |
|||
"shootingRate": 500, |
|||
"reactionRate": 200 |
|||
"reactionRate": 200, |
|||
"directionHold": 1000 |
|||
} |
@ -0,0 +1,35 @@ |
|||
package game.entities.characters; |
|||
|
|||
import java.io.IOException; |
|||
|
|||
import org.json.simple.JSONObject; |
|||
import org.json.simple.parser.ParseException; |
|||
|
|||
import game.entities.Entity; |
|||
import game.entities.Projectile; |
|||
import math.vec.Vec2; |
|||
import server.UDPServer; |
|||
|
|||
public abstract class EnemyShooter extends Enemy { |
|||
|
|||
protected int projectileSprite; |
|||
private static final long serialVersionUID = -1431367786700836265L; |
|||
|
|||
public EnemyShooter(Vec2 pos, String fileName, UDPServer server) throws IOException, ParseException { |
|||
super(pos, fileName, server); |
|||
} |
|||
|
|||
@Override |
|||
protected void parseAttributes(JSONObject jsonObject) { |
|||
super.parseAttributes(jsonObject); |
|||
this.projectileSprite = ((Number)jsonObject.get("projectileSprite")).intValue(); |
|||
this.damage = ((Number)jsonObject.get("damage")).floatValue(); |
|||
} |
|||
|
|||
|
|||
@Override |
|||
public Entity shoot(final Vec2 direction) { |
|||
return new Projectile(pos.clone(), direction, this, projectileSprite); |
|||
} |
|||
|
|||
} |
Loading…
Reference in new issue