Ejemplo n.º 1
0
    public void GoToPage(PageType pageType)
    {
        RXDebug.Log("Here i am changing the page");
        if (_currentPageType == pageType)
        {
            return;
        }

        Page pageToCreate = null;

        if (pageType == PageType.MenuPage)
        {
            pageToCreate = new MenuPage();
        }
        if (pageType == PageType.InGamePage)
        {
            pageToCreate = new InGamePage();
        }

        if (pageToCreate != null)
        {
            _currentPageType = pageType;

            if (_currentPage != null)
            {
                _stage.RemoveChild(_currentPage);
            }

            _currentPage = pageToCreate;
            _stage.AddChild(_currentPage);
            _currentPage.Start();
        }
    }
Ejemplo n.º 2
0
    public void GoToPage(PageType pageType)
    {
        Page pageToCreate = null;

        if(pageType == PageType.MainMenuPage)
        {
            pageToCreate = new MainMenuPage();
        }

        if(pageType == PageType.InGamePage)
        {
            pageToCreate = new InGamePage();
        }

        if(pageToCreate != null)
        {
            _currentPageType = pageType;

            if(_currentPage != null)
            {
                _stage.RemoveChild(_currentPage);
            }

            _currentPage = pageToCreate;
            _stage.AddChild(_currentPage);
            _currentPage.Start();

        }
    }
Ejemplo n.º 3
0
    public void GoToPage(TPageType pageType)
    {
        if(_currentPageType == pageType) return; //we're already on the same page, so don't bother doing anything

        TPage pageToCreate = null;

        if(pageType == TPageType.PagePlayerSelect)
        {
            pageToCreate = new PlayerSelectPage();
        }
        else if (pageType == TPageType.PageInGame)
        {
            pageToCreate = new InGamePage();
        }
        else if (pageType == TPageType.PageResults)
        {
            pageToCreate = new PlayerSelectPage();
        }

        if(pageToCreate != null) //destroy the old page and create a new one
        {
            _currentPageType = pageType;

            if(_currentPage != null)
            {
                _currentPage.Destroy();
                _stage.RemoveChild(_currentPage);
            }

            _currentPage = pageToCreate;
            _stage.AddChild(_currentPage);
            _currentPage.Start();
        }
    }
Ejemplo n.º 4
0
    public void GoToPage(PageType pageType)
    {
        RXDebug.Log("Here i am changing the page");
        if(_currentPageType == pageType) return;

        Page pageToCreate = null;

        if(pageType == PageType.MenuPage)
        {
            pageToCreate = new MenuPage();
        }
        if(pageType == PageType.InGamePage)
        {
            pageToCreate = new InGamePage();
        }

        if(pageToCreate != null)
        {
            _currentPageType = pageType;

            if(_currentPage != null)
            {
                _stage.RemoveChild(_currentPage);
            }

            _currentPage = pageToCreate;
            _stage.AddChild(_currentPage);
            _currentPage.Start();

        }
    }
Ejemplo n.º 5
0
Archivo: Main.cs Proyecto: jrendel/LD27
    public void GoToPage(PageType pageType)
    {
        if(_currentPageType == pageType) return; //we're already on the same page, so don't bother doing anything

        BasePage pageToCreate = null;

        if(pageType == PageType.TitlePage)
        {
            pageToCreate = new TitlePage();
        }
        if(pageType == PageType.InGamePage)
        {
            pageToCreate = new InGamePage();
        }
        else if (pageType == PageType.ScorePage)
        {
            pageToCreate = new ScorePage();
        }

        if(pageToCreate != null) //destroy the old page and create a new one
        {
            _currentPageType = pageType;

            if(_currentPage != null)
            {
                _currentPage.Destroy();
                _stage.RemoveChild(_currentPage);
            }

            _currentPage = pageToCreate;
            _stage.AddChild(_currentPage);
            _currentPage.Start();
        }
    }
