private bool isWall()
        {
            GameAppFramework framework = GameAppFramework.GetGameAppFramework();
            bool             result    = false;

            if (GetPlayerX() <= 0)
            {
                _wall  = true;
                result = true;
            }

            else if (GetPlayerX() + 50 >= framework.Device.Viewport.Width)
            {
                _wall  = true;
                result = true;
            }
            else if (GetPlayerY() <= 0)
            {
                _wall  = true;
                result = true;
            }
            else if (GetPlayerY() >= framework.Device.Viewport.Height)
            {
                _wall  = true;
                result = true;
            }
            return(result);
        }
Esempio n. 2
0
        private void init()
        {
            Task <Resource> loadTask = ResourceManager.CreateResource().GetResource("back.jpg");

            background = ((TextureResource)loadTask.GetAwaiter().GetResult()).GetTexture();
            System.Drawing.Font f = new System.Drawing.Font("Arial Black", 50);
            font = new Microsoft.DirectX.Direct3D.Font(GameAppFramework.GetGameAppFramework().Device, f);
        }
Esempio n. 3
0
 public static GameAppFramework GetGameAppFramework()
 {
     if (_gameframework == null)
     {
         _gameframework = new GameAppFramework();
     }
     return(_gameframework);
 }
 public static ScoreManager GetScoreManager()
 {
     if (_scoreManager == null)
     {
         _scoreManager = new ScoreManager(GameAppFramework.GetGameAppFramework().Device);
     }
     return(_scoreManager);
 }
 public static PlayerManager CreatePlayerManager()
 {
     if (_playermanager == null)
     {
         _playermanager = new PlayerManager(GameAppFramework.GetGameAppFramework().Device);
     }
     return(_playermanager);
 }
Esempio n. 6
0
        StickManager()
        {
            Task <Resource> loadTask = ResourceManager.CreateResource().GetResource("stick2.png");

            _stick         = ((TextureResource)loadTask.GetAwaiter().GetResult()).GetTexture();
            _x             = (GameAppFramework.GetGameAppFramework().Device.Viewport.Width / 2) - 70;
            _y             = (GameAppFramework.GetGameAppFramework().Device.Viewport.Height) - 130;
            _playermanager = PlayerManager.CreatePlayerManager();
        }
Esempio n. 7
0
        GameApp()
        {
            InitializeComponent();
            GameAppFramework.GetGameAppFramework().InitializeFormSize();
            var afmeAppFrameWork = GameAppFramework.GetGameAppFramework();

            afmeAppFrameWork.InitializeDevice(this);
            IOManager.GetIOManager().ReadFile();
            GameAppFramework.GetGameAppFramework().DeviceColor =
                System.Drawing.Color.FromName(IOManager.GetIOManager().DeviceColor);
            // MessageBox.Show(IOManager.GetIOManager().DeviceColor);
        }
Esempio n. 8
0
 public void  RenderStick()
 {
     using (Sprite drawStick = new Sprite(GameAppFramework.GetGameAppFramework().Device))
     {
         drawStick.Begin(SpriteFlags.AlphaBlend);
         Matrix matrix = new Matrix();
         matrix = Matrix.Transformation2D(new Vector2(0, 0), 0f, new Vector2(1.0f, 1.0f), new Vector2(_x + 45, _y + 100), _rotationAngle, new Vector2(0, 0));
         drawStick.Transform = matrix;
         drawStick.Draw(_stick, new Rectangle(0, 0, 0, 0), new Vector3(0, 0, 0), new Vector3(_x, _y, 0), Color.White);
         drawStick.End();
     }
 }
        public void CreateNewPlayer()
        {
            _player = null;
            Random r            = new Random();
            int    randomMoodie = 1;

            randomMoodie = r.Next(1, 5);
            string          image    = "image" + randomMoodie + ".png";
            Task <Resource> loadTask = ResourceManager.CreateResource().GetResource(image);

            _player = new Moodie(((TextureResource)loadTask.GetAwaiter().GetResult()).GetTexture(),
                                 (GameAppFramework.GetGameAppFramework().Device.Viewport.Width / 2) - 60,
                                 GameAppFramework.GetGameAppFramework().Device.Viewport.Height - 185, randomMoodie);
            Playerstartx = GetPlayerX();
            _wall        = false;
        }
