예제 #1
0
파일: Test.cs 프로젝트: cbdix92/GameEngine
        static void Main(string[] args)
        {
            Display.DisplaySize(80, 80);

            Scene scene1 = new Scene();

            Gameobject ball = scene1.AddGameobject("ball");

            ball.AddComponet("ball_image", new Image("O"));
            ball.transform.Teleport(5, 5);
            Background background1 = scene1.AddBackground(0, "background1");

            background1.FillBackground(new Image("_"));
        }
예제 #2
0
        private void GenEnemies()
        {
            Texture2D enemyTexture = Loader.GetTexture("invader_blue");//cache the texture

            for (int x = 0; x < enemiesWide; x++)
            {
                for (int y = 0; y < enemiesHight; y++)
                {
                    Vector2    _scale = new Vector2(75f, 75f);                                             //scale(size)
                    float      xPos   = ((_scale.X + spacing) * x) + 100f;                                 //calculate x position
                    float      yPos   = ((_scale.Y + spacing) * y) + 100f;                                 //calculate y position
                    GameObject enemy  = new Enemy(enemyTexture, new Vector2(xPos, yPos), _scale, "Enemy"); //make a new enemy
                    gameScene.AddGameobject(enemy);                                                        //adding enemy to the game scene
                    enemyList.Add(enemy);                                                                  //add enemy to this list so we can easily count them later
                }
            }
        }