Ejemplo n.º 6
0
    public void GoToPage(PageType pageType)
    {
        Page pageToCreate = null;

        if (pageType == PageType.MainMenuPage)
        {
            pageToCreate = new MainMenuPage();
        }

        if (pageType == PageType.InGamePage)
        {
            pageToCreate = new InGamePage();
        }

        if (pageToCreate != null)
        {
            _currentPageType = pageType;

            if (_currentPage != null)
            {
                _stage.RemoveChild(_currentPage);
            }

            _currentPage = pageToCreate;
            _stage.AddChild(_currentPage);
            _currentPage.Start();
        }
    }
Ejemplo n.º 7
0
    public void GoToPage(BPageType pageType)
    {
        if(_currentPageType == pageType) {
            return;
        } //we're already on the same page, so don't bother doing anything

        BPage pageToCreate = null;

        if(pageType == BPageType.MenuPage) {
            pageToCreate = new MenuPage();
        }else if(pageType == BPageType.InGamePage) {
            pageToCreate = new InGamePage();
        }

        if(pageToCreate != null) { //destroy the old page and create a new one
            _currentPageType = pageType;

            if(_currentPage != null) {
                _stage.RemoveChild(_currentPage);
            }

            _currentPage = pageToCreate;
            _stage.AddChild(_currentPage);
            _currentPage.Start();
        }
    }
Ejemplo n.º 8
0
    public void GoToPage(BPageType pageType)
    {
        if (_currentPageType == pageType)
        {
            return;
        } //we're already on the same page, so don't bother doing anything

        BPage pageToCreate = null;

        if (pageType == BPageType.MenuPage)
        {
            pageToCreate = new MenuPage();
        }
        else if (pageType == BPageType.InGamePage)
        {
            pageToCreate = new InGamePage();
        }

        if (pageToCreate != null)  //destroy the old page and create a new one
        {
            _currentPageType = pageType;

            if (_currentPage != null)
            {
                _stage.RemoveChild(_currentPage);
            }

            _currentPage = pageToCreate;
            _stage.AddChild(_currentPage);
            _currentPage.Start();
        }
    }
Ejemplo n.º 9
0
 public void destroyShip()
 {
     this.RemoveFromContainer();
     healthBar.RemoveFromContainer();
     energyBar.RemoveFromContainer();
     InGamePage.LivingPlayers[player - 1] = false;
     InGamePage.checkForWin();
 }
Ejemplo n.º 10
0
    public void Init(Vector2 startPos, InGamePage container)
    {
        gameObject.transform.position = new Vector3(startPos.x * FPhysics.POINTS_TO_METERS, startPos.y * FPhysics.POINTS_TO_METERS, 0);

        sprite = new FSprite(Futile.atlasManager.GetElementWithName("man"));
        sprite.SetPosition(startPos);

        container.persons.AddChild(holder = new FContainer());
        holder.AddChild(sprite);

        InitPhysics();

        holder.ListenForUpdate(HandleUpdate);
    }
Ejemplo n.º 11
0
    public InGamePage()
    {
        instance = this;

        if (DogfighterMain.instance.musicOn == true)
        {
            FSoundManager.PlayMusic("Music/Corneria", 0.2f);
        }

        background = new FSprite("Original_Starfield.png");
        // eventually this will change to 1080
        background.scaleY = (Futile.screen.height / 1050.0f);
        // eventually this will change to 1920
        background.scaleX = (Futile.screen.width / 1680.0f);
        AddChild(background);

        /* Removed for HTML release. */
        primaryFireButton                = new FButton("Holding_Circle_Unselected.png");
        primaryFireButton.x              = 25 - (Futile.screen.width / 2);
        primaryFireButton.y              = 25 - (Futile.screen.height / 2);
        primaryFireButton.scale          = 0.25f;
        primaryFireButton.SignalPress   += primaryFireButtonPress;
        primaryFireButton.SignalRelease += primaryFireButtonRelease;
        AddChild(primaryFireButton);

        secondaryFireButton                = new FButton("Holding_Circle_Selected.png");
        secondaryFireButton.x              = (Futile.screen.width / 2) - 25;
        secondaryFireButton.y              = 25 - (Futile.screen.height / 2);
        secondaryFireButton.scale          = 0.25f;
        secondaryFireButton.SignalPress   += secondaryFireButtonPress;
        secondaryFireButton.SignalRelease += secondaryFireButtonRelease;
        AddChild(secondaryFireButton);

        for (int i = 0; i < numPlayers; i++)
        {
            LivingPlayers.Add(true);
        }
        playersLeft = numPlayers;

        escapeMenu   = new FLabel("FranchiseFont_Scale1", "Press back to return to menu");
        escapeMenu.y = -(Futile.screen.halfHeight / 2);

        asteroidRate   = (40 * ShipSelect.instance.getAsteroidRate());
        spawnAsteroids = ShipSelect.instance.getSpawnAsteroids();
        CreateShips();

        frameCount = 0;

        baseRotation = Input.acceleration;
    }
