Fix some towers
This commit is contained in:
parent
6fe23277b3
commit
3b474963a8
|
@ -21,7 +21,7 @@ case class RawCase(var x: Int, var y: Int, var couche1: RawSprite, var couche2:
|
||||||
|
|
||||||
def getCoucheThree: RawSprite = couche3
|
def getCoucheThree: RawSprite = couche3
|
||||||
|
|
||||||
def getCollision: String = collision
|
def getCollision: String = collision // FULL, PARTIAL or ANY
|
||||||
|
|
||||||
def setCollision(collision: String): Unit = {
|
def setCollision(collision: String): Unit = {
|
||||||
this.collision = collision
|
this.collision = collision
|
||||||
|
|
|
@ -4,7 +4,6 @@ import fr.ynerant.leveleditor.game.GameFrame
|
||||||
|
|
||||||
import scala.util.Random
|
import scala.util.Random
|
||||||
|
|
||||||
|
|
||||||
class BasicTower(override val x: Int, override val y: Int) extends Tower(x, y) {
|
class BasicTower(override val x: Int, override val y: Int) extends Tower(x, y) {
|
||||||
override def getName = "basictower"
|
override def getName = "basictower"
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,9 @@ class FreezerTower(override val x: Int, override val y: Int) extends Tower(x, y)
|
||||||
override def getPrice = 40
|
override def getPrice = 40
|
||||||
|
|
||||||
override private[towers] def _shot(game: GameFrame): Unit = {
|
override private[towers] def _shot(game: GameFrame): Unit = {
|
||||||
game.getMobs.filter(mob => Math.abs(mob.getX - getX) <= 3 && Math.abs(mob.getY - getY) <= 3).foreach(mob => mob.freeze(if (isUpgraded) 100 else 40))
|
game.getMobs.filter(mob => Math.abs(mob.getX - getX) <= 3 && Math.abs(mob.getY - getY) <= 3).foreach(mob => {
|
||||||
|
mob.freeze(if (isUpgraded) 100 else 40)
|
||||||
|
mob.hit(getDamagePerShot)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package fr.ynerant.leveleditor.game.towers
|
||||||
|
|
||||||
import fr.ynerant.leveleditor.game.GameFrame
|
import fr.ynerant.leveleditor.game.GameFrame
|
||||||
|
|
||||||
|
|
||||||
class LaserTower(override val x: Int, override val y: Int) extends Tower(x, y) {
|
class LaserTower(override val x: Int, override val y: Int) extends Tower(x, y) {
|
||||||
override def getName = "lasertower"
|
override def getName = "lasertower"
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,6 @@ package fr.ynerant.leveleditor.game.towers
|
||||||
|
|
||||||
import fr.ynerant.leveleditor.game.GameFrame
|
import fr.ynerant.leveleditor.game.GameFrame
|
||||||
|
|
||||||
import scala.util.Random
|
|
||||||
|
|
||||||
class UpgradeTower(override val x: Int, override val y: Int) extends Tower(x, y) {
|
class UpgradeTower(override val x: Int, override val y: Int) extends Tower(x, y) {
|
||||||
override def getName = "upgradetower"
|
override def getName = "upgradetower"
|
||||||
|
|
||||||
|
@ -15,5 +13,7 @@ class UpgradeTower(override val x: Int, override val y: Int) extends Tower(x, y)
|
||||||
|
|
||||||
override private[towers] def _shot(game: GameFrame): Unit = {
|
override private[towers] def _shot(game: GameFrame): Unit = {
|
||||||
game.getTowers.filter(tower => Math.pow(tower.getX - getX, 2) + Math.pow(tower.getY - getY, 2) <= 25 && tower != this).foreach(tower => tower.upgrade)
|
game.getTowers.filter(tower => Math.pow(tower.getX - getX, 2) + Math.pow(tower.getY - getY, 2) <= 25 && tower != this).foreach(tower => tower.upgrade)
|
||||||
|
if (isUpgraded)
|
||||||
|
game.getMobs.filter(mob => Math.pow(mob.getX - getX, 2) + Math.pow(mob.getY - getY, 2) <= 9).foreach(mob => mob.hit(getDamagePerShot))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package fr.ynerant.leveleditor.game.towers
|
||||||
|
|
||||||
import fr.ynerant.leveleditor.game.GameFrame
|
import fr.ynerant.leveleditor.game.GameFrame
|
||||||
|
|
||||||
|
|
||||||
class WallTower(override val x: Int, override val y: Int) extends Tower(x, y) {
|
class WallTower(override val x: Int, override val y: Int) extends Tower(x, y) {
|
||||||
override def getName = "walltower"
|
override def getName = "walltower"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue