コード例 #1
0
ファイル: Actor.cs プロジェクト: scrachatron/Babelon
        public virtual void UpdateMe(GameTime gt, Level level)
        {
            m_rect.X = (int)Math.Round(m_position.X);
            m_rect.Y = (int)Math.Round(m_position.Y);

            if (m_rect.X != (int)m_targetPos.X || m_rect.Y != (int)m_targetPos.Y)
            {
                m_velocity = new Vector2(m_virtualpos.X * level.LayerSize.X - Position.X, m_virtualpos.Y * level.LayerSize.Y - Position.Y);
                m_position += m_velocity/3;
            }
            else
                Collision(level);

            MoveHere = Point.Zero;
        }
コード例 #2
0
ファイル: Game1.cs プロジェクト: scrachatron/Babelon
        protected override void Initialize()
        {
            Pixelclass.Content = Content;

            Actor.Dimentions = new Point(32, 32);
            Level.m_LayerSize = Actor.Dimentions;
            m_level = new Level();
            m_Player = new Player();
            m_input = new InputManager();
            m_cam = new Camera(GraphicsDevice.Viewport);

            base.Initialize();
            
            //m_level.m_mazeGen.GenerateMaze(new MazeInfo(new Point(65, 65), 10, 2, 2, 100));
            m_Player.VirtualPosition = m_level.m_StartPos;

        }
コード例 #3
0
ファイル: Actor.cs プロジェクト: scrachatron/Babelon
        private void Collision(Level lvl)
        {
            if (MoveHere.X != 0 && MoveHere.Y != 0)
            {
                Point tmp = new Point(0, 0);
                if (lvl.Map[VirtualPosition.X + MoveHere.X, VirtualPosition.Y] == 0)
                {
                    tmp.X = MoveHere.X;
                }
                if (lvl.Map[VirtualPosition.X, VirtualPosition.Y + MoveHere.Y] == 0)
                {
                    tmp.Y = MoveHere.Y;
                }
                if (lvl.Map[VirtualPosition.X + tmp.X, VirtualPosition.Y + tmp.Y] == 0)
                {
                    m_virtualpos += tmp;
                    m_targetPos = (m_virtualpos * lvl.LayerSize);

                    return;
                }


            }
            else if (lvl.Map[VirtualPosition.X + MoveHere.X, VirtualPosition.Y + MoveHere.Y] == 0)
            {
                m_virtualpos += MoveHere;
                m_targetPos = (m_virtualpos * lvl.LayerSize);

                return;
            }
        }
コード例 #4
0
ファイル: Actor.cs プロジェクト: scrachatron/Babelon
        public void UpdateMe(GameTime gt, Level level, InputManager input)
        {
            if (input.IsDown(Keys.Left))
                MoveHere.X += -1;
            if (input.IsDown(Keys.Right))
                MoveHere.X += 1;
            if (input.IsDown(Keys.Up))
                MoveHere.Y += -1;
            if (input.IsDown(Keys.Down))
                MoveHere.Y += 1;

            base.UpdateMe(gt, level);
        }
コード例 #5
0
ファイル: MapEdit.cs プロジェクト: scrachatron/Babelon
        //public bool CreateLayer(int[,] ColMap)
        //{
        //    if (new Point(ColMap.GetLength(1), ColMap.GetLength(0)) == m_LayerSize)
        //    {
        //        m_SimpleLayer.Add(ColMap);
        //        return true;
        //    }
        //    else
        //        throw new SystemException("The current map does not have the same dimentions it excpects");
        //    //return false;
        //}
        //public void AddLayer()
        //{
        //    m_SimpleLayer.Add(new int[m_LayerSize.X, m_LayerSize.Y]);
        //}

        public void Reset()
        {
            levelCreate = new Level();
            MapChanged = true;
        }
コード例 #6
0
ファイル: MapEdit.cs プロジェクト: scrachatron/Babelon
        public MapEdit()
        {
            levelCreate = new Level();

            help = true;
        }