Exemple #1
0
        //Called when the game begins. Use this for initialization.
        public void Start()
        {
            //Creates a new window for raylib
            Raylib.InitWindow(1024, 760, "Math For Games");
            Raylib.SetTargetFPS(60);

            //Set up console window
            Console.CursorVisible = false;
            Console.Title         = "Math For Games";

            //Create a new scene for our actors to exist in
            Scene scene1 = new Scene();
            Scene scene2 = new Scene();

            //Create the actors to add to our scene
            Actor  actor  = new Actor(0, 0, Color.GREEN, '■', ConsoleColor.Green);
            Enemy  enemy  = new Enemy(10, 10, Color.GREEN, '■', ConsoleColor.Green);
            Player player = new Player(0, 1, Color.BLUE, '@', ConsoleColor.Red);
            Map1   map    = new Map1(15.90f, 11.80f, ' ');

            actor.Velocity.X = 1;
            enemy.Target     = player;
            //enemy.SetTranslation(new Vector2(5, 0));
            player.Speed = 5;
            player.SetTranslation(new Vector2(10, 10));
            player.AddChild(enemy);
            //player.SetRotation(1);
            player.SetScale(6, 6);
            map.SetScale(31, 23.49f);
            //Add actors to the scenes
            scene1.AddActor(map);

            scene1.AddActor(player);
            scene1.AddActor(actor);
            scene1.AddActor(enemy);
            scene2.AddActor(player);


            //Sets the starting scene index and adds the scenes to the scenes array
            int startingSceneIndex = 0;

            startingSceneIndex = AddScene(scene1);
            AddScene(scene2);

            //Sets the current scene to be the starting scene index
            SetCurrentScene(startingSceneIndex);
        }