Android Open Source - Apocalypse-Defense Zombie






From Project

Back to project page Apocalypse-Defense.

License

The source code is released under:

MIT License

If you think the Android project Apocalypse-Defense listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.apocalypsedefense.core;
/**/* w  ww  . j a v  a2  s.c o  m*/
*/
public class Zombie extends Person {
  /**
  */
  public String name = "Zombie Bob";
  /**
  */
  public int level = 1;
  /**
  */
  public int sightRange = 100000;
  /**
  */
  public int speed = 1;
  /**
  */
  public Survivor target = null;
  /**
  */
  public String state = "Walking";
  /**
  */
  public int worth = 5;
  

  /**
   * @param position 
   * @param hp 
   * @param level 
   * @param speed 
   * @param name 
   * @param sightRange 
   * @param weapon 
   * @param state 
   * @param target 
   * @param worth 
   * @param size 
  */
  public Zombie(Point position) {
    super(new Weapon("Melee", "Bite/Scratch", 10, 1, 1), 100, 1, position);
  }
  
  /**
   * @param position 
   * @param hp 
   * @param weapon 
   * @param size 
  */
  public int attack() {
    System.out.print(this.name + " Level " + this.level + " attacked " + this.target.name + " for " + this.weapon.attack() + " points of damage!\n");
      return this.weapon.attack();
  }
  
  public void getStats() {
    System.out.print("\n");
    System.out.print(this.name);
    System.out.print("HP: " + this.hp);
    System.out.print("Level: " + this.level);
    System.out.print("Attack Damage: " + this.weapon.attack());
    System.out.print("Sight Range: " + this.sightRange);
    System.out.print("Weapon Name: " + this.weapon.name);
    System.out.print("Weapon Type: " + this.weapon.wType);
    System.out.print("Speed: " + this.speed);
  }

}


/*

Python code:
class Zombie(Person):
    def __init__(self, weapon=Weapon('Melee', 'Bite/Scratch'), 
                 hp=100, size=(1,1), position=(0,0), 
                 level=1, sightRange=10, speed=1, target=None,
                 name='*Basic Zombie*', state='Walking', worth=5):
        Person.__init__(self,weapon,hp,size,position)
        self.name =  name
        self.level = level
        self.sightRange = sightRange
        self.weapon = weapon
        self.speed = speed
        self.target = target #None or a survivor are the two target types
        self.state = state #walking and attacking are the two states
        self.worth = worth #How much gold the kill is worth (default 10 gold)
    

    def attack(self):
        print self.name + ' Level ' + str(self.level) + ' attacked ' + self.target.name + ' for ' + str(self.weapon.attack()) + ' points of damage!\n'
        return self.weapon.attack()

    def getStats(self):
        print '\n'
        print self.name
        print 'HP: ' + str(self.hp)
        print 'Level: ' + str(self.level)
        print 'Attack Damage: ' + str(self.weapon.damage)
        print 'Sight Range: ' + str(self.sightRange)
        print 'Weapon Name: ' + str(self.weapon.name)
        print 'Weapon Type: ' + str(self.weapon.wType)
        print 'Speed: ' + str(self.speed)

*/




Java Source Code List

com.apocalypsedefense.app.AchievementsActivity.java
com.apocalypsedefense.app.ApocalypseDefenseActivity.java
com.apocalypsedefense.app.EndOfGameDialog.java
com.apocalypsedefense.app.ExitConfirmationDialog.java
com.apocalypsedefense.app.InGameActivity.java
com.apocalypsedefense.app.InstructionsDialog.java
com.apocalypsedefense.app.NewGameSettingsActivity.java
com.apocalypsedefense.app.OverwriteExistingGameDialog.java
com.apocalypsedefense.app.gameplay_visuals.AndroidLogAdapter.java
com.apocalypsedefense.app.gameplay_visuals.GameFacade.java
com.apocalypsedefense.app.gameplay_visuals.GameObject.java
com.apocalypsedefense.app.gameplay_visuals.GameSurfaceView.java
com.apocalypsedefense.app.gameplay_visuals.GameThread.java
com.apocalypsedefense.app.gameplay_visuals.OnGameEndListener.java
com.apocalypsedefense.app.gameplay_visuals.OnStatsChangedListener.java
com.apocalypsedefense.app.gameplay_visuals.Sprite.java
com.apocalypsedefense.core.ActorType.java
com.apocalypsedefense.core.Armor.java
com.apocalypsedefense.core.GameData.java
com.apocalypsedefense.core.GameState.java
com.apocalypsedefense.core.Game.java
com.apocalypsedefense.core.Gun.java
com.apocalypsedefense.core.LogAdapter.java
com.apocalypsedefense.core.MapElement.java
com.apocalypsedefense.core.Map.java
com.apocalypsedefense.core.Movement.java
com.apocalypsedefense.core.Person.java
com.apocalypsedefense.core.Point.java
com.apocalypsedefense.core.PrintLogAdapter.java
com.apocalypsedefense.core.Shared.java
com.apocalypsedefense.core.SurvivorManager.java
com.apocalypsedefense.core.Survivor.java
com.apocalypsedefense.core.Weapon.java
com.apocalypsedefense.core.ZombieManager.java
com.apocalypsedefense.core.Zombie.java
com.apocalypsedefense.core.testDriver.java