Hitler - RusiaDefense

Programación Orientada a Objetos (Tower defense - kingdom rush)

Moderator: julianmartinez16

User avatar
Vidal18
Posts: 18
Joined: Tue Jan 22, 2019 12:12 pm

Hitler - RusiaDefense

Post by Vidal18 » Tue Jan 22, 2019 12:42 pm

integrantes:
  • Pedro Gomez
  • Jose Vidal
repositorio github

https://github.com/blackbeast17/rusiadefense.git

HISTORIA

DURANTE LA SEGUNDA GUERRA MUNDIAL LA
ALEMANIA NAZI CONQUISTO CON ÉXITO
MUCHOS TERRITORIOS CONSOLIDÁNDOSE
COMO UNA NACIÓN PODEROSA... SU SIGUIENTE
OBJETIVO ES LA URSS, PERO RUSIA NO SE LO
PONDRÁ TAN FÁCIL, OPONIENDO RESISTENCIA
A ESTA Y LUCHANDO.
Last edited by Vidal18 on Thu Jan 31, 2019 12:12 pm, edited 1 time in total.
programacion y diseño orientado a objetos :twisted:
black

User avatar
Pedro Gómez
Posts: 7
Joined: Thu Jul 26, 2018 6:25 am

Re: Hitler - RusiaDefense

Post by Pedro Gómez » Thu Jan 31, 2019 12:09 pm

Presentación del Juego
  • Jose Vidal
  • Pedro Gómez
  • Pedro Daniel Gómez Esparza
Programación Y Diseño Orientado a Objetos 1

User avatar
Vidal18
Posts: 18
Joined: Tue Jan 22, 2019 12:12 pm

Re: Hitler - RusiaDefense

Post by Vidal18 » Tue Feb 05, 2019 10:30 am

¿Que se ha hecho?
se creo una clase que permite calcular el tamaño de los sprites para luego colocarlos en posiciones correctas donde las copias de estos no se superpongan sino que por el contrario se acomoden automáticamente

¿que se va a hacer?
se realizara un código que permite crear mapas en base a vectores... que luego nos permitiría crear ciertos niveles solo creando una matriz ordenada

¿Que dificultades presenta?
Hasta el momento ninguna... todo genial

Image

Image

Code: Select all

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class LevelManager : MonoBehaviour {

    [SerializeField]
    private GameObject tile;
	// Use this for initialization
	void Start ()
    {
        CreateLevel();
	}
	
	// Update is called once per frame
	void Update () {
		
	}

    public void CreateLevel()
    {
        //calcula el tamañio de los archivos, para luego colocarlos en posiciones correctas
        float tileSize = tile.GetComponent<SpriteRenderer>().sprite.bounds.size.x; 
        
        for (int y = 0; y < 5; y++)//las posiciones de y
        {
            for (int x = 0; x < 5; x++)//las posiciones de x
            {

                //crea nuevos tiles y hace referencias a estos tile en los neuvos tiles
               GameObject newTile = Instantiate(tile);
                newTile.transform.position = new Vector3(tileSize * x, tileSize * y, 0);

            }
        }


    }
}
programacion y diseño orientado a objetos :twisted:
black

User avatar
Pedro Gómez
Posts: 7
Joined: Thu Jul 26, 2018 6:25 am

Re: Hitler - RusiaDefense

Post by Pedro Gómez » Tue Feb 19, 2019 11:28 am

¿Que se ha hecho?
Se Diseño el enemigo base del juego.

¿que se va a hacer?
animar el ciclo de caminata

¿Que dificultades presenta?
Hasta el momento ninguna... todo genial


Image
  • Pedro Daniel Gómez Esparza
Programación Y Diseño Orientado a Objetos 1

User avatar
Vidal18
Posts: 18
Joined: Tue Jan 22, 2019 12:12 pm

Re: Hitler - RusiaDefense

Post by Vidal18 » Tue Feb 26, 2019 8:08 am

¿Que se ha hecho?
Se creo un codigo que permite generar un mapa con matrices, y se logro diferenciar entre los diferentes tipos de tierras
¿Que se hara?
Generacion de enemigos y colocacion de torres en el mapa
¿Que dificultades se ha tenido?
En el computador de la u donde se tenia el juego... fue borrado todo y toco comenzar de nuevo el codigo
buscamos donde poder seguir avanzando tranquilamente

