//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(); //Creates two actors to add to our scene Goal goal = new Goal(5, 5, Color.GREEN, '■', ConsoleColor.Green); Enemy enemy = new Enemy(2, 1, scene1, Color.GREEN, '■', ConsoleColor.Green); Player player = new Player(0, 1, scene1, Color.BLUE, '@', ConsoleColor.Red); enemy.Target = player; scene1.AddActor(player); scene1.AddActor(goal); scene1.AddActor(enemy); scene2.AddActor(player); player.Speed = 5; int startingSceneIndex = 0; startingSceneIndex = AddScene(scene1); AddScene(scene2); SetCurrentScene(startingSceneIndex); player.SetScale(1, 2); player.SetRotation(0.5f); player.SetTranslate(new Vector2(10, 10)); goal.SetTranslate(new Vector2(5, 5)); goal.SetScale(3.5f, 3.5f); player.AddChild(enemy); }
//Called when the game begins. Use this for initialization. public void Start() { //Creates a new window for raylib Raylib.InitWindow(1920, 1080, "Math For Games"); Raylib.SetTargetFPS(30); //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 Enemy enemyHigh = new Enemy(0, 5, Color.GREEN, new Vector2(0, 10), new Vector2(60, 5), ' ', ConsoleColor.Green); Enemy enemyMid = new Enemy(10, 10, Color.GREEN, new Vector2(0, 20), new Vector2(60, 10), ' ', ConsoleColor.Green); Enemy enemyLow = new Enemy(3, 20, Color.GREEN, new Vector2(0, 30), new Vector2(60, 20), ' ', ConsoleColor.Green); Player player = new Player(0, 0, Color.YELLOW, ' ', ConsoleColor.Red); Goal goal = new Goal(70, 70, Color.GREEN, player, '!', ConsoleColor.Green); //Initialize the enmies starting values enemyHigh.Speed = 1; enemyMid.Speed = 1; enemyLow.Speed = 1; enemyHigh.Target = player; enemyMid.Target = player; enemyLow.Target = player; enemyHigh.SetTranslate(new Vector2(15, 15)); enemyMid.SetTranslate(new Vector2(20, 20)); enemyLow.SetTranslate(new Vector2(25, 25)); enemyHigh.SetRotation(1); enemyMid.SetRotation(2); enemyLow.SetRotation(3); enemyHigh.SetScale(1, 1); enemyMid.SetScale(2, 2); enemyLow.SetScale(3, 3); //Set player's starting speed player.Speed = 3; player.SetTranslate(new Vector2(10, 10)); player.SetRotation(1); player.SetScale(2, 3); //Goal goal.SetTranslate(new Vector2(30, 30)); //Add actors to the scenes scene1.AddActor(player); scene1.AddActor(goal); scene1.AddActor(enemyHigh); scene1.AddActor(enemyMid); scene1.AddActor(enemyLow); scene2.AddActor(player); // ! Space ! // Earth earth = new Earth(10, 10, Color.GREEN, ' ', ConsoleColor.Green); Sun sun = new Sun(50, 25, Color.YELLOW, ' ', ConsoleColor.Red); //Initialize the enmies starting values earth.Speed = 1; earth.SetScale(1, 1); earth.SetRotation(1); earth.SetTranslate(0, 1); earth.Target = player; //Set sun's starting speed sun.Speed = 2; sun.SetTranslate(new Vector2(30, 10)); sun.SetRotation(1); sun.SetScale(6, 6); sun.AddChild(earth); //Add actors to the scenes scene1.AddActor(sun); //scene1.AddActor(goal); scene1.AddActor(earth); //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); }