Example #1
0
 public PlayerMoveAction(float Speed, Vector2 EndPos, Camera Cam)
 {
     speed = Speed;
     cam = Cam;
     startPos = cam.pos;
     endPos = EndPos;
     donePercentage = 0;
 }
Example #2
0
        // Initializes the game state
        public PlayState(GameManager manager)
            : base(manager)
        {
            monsters = Loader.LoadMonsters();
            weapons = Loader.LoadWeapons();
            armor = Loader.LoadArmor();

            cam = new Camera();
            cam.Turn((float)(Math.PI * 2) / 4.0f);

            raycaster = new Raycaster(cam, -0.35f);
            raycaster.BackgroundGradient = manager.GetTexture("background-gradient");

            messages = "";
            numMessages = 0;
        }
Example #3
0
        public Raycaster(Camera cam, float CameraOffset)
        {
            camera = cam;
            posOffset = CameraOffset;

            numSplices = 100;                   //Number of screen splices for drawing
            spliceWidth = 320 / numSplices;     //Width of each splice, in pixels
            int screenDispHeight = (240 / numSplices) / 2;

            // Due to some rounding depending on the number of splices,
            // some extra splices may need to be drawn
            int excessSplices = (320 - numSplices * spliceWidth) / spliceWidth;
            if (excessSplices < 320) excessSplices++;
            numSplices = numSplices + excessSplices;

            splices = new List<ScreenSplice>[numSplices];
        }
Example #4
0
        public Player(Camera cam)
        {
            inventory = new Inventory();
            camera = cam;

            // Bam, average player.
            attributes.strength = 5;
            attributes.endurance = 5;
            attributes.agility = 6;
            attributes.intelligence = 5;
            attributes.speed = 5;
            attributes.constitution = 6;

            // Set the players stats from their attributes
            stats.Initialize(1, attributes);

            turnDone = false;
        }
Example #5
0
 public void SetCamera(Camera newCam)
 {
     camera = newCam;
 }
Example #6
0
        public PlayerTurnAction(float speed, int dir, Camera Cam)
        {
            turnSpeed = speed;
            cam = Cam;
            startDir = cam.dir;
            startPlane = cam.plane;

            donePercentage = 0;
            endRadians = (2.0 * Math.PI) / 4.0; // A rotation of 1/4th of a circle
            endRadians *= dir;
        }
Example #7
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            cam = new Camera();
            cam.SetPosition(new Vector2(21.5f, 11.5f));
            cam.Turn((float)(Math.PI * 2) / 4.0f);

            spriteBatch = new SpriteBatch(GraphicsDevice);
            viewportRect = new Rectangle(0, 0, 320, 240);
            playstate = GameManager.GetInstance().Initialize(cam, Content);
            raycaster = new Raycaster(cam, spriteBatch, -0.35f);

            base.Initialize();
        }