Code: Select all

 using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;

public class LevelManager : MonoBehaviour {
    
    [SerializeField]
    private GameObject[] tilePrefabs;

    public float TileSize
    {
        get {return tilePrefabs[0].GetComponent<SpriteRenderer>().sprite.bounds.size.x; }
    }

	// Use this for initialization
	void Start () {

        CreateLevel();

	}
	
	// Update is called once per frame
	void Update () {
		
	}

    private void CreateLevel()
    {
        string[] mapData = ReadLevelText();
       
        int mapXSize = mapData[0].ToCharArray().Length;
        int mapYSize = mapData.Length;

        Vector3 worldStart = Camera.main.ScreenToWorldPoint(new Vector3(0, Screen.height));

        for(int y =0; y < mapYSize; y++)
        {

            char[] newTiles = mapData[y].ToCharArray();

            for (int x = 0; x < mapXSize; x++)
            {
                PlaceTile(newTiles[x].ToString(),x,y, worldStart);
            }
        }
    }

    private void PlaceTile(string tileType, int x, int y, Vector3 worldStart)
    {
        int tileIndex = int.Parse(tileType);

        GameObject newTile = Instantiate(tilePrefabs[tileIndex]);
        newTile.transform.position = new Vector3(worldStart.x + (TileSize * x), worldStart.y - (TileSize * y), 0);
    }

    private string[] ReadLevelText()
    {
        TextAsset bindData = Resources.Load("Level") as TextAsset;

        string data = bindData.text.Replace(Environment.NewLine, string.Empty);

        return data.Split('-');
    }

}
programacion y diseño orientado a objetos :twisted:
black

User avatar
xacarana
Site Admin
Posts: 1165
Joined: Fri Jan 15, 2016 6:13 pm

Re: Hitler - RusiaDefense

Post by xacarana » Tue Mar 12, 2019 12:08 pm

No publican desde desde febrero

Image
Andrés Bedoya Tobón
Profesor
"I only smile in the dark, I only smile when it's complicated" Raybiez

User avatar
Vidal18
Posts: 18
Joined: Tue Jan 22, 2019 12:12 pm

Re: Hitler - RusiaDefense

Post by Vidal18 » Thu Mar 21, 2019 6:41 am

¿que se ha hecho?
se creo una clase que permite usar movimiento en la camera mediante teclas... sin que se salga del borde del juego

¿que se va a hacer?
se creara una libreria de tiles y se implementara un portal para que aparezcan enemigos

Image

Image

Code: Select all

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CamaraMovement : MonoBehaviour
{
    [SerializeField]
    private float cameraSpeed = 0;
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    private void Update()
    {
        GetInput();
    }

    private void GetInput()
    {
        if (Input.GetKey(KeyCode.W))
        {
            transform.Translate(Vector3.up * cameraSpeed * Time.deltaTime);

        }
        if (Input.GetKey(KeyCode.A))
        {
            transform.Translate(Vector3.left * cameraSpeed * Time.deltaTime);

        }
        if (Input.GetKey(KeyCode.S))
        {
            transform.Translate(Vector3.down * cameraSpeed * Time.deltaTime);

        }
        if (Input.GetKey(KeyCode.D))
        {
            transform.Translate(Vector3.right * cameraSpeed * Time.deltaTime);

        }
    }
}
programacion y diseño orientado a objetos :twisted:
black

User avatar
Vidal18
Posts: 18
Joined: Tue Jan 22, 2019 12:12 pm

Re: Hitler - RusiaDefense

Post by Vidal18 » Tue Mar 26, 2019 11:26 am

¿que han hecho?
creamos una estructura que permite almacenar valores de x y y de los tiles y se modifico la clase createlevel para implementar esto y que cada uno de los tiles almacene sus coordenadas, para poder hacer posteriormente que se pueda contar donde se colocan las torres y poder hacerlo bien.

¿que se va a hacer?

creare un diccionario de tiles, comenzare los portales y un poco de las torres