Ejemplo n.º 12
0
 public static Projectile Create(InGamePage world, Vector2 pos, Vector2 Aceleration, FSprite sprite)
 {
     GameObject GObj = new GameObject("Bullet");
     Projectile body = GObj.AddComponent<Projectile>();
     body.GamePage = world;
     body.Position=pos;
     body.Aceleration=Aceleration;
     body.Size=new Vector2(8,5);
     body.Sprite = new FSprite("Futile_White");
     Color cl =new Color(80,90,0,1);
     body.Sprite.color=cl;
     body.Sprite.width = body.Size.x;
     body.Sprite.height = body.Size.y;
     return body;
 }
Ejemplo n.º 13
0
 public static Platform Create(InGamePage world, Vector2 pos, float angulo, Vector2 size, FSprite sprite, string name)
 {
     GameObject GObj = new GameObject(name);
     Platform body = GObj.AddComponent<Platform>();
     body.GamePage = world;
     body.Position=pos;
     body.Size=size;
     body.Sprite = sprite;
     body.Sprite.width = size.x;
     body.Sprite.height = size.y;
     if(name.Equals("Bottom")){
     Color cl =new Color(250,0,0,1);
     body.Sprite.color=cl;}
     body.Rotation=angulo;
     body.transform.Rotate(new Vector3(0,0,angulo));
     return body;
 }
Ejemplo n.º 14
0
    public static Projectile Create(InGamePage world, Vector2 pos, Vector2 Aceleration, FSprite sprite)
    {
        GameObject GObj = new GameObject("Bullet");
        Projectile body = GObj.AddComponent <Projectile>();

        body.GamePage    = world;
        body.Position    = pos;
        body.Aceleration = Aceleration;
        body.Size        = new Vector2(8, 5);
        body.Sprite      = new FSprite("Futile_White");
        Color cl = new Color(80, 90, 0, 1);

        body.Sprite.color  = cl;
        body.Sprite.width  = body.Size.x;
        body.Sprite.height = body.Size.y;
        return(body);
    }
Ejemplo n.º 15
0
    public static Enemy Create(InGamePage world, Vector2 pos, int direction)
    {
        GameObject GObj = new GameObject("Enemy");
        Enemy body = GObj.AddComponent<Enemy>();
        body.GamePage = world;
        body.Position=pos;
        body.Size=new Vector2(80,80);
        body.Sprite = new FSprite("Futile_White");
        Color cl =new Color(0,0,90,1);
        body.Sprite.color=cl;
        body.Sprite.width = body.Size.x;
        body.Sprite.height = body.Size.y;
        body.direction=direction;
        body.life=3;
        body.sprite = new FAnimatedSprite(new FAnimation("enewalk","enewalk",80,80,0,0,2,120,true));

        return body;
    }
Ejemplo n.º 16
0
    public static Player Create(InGamePage world, Vector2 pos)
    {
        GameObject GObj = new GameObject("JumpMan");
        Player body = GObj.AddComponent<Player>();
        body.GamePage = world;
        body.Position=pos;
        body.Size=new Vector2(40,40);
        body.Sprite = new FSprite("Futile_White");
        Color cl =new Color(0,90,0,1);
        body.Sprite.color=cl;
        body.Sprite.width = body.Size.x;
        body.Sprite.height = body.Size.y;

        body.sprite = new FAnimatedSprite(new FAnimation("standing","standing",40,40,0,0,2,120,true));
        body.sprite.addAnimation(new FAnimation("walking","standing",40,40,0,1,2,120,true));

        return body;
    }