Esempio n. 10
0
        private void GameLoop()
        {
            while (true)
            {
                GameAppFramework.GetGameAppFramework().Render();
                GameAppFramework.GetGameAppFramework().Update(this);

                if (Environment.TickCount > Timestarted + 60)
                {
                    Fps         = Frames;
                    Frames      = 0;
                    Timestarted = Environment.TickCount;
                }
                Frames++;
            }
        }
        List <Moodie> CreateSublist(int x, int y)
        {
            int           devicesize = GameAppFramework.GetGameAppFramework().Device.Viewport.Width;
            Random        r          = new Random();
            string        image;
            List <Moodie> sublist = new List <Moodie>();

            while (x + 50 < devicesize)
            {
                var randomMoodie = r.Next(1, 5);
                image = "image" + randomMoodie + ".png";
                sublist.Add(new Moodie(TextureLoader.FromFile(GameAppFramework.GetGameAppFramework().Device, image), x, y, randomMoodie));
                x += 50;
            }
            return(sublist);
        }
Esempio n. 12
0
        public void DrawMoodie()
        {
            StickManager stick = StickManager.GetStick();

            using (Sprite DrawMoodie = new Sprite(GameAppFramework.GetGameAppFramework().Device))
            {
                try {
                    DrawMoodie.Begin(SpriteFlags.AlphaBlend);
                    Matrix matrix = new Matrix();
                    matrix = Matrix.Transformation2D(new Vector2(0, 0), 0f, new Vector2(1.0f, 1.0f), new Vector2(stick.X + 45, stick.Y + 100), 0.0f, new Vector2(0, 0));
                    DrawMoodie.Transform = matrix;
                    DrawMoodie.Draw(texture, new Rectangle(0, 0, 0, 0), new Vector3(0, 0, 0), new Vector3(x, y, 0), Color.White);
                    DrawMoodie.End();
                }
                catch (Exception e) { }
            }
        }
Esempio n. 13
0
        public void Render()
        {
            Device device = GameAppFramework.GetGameAppFramework().Device;

            foreach (var moodie in hangingMoodies)
            {
                if (moodie.GetYCoordinate() < device.Viewport.Height)
                {
                    moodie.SetYCoordinate(moodie.GetYCoordinate() - 1);
                    moodie.DrawMoodie();
                }
                else
                {
                    hangingMoodies.Remove(moodie);
                }
            }
        }
Esempio n. 14
0
        public virtual void Render()
        {
            try
            {
                var device = GameAppFramework.GetGameAppFramework().Device;
                device.Clear(ClearFlags.Target, Color.HotPink, 0, 1);
                device.BeginScene();
                using (Sprite MenuSprite = new Sprite(device))
                {
                    MenuSprite.Begin(SpriteFlags.AlphaBlend);
                    MenuSprite.Draw2D(background, new Rectangle(0, 0, 0, 0), new Rectangle(0, 0, device.Viewport.Width, device.Viewport.Height), new Point(0, 0), 0f, new Point(0, 0), Color.White);
                    font.DrawText(MenuSprite, "EXITING................", new Point((device.Viewport.Width / 2) - 200, device.Viewport.Height / 2), Color.White);
                    MenuSprite.End();
                }

                device.EndScene();
                device.Present();
            }
            catch (Exception e) { };
        }
Esempio n. 15
0
        public void Render()
        {
            try
            {
                Microsoft.DirectX.Direct3D.Device device = GameAppFramework.GetGameAppFramework().Device;
                device.Clear(ClearFlags.Target, Color.HotPink, 0, 1);
                device.BeginScene();
                using (Sprite MenuSprite = new Sprite(device))
                {
                    MenuSprite.Begin(SpriteFlags.AlphaBlend);
                    MenuSprite.Draw2D(background, new Rectangle(0, 0, 0, 0), new Rectangle(0, 0, device.Viewport.Width, device.Viewport.Height), new Point(0, 0), 0f, new Point(0, 0), Color.White);
                    font.DrawText(MenuSprite, "Press Space to START", new Point((device.Viewport.Width / 2) - 200, device.Viewport.Height / 2), Color.White);
                    font.DrawText(MenuSprite, "Press Escape to END", new Point((device.Viewport.Width / 2) - 200, (device.Viewport.Height / 2) + 100), Color.White);
                    MenuSprite.End();
                }

                device.EndScene();
                device.Present();
            }
            catch (Exception e) { };
        }
Esempio n. 16
0
 public void Render()
 {
     GameAppFramework.GetGameAppFramework().RenderWholeWorld();
 }
Esempio n. 17
0
 public void LoadResource(string path)
 {
     _texture = TextureLoader.FromFile(GameAppFramework.GetGameAppFramework().Device, path);
 }