Android Open Source - Apocalypse-Defense Point






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;
import java.io.Serializable;
import java.lang.Math;
/**/*  www. j a  v  a  2 s  .c  o m*/
 */
public class Point implements Serializable {
    /**
     */
    public int x;

    /**
     */
    public int y;

    /**
     * @param y 
     * @param x 
     */
    public Point(int x, int y) {
      this.x = x;
      this.y = y;
    }

    /**
     * @return int[]
     */
    public String getCoords() {
      return x +","+y;
    }

    /**
     * @param point 
     * @return float
     */
    public float getDistance(Point point) {
        int x1 = this.x;
        int x2 = point.x;
        int y1 = this.y;
        int y2 = point.y;
      return (float) Math.sqrt( Math.pow(x2-x1,2) + Math.pow(y2-y1,2) ); //Distance formula
    }
}


/*

Python code:

class Point():
    def __init__(self, x, y):
        self.x = x
        self.y = y
        self.coords = (self.x,self.y)

    def getCoords(self):
        self.coords = (self.x, self.y)
        return self.coords

    #Check for point equivalence:
    def equals(self, point):
        if self.x == point.x and self.y == point.y:
            return True
        else:
            return False

    #Get distance between this point and a different point:
    def getDistance(self, point):
        x1,x2=self.x, point.x
        y1,y2=self.y, point.y
        return sqrt( (x2-x1)**2 + (y2-y1)**2 ) #Distance formula

*/




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