¿algun problema?

ninguno

Code: Select all

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;

public class LevelManager : MonoBehaviour
{
    [SerializeField]
   
    private GameObject[] tilePrefabs;

    [SerializeField]
    private CamaraMovement cameraMovement;


    public float TileSize
    {
        get { return tilePrefabs[0].GetComponent<SpriteRenderer>().sprite.bounds.size.x; }
    }
    // Use this for initialization
    void Start()
    {
        Point p = new Point(2, 0);
        Debug.Log(p.X);
        CreateLevel();
    }

    // Update is called once per frame
    void Update()
    {

    }

    public void TestValue(Point p)
    {
        p.X = 3;
    }

    private void CreateLevel()
    {
        // string[] mapData = new string[]
        // {
        //    "0000", "1111", "2222","3333","4444","5555"
        //};
        string[] mapData = ReadLevelText();


        int mapXSize = mapData[0].ToCharArray().Length;
        int mapYsize = mapData.Length;

        Vector3 maxTile = Vector3.zero;
        

        //calcula el tamañio de los archivos, para luego colocarlos en posiciones correctas

        Vector3 worldStart = Camera.main.ScreenToWorldPoint(new Vector3(0,Screen.height));
        for (int y = 0; y < mapYsize; y++)//las posiciones de y
        {

            char[] newTiles = mapData[y].ToCharArray();

            for (int x = 0; x < mapXSize; x++)//las posiciones de x
            {

                //crea nuevos tiles y hace referencias a estos tile en los neuvos tiles
              maxTile = Placetile(newTiles[x].ToString(), x,y,worldStart);

            }
        }

        cameraMovement.SetLimits(new Vector3(maxTile.x + TileSize, maxTile.y - TileSize));


    }
    private Vector3 Placetile(string tileType, int x, int y,Vector3 worldStart)
    {
        int tileIndex = int.Parse(tileType);

        TileScript newTile = Instantiate(tilePrefabs[tileIndex]).GetComponent<TileScript>();
        newTile.Setup(new Point(x, y), new Vector3(worldStart.x + (TileSize * x), worldStart.y - (TileSize * y), 0));
        return newTile.transform.position;
    }
    private string[] ReadLevelText()
    {
        TextAsset binData = Resources.Load("Level") as TextAsset;
        string data = binData.text.Replace(Environment.NewLine, string.Empty);
        return data.Split('-');
    }
}

Code: Select all

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public struct Point 
{
    // Start is called before the first frame update
    public int X { get; set; }

    public int Y { get; set; }

    public Point(int x, int y)
    {
        this.X = x;
        this.Y = y;

    }
}

Code: Select all

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TileScript : MonoBehaviour
{
    public Point GridPosition { get; set; }

    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    public void Setup(Point gridPos, Vector3 worldPos)
    {

        this.GridPosition = GridPosition;
        transform.position = worldPos;

    }
}
programacion y diseño orientado a objetos :twisted:
black

User avatar
Vidal18
Posts: 18
Joined: Tue Jan 22, 2019 12:12 pm

Re: Hitler - RusiaDefense

Post by Vidal18 » Thu Apr 04, 2019 10:20 am

¿que se ha hecho?
se utilizo el algoritmo AStar para manejar el movimiento de los monstruos; se creo una funcion currency que administra los recursos del juego a la vez que permite la colocación de torres cuando hay suficientes recursos y anula la misma en caso de no tener recursos suficientes; se modifico la funcion place tower para no permitir colocar torres en donde ya haya; se corrigio un bug que hacia que el monstruos se quedara quieto en la mitad del mapa aunque la animacion de movimiento seguia operando

¿que se va a hacer?
se trabajara en el rango de las torres; los proyectiles, y el daño de los mismos, para que las torres ya puedan atacar los monstruos; se generara el sistema de oleadas, el sistema de vida de los enemigos, se creara y se programara el sistema ui de game over.

¿algun problema?

de momento ninguno... todos los bugs conocidos hasta ahora se han corregido

