Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type Update= (TileType, Seq[MineralDrop], Int, Boolean)
- def standard(f:( ((Int,Int), Int) => (TileType, Int, Boolean))): ((Int,Int), Int) => Update = { case (ij, dmg) =>
- val (tt, toolDmg, broke) = f(ij, dmg)
- (tt, Seq(), toolDmg, broke)
- }
- case class Rock3(override val tile:Tile, override val bg:Tile, hp:Int) extends TileType {
- val toolDamage = 50
- override def hit: ((Int, Int), Int) => Update = standard { case (ij, dmg) =>
- val newHp = hp.drop(dmg)
- if (newHp > 0) {
- (copy(hp = newHp), toolDamage, false)
- } else {
- (Empty(bg), toolDamage, true)
- }
- }
- }
- //Error:(36, 12) class Rock3 needs to be abstract, since method hit in trait TileType of type (ij: (Int, Int), dmg: Int)(in.dogue.profundus.world.TileType, Seq[in.dogue.profundus.entities.MineralDrop], Int, Boolean) is not defined
- //case class Rock3(override val tile:Tile, override val bg:Tile, hp:Int) extends TileType {
- // ^
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement