Ignore:
Timestamp:
2015-06-25 15:01:53 (5 years ago)
Author:
mijoliim
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 2015/26/MikkoL/JRPG/JRPG/JRPG/Overworld/CollisionMap.cs

    r6281 r6376  
    3232        _CollisionMap.SetTileMethod("00ffff", SetWalkableWaterTile); 
    3333        _CollisionMap.SetTileMethod("0080ff", SetUnpassableWaterTile); 
     34        _CollisionMap.SetTileMethod(Color.Transparent, SetEmptyTile); 
    3435        _CollisionMap.ColorTolerance = 0; 
    3536        _CollisionMap.Execute(1, 1); 
     
    3839    } 
    3940 
     41    void SetEmptyTile(Vector Position, double Width, double Height) 
     42    { 
     43        Tile Empty = new Tile(TileType.Blank); 
     44        CollisionMapArray.SetValue(Empty, (int)Math.Floor(Position.X) + (int)Math.Floor((double)CollisionMapArray.GetLength(0) / 2), (int)Math.Floor(Position.Y) + (int)Math.Floor((double)CollisionMapArray.GetLength(1) / 2)); 
     45    } 
     46 
    4047    void SetWallTile(Vector Position, double Width, double Height) 
    4148    { 
    4249        Tile Wall = new Tile(TileType.Wall); 
    43         CollisionMapArray.SetValue(Wall, (int)Position.X + (int)Math.Floor((double)CollisionMapArray.GetLength(0) / 2), (int)Position.Y + (int)Math.Floor((double)CollisionMapArray.GetLength(1) / 2)); 
     50        CollisionMapArray.SetValue(Wall, (int)Math.Floor(Position.X) + (int)Math.Floor((double)CollisionMapArray.GetLength(0) / 2), (int)Math.Floor(Position.Y) + (int)Math.Floor((double)CollisionMapArray.GetLength(1) / 2)); 
    4451    } 
    4552    void SetFloorTile(Vector Position, double Width, double Height) 
    4653    { 
    4754        Tile Floor = new Tile(TileType.Floor); 
    48         CollisionMapArray.SetValue(Floor, (int)Position.X + (int)Math.Floor((double)CollisionMapArray.GetLength(0) / 2), (int)Position.Y + (int)Math.Floor((double)CollisionMapArray.GetLength(1) / 2)); 
     55        CollisionMapArray.SetValue(Floor, (int)Math.Floor(Position.X) + (int)Math.Floor((double)CollisionMapArray.GetLength(0) / 2), (int)Math.Floor(Position.Y) + (int)Math.Floor((double)CollisionMapArray.GetLength(1) / 2)); 
    4956    } 
    5057    void SetWaterTile(Vector Position, double Width, double Height) 
    5158    { 
    5259        Tile Water = new Tile(TileType.Water); 
    53         CollisionMapArray.SetValue(Water, (int)Position.X + (int)Math.Floor((double)CollisionMapArray.GetLength(0) / 2), (int)Position.Y + (int)Math.Floor((double)CollisionMapArray.GetLength(1) / 2)); 
     60        CollisionMapArray.SetValue(Water, (int)Math.Floor(Position.X) + (int)Math.Floor((double)CollisionMapArray.GetLength(0) / 2), (int)Math.Floor(Position.Y) + (int)Math.Floor((double)CollisionMapArray.GetLength(1) / 2)); 
    5461    } 
    5562    void SetWalkableWaterTile(Vector Position, double Width, double Height) 
    5663    { 
    5764        Tile WalkableWater = new Tile(TileType.WalkableWater); 
    58         CollisionMapArray.SetValue(WalkableWater, (int)Position.X + (int)Math.Floor((double)CollisionMapArray.GetLength(0) / 2), (int)Position.Y + (int)Math.Floor((double)CollisionMapArray.GetLength(1) / 2)); 
     65        CollisionMapArray.SetValue(WalkableWater, (int)Math.Floor(Position.X) + (int)Math.Floor((double)CollisionMapArray.GetLength(0) / 2), (int)Math.Floor(Position.Y) + (int)Math.Floor((double)CollisionMapArray.GetLength(1) / 2)); 
    5966    } 
    6067    void SetUnpassableWaterTile(Vector Position, double Width, double Height) 
    6168    { 
    6269        Tile UnpassableWater = new Tile(TileType.WaterUnpassable); 
    63         CollisionMapArray.SetValue(UnpassableWater, (int)Position.X + (int)Math.Floor((double)CollisionMapArray.GetLength(0) / 2), (int)Position.Y + (int)Math.Floor((double)CollisionMapArray.GetLength(1) / 2)); 
     70        CollisionMapArray.SetValue(UnpassableWater, (int)Position.X + (int)Math.Floor((double)CollisionMapArray.GetLength(0) / 2), (int)Math.Floor(Position.Y) + (int)Math.Floor((double)CollisionMapArray.GetLength(1) / 2)); 
    6471    } 
    6572 
Note: See TracChangeset for help on using the changeset viewer.