Code: Select all

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Monster : MonoBehaviour
{
    [SerializeField]
    private float speed;

    private Stack<Node> path;

    public Point GridPosition
    {
        get; set;
    }

    private Vector3 destination;
    private void Update()
    {
        Move();
    }

    public void Spawn()
    {
        transform.position = LevelManager.Instance.BluePortal.transform.position;

        SetPath(LevelManager.Instance.Path);
    }

    private void Move()
    {
        transform.position = Vector2.MoveTowards(transform.position, destination, speed * Time.deltaTime);

        if (transform.position == destination)
        {
            if (path != null & path.Count > 0)
            {
                GridPosition = path.Peek().GridPosition;
                destination = path.Pop().WorldPosition;
            }
        }
    }
    private void SetPath(Stack<Node> newPath)
    {
        if (newPath != null)
        {
            this.path = newPath;
            GridPosition = path.Peek().GridPosition;
            destination = path.Pop().WorldPosition;
        }
    }

    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.tag == "portal")
        {
            Destroy(gameObject);
        }
    }


}

Code: Select all

using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
using UnityEngine;

public class GameManager : Singleton<GameManager>
{
 

    public TowerBtn ClickedBtn { get ;  set ; }
    public int Currency
    {
        get { return currency; }

        set
        {
            this.currency = value;
            this.currencyTxt.text = value.ToString() + "$";
        }
    }

    private int currency;
    [SerializeField]
    private Text currencyTxt;

    public Objectpool Pool { get; set; }
    

    // Start is called before the first frame update
    void Start()
    {
        Currency = 100;
    }

    private void Awake()
    {
        Pool = GetComponent<Objectpool>();
    }
    // Update is called once per frame
    void Update()
    {
        HandleEscape();
    }

    public void PickTower (TowerBtn towerBtn)
    {
        if (Currency >= towerBtn.Price)
        {
            this.ClickedBtn = towerBtn;
            Hover.Instance.Activate(towerBtn.Sprite);
          
        }

        

    }

    public void BuyTower()
    {
        if (Currency >= ClickedBtn.Price)
        {
            Currency -= ClickedBtn.Price;
            Hover.Instance.DeActivate();
        }
        
       
    }

    private void HandleEscape()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {

            Hover.Instance.DeActivate();
            ClickedBtn = null;
        }
    }

    public void StartWave()
    {
        StartCoroutine(SpawnWave());
    }
   private IEnumerator SpawnWave()
    {
        LevelManager.Instance.GeneratePath();
        int monsterIndex = 0;

        string type = string.Empty;
        switch (monsterIndex)
        {
            case 0:
                type = "Hitler";
                break;
        }

       Monster monster = Pool.GetObject(type).GetComponent<Monster>();
        monster.Spawn();
        yield return new WaitForSeconds(2.5f);
    }
}

Code: Select all

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;

public static class AStar 
{
    private static Dictionary<Point, Node> nodes;

    private static void CreateNodes()
    {
        nodes = new Dictionary<Point, Node>();

        foreach (TileScript tile in LevelManager.Instance.Tiles.Values)
        {
            nodes.Add(tile.GridPosition, new Node(tile));
        }
    }

    public static Stack<Node> GetPath(Point start, Point goal)
    {
        if (nodes == null)
        {
            CreateNodes();
        }
        //crea la lista abierta
        HashSet<Node> openList = new HashSet<Node>();
        //cierra la lista
        HashSet<Node> closedList = new HashSet<Node>();

        Stack<Node> finalPath = new Stack<Node>();
       
        Node currentNode = nodes[start];

        openList.Add(currentNode);

        while (openList.Count >0)
        {
            for (int x = -1; x <= 1; x++)
            {
                for (int y = -1; y <= 1; y++)
                {
                    Point neighbourPos = new Point(currentNode.GridPosition.X - x, currentNode.GridPosition.Y - y);
                    if (LevelManager.Instance.InBounds(neighbourPos) && LevelManager.Instance.Tiles[neighbourPos].walKable && neighbourPos != currentNode.GridPosition)
                    {

                        int gCost = 0;

                        if (Math.Abs(x - y) == 1)
                        {
                            gCost = 10;
                        }
                        else
                        {
                            if (!ConnectedDiagonally(currentNode, nodes[neighbourPos]))
                            {
                                continue;
                            }
                            gCost = 14;
                        }
                        Node neighbour = nodes[neighbourPos];



                        if (openList.Contains(neighbour))
                        {
                            if (currentNode.G + gCost < neighbour.G)
                            {
                                neighbour.CalcValues(currentNode, nodes[goal], gCost);
                            }
                        }

                        else if (!closedList.Contains(neighbour))
                        {
                            openList.Add(neighbour);
                            neighbour.CalcValues(currentNode, nodes[goal], gCost);
                        }

                       

                       


                    }


                }
            }
            openList.Remove(currentNode);
            closedList.Add(currentNode);

            if (openList.Count > 0)
            {
                currentNode = openList.OrderBy(n => n.F).First();
            }
            if (currentNode == nodes[goal])
            {
                while (currentNode.GridPosition != start)
                {
                    finalPath.Push(currentNode);
                    currentNode = currentNode.Parent;
                   
                }
                break;
            }    
        }
        return finalPath;
    
        //GameObject.Find("AStarDebugger").GetComponent<AStarDebugger>().DebugPath(openList , closedList, finalPath);
    }

