Ignore:
Timestamp:
2012-07-04 13:57:59 (8 years ago)
Author:
dezhidki
Message:

Updated camera motion

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 2012/27/DenisZ/TheDungeonGame/TheDungeonGame/TheDungeonGame/LevelGenerator.cs

    r3517 r3538  
    88namespace Rooms 
    99{ 
    10     class LevelGenerator 
     10  public class LevelGenerator 
    1111    { 
    1212        private double width, height; 
     
    1616        private List<Room> roomList = new List<Room>(); 
    1717 
    18         public LevelGenerator(Game game, Vector size, Vector roomamount) 
     18        public LevelGenerator(TheDungeonGame game, Vector size, Vector roomamount) 
    1919        { 
    2020            this.game = game; 
     
    2525 
    2626            rooms = new Room[roomAmountHor, roomAmountVert]; 
     27        } 
     28 
     29        public Vector getGridPos(Vector pos) 
     30        { 
     31            double gridPosX = pos.X - width / 2; 
     32            double gridPosY = pos.Y + height / 2; 
     33 
     34            int x = (int)(gridPosX / TheDungeonGame.ROOMWIDTH); 
     35            int y = (int)(gridPosY / TheDungeonGame.ROOMHEIGHT); 
     36 
     37            return new Vector(x, y); 
    2738        } 
    2839 
     
    100111        { 
    101112            if (getRoomFromDirection(lastRoom, dir) != null) return false; 
    102             currentRoom = new TestRoom(game, VecMath.mul(pos, new Vector(TheDungeonGame.ROOMWIDTH+TheDungeonGame.ROOMTHICKNESS, -TheDungeonGame.ROOMHEIGHT -TheDungeonGame.ROOMTHICKNESS)), TheDungeonGame.roomSize, TheDungeonGame.ROOMTHICKNESS); 
     113            currentRoom = new TestRoom(game, VecMath.mul(pos, new Vector(TheDungeonGame.ROOMWIDTH + TheDungeonGame.ROOMTHICKNESS, -TheDungeonGame.ROOMHEIGHT - TheDungeonGame.ROOMTHICKNESS)), TheDungeonGame.roomSize, TheDungeonGame.ROOMTHICKNESS); 
    103114            return placeRoomAt(currentRoom, (int)pos.X, (int)pos.Y); 
    104115        } 
     
    117128            if (!isValidPos(x, y)) return null; 
    118129            return rooms[x, y]; 
     130        } 
     131 
     132        public Room getRoomAt(Vector pos) 
     133        { 
     134            return getRoomAt((int)pos.X, (int)pos.Y); 
    119135        } 
    120136 
Note: See TracChangeset for help on using the changeset viewer.