Ejemplo n.º 17
0
    public static Enemy Create(InGamePage world, Vector2 pos, int direction)
    {
        GameObject GObj = new GameObject("Enemy");
        Enemy      body = GObj.AddComponent <Enemy>();

        body.GamePage = world;
        body.Position = pos;
        body.Size     = new Vector2(80, 80);
        body.Sprite   = new FSprite("Futile_White");
        Color cl = new Color(0, 0, 90, 1);

        body.Sprite.color  = cl;
        body.Sprite.width  = body.Size.x;
        body.Sprite.height = body.Size.y;
        body.direction     = direction;
        body.life          = 3;
        body.sprite        = new FAnimatedSprite(new FAnimation("enewalk", "enewalk", 80, 80, 0, 0, 2, 120, true));

        return(body);
    }
Ejemplo n.º 18
0
    public static Player Create(InGamePage world, Vector2 pos)
    {
        GameObject GObj = new GameObject("JumpMan");
        Player     body = GObj.AddComponent <Player>();

        body.GamePage = world;
        body.Position = pos;
        body.Size     = new Vector2(40, 40);
        body.Sprite   = new FSprite("Futile_White");
        Color cl = new Color(0, 90, 0, 1);

        body.Sprite.color  = cl;
        body.Sprite.width  = body.Size.x;
        body.Sprite.height = body.Size.y;

        body.sprite = new FAnimatedSprite(new FAnimation("standing", "standing", 40, 40, 0, 0, 2, 120, true));
        body.sprite.addAnimation(new FAnimation("walking", "standing", 40, 40, 0, 1, 2, 120, true));

        return(body);
    }
Ejemplo n.º 19
0
    public static Platform Create(InGamePage world, Vector2 pos, float angulo, Vector2 size, FSprite sprite, string name)
    {
        GameObject GObj = new GameObject(name);
        Platform   body = GObj.AddComponent <Platform>();

        body.GamePage      = world;
        body.Position      = pos;
        body.Size          = size;
        body.Sprite        = sprite;
        body.Sprite.width  = size.x;
        body.Sprite.height = size.y;
        if (name.Equals("Bottom"))
        {
            Color cl = new Color(250, 0, 0, 1);
            body.Sprite.color = cl;
        }
        body.Rotation = angulo;
        body.transform.Rotate(new Vector3(0, 0, angulo));
        return(body);
    }
Ejemplo n.º 20
0
    public InGamePage()
    {
        FSprite bg = new FSprite("Atlases/bg");

        bg.width  = Futile.screen.width;
        bg.height = Futile.screen.height;
        AddChild(bg);
        hudStuff        = new FLabel("Minecraftia", "Energy:");
        hudShadow       = new FLabel("Minecraftia", "Energy:");
        hudStuff.scale  = 0.7f;
        hudShadow.scale = 0.7f;
        hudShadow.color = Color.black;
        hudStuff.SetPosition(new Vector2(0, (Futile.screen.height / 2) * 0.9f));
        hudShadow.SetPosition(new Vector2(1f, ((Futile.screen.height / 2) * 0.9f - 1)));


        gameArea            = new FContainer();
        enemies             = new List <Entity>();
        projectiles         = new List <Entity>();
        Enemyprojectiles    = new List <Entity>();
        entityContainer     = new FContainer();
        projectileContainer = new FContainer();
        particleContainer   = new FContainer();
        gameArea.AddChild(particleContainer);
        particleContainer.AddChild(projectilesParticles = new FParticleSystem(300));

        gameArea.AddChild(entityContainer);
        gameArea.AddChild(projectileContainer);
        AddChild(gameArea);
        InGamePage.CurrentInGamePage = this;
        ListenForUpdate(Update);
        jugador = new Player();
        GenerateFoe();

        AddChild(hudShadow);
        AddChild(hudStuff);
    }