    private static bool ConnectedDiagonally(Node currentNode, Node neighbor)
    {
        Point direction = neighbor.GridPosition - currentNode.GridPosition;

        Point first = new Point(currentNode.GridPosition.X + direction.X, currentNode.GridPosition.Y + direction.Y);

        Point second = new Point(currentNode.GridPosition.X, currentNode.GridPosition.Y + direction.Y);

        if (LevelManager.Instance.InBounds(first) && !LevelManager.Instance.Tiles[first].walKable)
        {
            return false;
        }
        if (LevelManager.Instance.InBounds(second) && !LevelManager.Instance.Tiles[second].walKable)
        {
            return false;
        }

        return true;
    }
}

Code: Select all

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AStarDebugger : MonoBehaviour
{
   
    private TileScript start, goal;

    [SerializeField]
    private Sprite blankTile;

    [SerializeField]
    private GameObject arrowPrefab;

    [SerializeField]
    private GameObject debugTilePrefab;
    
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    //void Update()
    //{
    //    ClickTile();

    //    if (Input.GetKeyDown(KeyCode.Space))
    //    {
    //        AStar.GetPath(start.GridPosition,goal.GridPosition);
    //    }
    //}

    private void ClickTile()
    {
        if (Input.GetMouseButtonDown(1))
        {
            RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);

            if (hit.collider != null)
            {
                TileScript tmp = hit.collider.GetComponent<TileScript>();

                if (tmp != null)
                {
                    if (start == null)
                    {
                        start = tmp;

                        CreateDebugTile(start.WorldPosition, new Color(255, 135, 0, 255));
                        
                    }
                    else if (goal == null)
                    {
                        goal = tmp;
                        CreateDebugTile(goal.WorldPosition, new Color(255, 0, 0, 255));
                    }
                }
               

            }

        }
    }
    public void DebugPath(HashSet<Node> openList, HashSet<Node> closedList,Stack<Node> path)
    {
        foreach (Node node in openList)
        {
            if (node.Tileref != start && node.Tileref != goal)
            {
                CreateDebugTile(node.Tileref.WorldPosition, Color.cyan, node);
            }

            PointToParent(node,node.Tileref.WorldPosition);
          
        }
        foreach (Node node in closedList)
        {
            if (node.Tileref != start && node.Tileref != goal && path.Contains(node))
            {
                CreateDebugTile(node.Tileref.WorldPosition, Color.blue, node);
            }

            PointToParent(node, node.Tileref.WorldPosition);

        }
        foreach (Node node in path)
        {
            if (node.Tileref != start && node.Tileref != goal)
            {
                CreateDebugTile(node.Tileref.WorldPosition, Color.green, node);
            }
        }
    }

    private void PointToParent(Node node, Vector2 position)
    {
        if (node.Parent != null)
        {
            GameObject arrow = (GameObject)Instantiate(arrowPrefab, position, Quaternion.identity);
            arrow.GetComponent<SpriteRenderer>().sortingOrder = 3;
            //rigth
            if ((node.GridPosition.X < node.Parent.GridPosition.X) && (node.GridPosition.Y == node.Parent.GridPosition.Y))
            {
                arrow.transform.eulerAngles = new Vector3(0, 0, 0);
            }
            // top right

           else if ((node.GridPosition.X < node.Parent.GridPosition.X) && (node.GridPosition.Y > node.Parent.GridPosition.Y))
            {
                arrow.transform.eulerAngles = new Vector3(0, 0, 45);
            }
            //up
            else if ((node.GridPosition.X == node.Parent.GridPosition.X) && (node.GridPosition.Y > node.Parent.GridPosition.Y))
            {
                arrow.transform.eulerAngles = new Vector3(0, 0, 90);
            }
            //top left
            else if ((node.GridPosition.X > node.Parent.GridPosition.X) && (node.GridPosition.Y > node.Parent.GridPosition.Y))
            {
                arrow.transform.eulerAngles = new Vector3(0, 0, 135);
            }// left
            else if ((node.GridPosition.X > node.Parent.GridPosition.X) && (node.GridPosition.Y == node.Parent.GridPosition.Y))
            {
                arrow.transform.eulerAngles = new Vector3(0, 0, 180);
            }//bottom left
            else if ((node.GridPosition.X > node.Parent.GridPosition.X) && (node.GridPosition.Y <node.Parent.GridPosition.Y))
            {
                arrow.transform.eulerAngles = new Vector3(0, 0, 225);

            }//bottom
            else if ((node.GridPosition.X == node.Parent.GridPosition.X) && (node.GridPosition.Y < node.Parent.GridPosition.Y))
            {
                arrow.transform.eulerAngles = new Vector3(0, 0, 270);
            }
            // bottom right
            else if ((node.GridPosition.X < node.Parent.GridPosition.X) && (node.GridPosition.Y < node.Parent.GridPosition.Y))
            {
                arrow.transform.eulerAngles = new Vector3(0, 0, 315);
            }
        }

        

    }
    private void CreateDebugTile(Vector3 worldPos, Color32 color, Node node = null)
    {

        GameObject debugTile = Instantiate(debugTilePrefab, worldPos, Quaternion.identity);
        if (node != null)
        {
            DebugTile tmp = debugTile.GetComponent<DebugTile>();

            tmp.G.text += node.G;
            tmp.H.text += node.H;
            tmp.F.text += node.F;
        }
        debugTile.GetComponent<SpriteRenderer>().color = color;
    }
}

Code: Select all

using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
using UnityEngine;

public class DebugTile : MonoBehaviour
{
    [SerializeField]
    private Text f;

    [SerializeField]
    private Text g;

    [SerializeField]
    private Text h;

    public Text F
    {
        get { f.gameObject.SetActive(true); return f; }
        set => f = value;
    }
    public Text G
    {
        get { g.gameObject.SetActive(true); return g; } set => g = value;
    }
    public Text H
    {
        get { h.gameObject.SetActive(true); return h; }
         set => h = value;
    }
}

Code: Select all

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Node
{

    public Point GridPosition
    {
        get;
        set;
    }
   public TileScript Tileref { get; set; }

    public Vector2 WorldPosition { get; set; }

    public Node Parent { get; private set; }

    public int G { get; set; }

    public int H { get; set; }
    public int F { get; set; }

    public Node(TileScript tileRef)
    {
        this.Tileref = tileRef;
        this.GridPosition = tileRef.GridPosition;
        this.WorldPosition = tileRef.WorldPosition;
    }

    public void CalcValues(Node parent,Node goal, int gCost )
    {
        this.Parent = parent;
        this.G = parent.G + gCost;
        this.H = ((Math.Abs( GridPosition.X - goal.GridPosition.X)) + (Math.Abs( goal.GridPosition.Y - GridPosition.Y))) * 10;
        this.F = G + H;
    }

}
programacion y diseño orientado a objetos :twisted:
black

User avatar
Vidal18
Posts: 18
Joined: Tue Jan 22, 2019 12:12 pm

Re: Hitler - RusiaDefense

Post by Vidal18 » Thu Apr 04, 2019 10:39 am

programacion y diseño orientado a objetos :twisted:
black

Post Reply