SetAnchor() public method

public SetAnchor ( Vector2, newAnchor ) : void
newAnchor Vector2,
return void
Ejemplo n.º 1
0
    override public void Start()
    {
        root         = FPWorld.Create(64.0f);
        screenCenter = new Vector2(Futile.screen.halfWidth, Futile.screen.halfHeight);
        ListenForUpdate(Update);
        _gameObjects = new FContainer();
        AddChild(_gameObjects);
        _enemyContainer = new FContainer();
        AddChild(_enemyContainer);
        AddChild(impactParticles      = new FParticleSystem(40));
        AddChild(projectilesParticles = new FParticleSystem(300));
        _playerBullets = new FContainer();
        AddChild(_playerBullets);

        t = Time.time;

        CreateWorld();
        InitPlayer();
        scoreLabel = new FLabel("font", "Score = " + Score);
        gameOver   = new FLabel("font", "Game Over, press 'R' to try again!");
        scoreLabel.SetAnchor(new Vector2(0, -10));
        AddChild(scoreLabel);

        FSoundManager.PlayMusic("Barymag");
        FSoundManager.isMuted = false;
    }
Ejemplo n.º 2
0
    void SetupUI()
    {
        FStage uiStage = new FStage("uiStage");

        timer    = new FLabel("Abstract", st.TimeStamp);
        bestTime = new FLabel("Abstract", "Best:\n" + st.TimeStamp);
        timer.SetAnchor(0, 1);
        timer.scale = 3;
        bestTime.SetAnchor(0, 1);
        bestTime.x     = Futile.screen.width - bestTime.textRect.width * 3;
        bestTime.scale = 3;
        uiStage.AddChild(timer);
        uiStage.AddChild(bestTime);
        Futile.AddStage(uiStage);
    }
Ejemplo n.º 3
0
    public override void Start()
    {
        background = new ColourBackground();
        this.AddChild(background);

        terrain = new TweenTerrain();
        this.AddChild(terrain);
        Futile.atlasManager.LoadImage("player");
        player = new BasePlayer("player");
        player.y = Futile.screen.halfHeight;
        this.AddChild(player);

        timerLabel = new FLabel("Abstract", "LOSE");
        timerLabel.scale *= 4;
        timerLabel.color = Color.gray;
        timerLabel.alpha = 0;
        timerLabel.SetAnchor(0.5f, 0.5f);
        AddChild(timerLabel);
    }
Ejemplo n.º 4
0
    override public void Start()
    {
        Main.instance.crewSaved    = 0;
        Main.instance.gameFinished = false;

        FSprite background = new FSprite("viewport");

        background.SetAnchor(0.0f, 0.0f);
        AddChild(background);

        _introLabel       = new FLabel("Emulogic", "");
        _introLabel.color = Color.black;         //Color.green; // new Color(0.173f, 0.722f, 0.976f, 1.0f);
        _introLabel.scale = 0.2f;
        _introLabel.SetAnchor(0.0f, 1.0f);
        _introLabel.SetPosition(60, Futile.screen.height - 14);

        AddChild(_introLabel);

        _titleLabel       = new FLabel("Emulogic", "");
        _titleLabel.color = Color.black;
        _titleLabel.scale = 1.0f;
        _titleLabel.SetAnchor(0.0f, 1.0f);
        _titleLabel.SetPosition(200, 550);

        AddChild(_titleLabel);

        _finalLabel       = new FLabel("Emulogic", "");
        _finalLabel.color = Color.black;         //Color.green;
        _finalLabel.scale = 0.2f;
        _finalLabel.SetAnchor(0.0f, 1.0f);
        _finalLabel.SetPosition(575, 400);

        AddChild(_finalLabel);

        if (!Main.instance.playIntro)
        {
            _introLabel.text = _introText;
            _titleLabel.text = _titleText;
            _finalLabel.text = _finalText;
        }

        _startButton = new FButton("buttonWide");
        _startButton.AddLabel("Emulogic", "Play!", Color.black);        //new Color(0.45f,0.25f,0.0f,1.0f)
        _startButton.label.scale = 0.25f;
        _startButton.SetPosition(Futile.screen.width - 225, 155);
        AddChild(_startButton);

        _startButton.SignalRelease += HandleStartButtonRelease;

        _creditsButton = new FButton("buttonWide");
        _creditsButton.AddLabel("Emulogic", "About", Color.black);        //new Color(0.45f,0.25f,0.0f,1.0f)
        _creditsButton.label.scale = 0.25f;
        _creditsButton.SetPosition(Futile.screen.width - 225, 75);
        AddChild(_creditsButton);

        _creditsButton.SignalRelease += HandleCreditsButtonRelease;

        _lastTextUpdate = Main.GameTime;


        FSprite escapePod = new FSprite("escapePod");
        FSprite doors     = new FSprite("doorsIcon");
        FSprite crew      = new FSprite("floatingCharacter");
        FSprite clock     = new FSprite("moveTileIcon");

        //FSprite clock = new FSprite("clock4");

        escapePod.scale = 0.5f;
        doors.scale     = 0.5f;

        escapePod.SetPosition(140, 305);
        doors.SetPosition(140, 230);
        crew.SetPosition(140, 155);
        clock.SetPosition(140, 80);

        AddChild(escapePod);
        AddChild(doors);
        AddChild(crew);
        AddChild(clock);

        FLabel escapePodLabel = new FLabel("Emulogic", "Get the crew to \nthe escape pods!");

        escapePodLabel.color = Color.black;         //Color.green;
        escapePodLabel.scale = 0.15f;
        escapePodLabel.SetAnchor(0.0f, 0.5f);
        escapePodLabel.SetPosition(200, 305);
        AddChild(escapePodLabel);

        FLabel doorsLabel = new FLabel("Emulogic", "Touch doors to \nopen and close them.");

        doorsLabel.color = Color.black;         //Color.green;
        doorsLabel.scale = 0.15f;
        doorsLabel.SetAnchor(0.0f, 0.5f);
        doorsLabel.SetPosition(200, 230);
        AddChild(doorsLabel);

        FLabel crewLabel = new FLabel("Emulogic", "The Crew. They will walk \nthrough open doors, \nbut don't expect much else.");

        crewLabel.color = Color.black;         //Color.green;
        crewLabel.scale = 0.15f;
        crewLabel.SetAnchor(0.0f, 0.5f);
        crewLabel.SetPosition(200, 155);
        AddChild(crewLabel);

        FLabel clockLabel = new FLabel("Emulogic", "Place movement tiles \nto redirect the crew.");

        //FLabel clockLabel = new FLabel("Emulogic", "10 Seconds.");
        clockLabel.color = Color.black;         //Color.green;
        clockLabel.scale = 0.15f;
        clockLabel.SetAnchor(0.0f, 0.5f);
        clockLabel.SetPosition(200, 80);
        AddChild(clockLabel);
    }
Ejemplo n.º 5
0
    public override void Start()
    {
        Main.instance.crewSaved = 0;
        Main.instance.gameFinished = false;

        FSprite background = new FSprite("viewport");
        background.SetAnchor(0.0f, 0.0f);
        AddChild(background);

        _introLabel = new FLabel("Emulogic", "");
        _introLabel.color = Color.black; //Color.green; // new Color(0.173f, 0.722f, 0.976f, 1.0f);
        _introLabel.scale = 0.2f;
        _introLabel.SetAnchor(0.0f, 1.0f);
        _introLabel.SetPosition(60, Futile.screen.height - 14);

        AddChild(_introLabel);

        _titleLabel = new FLabel("Emulogic", "");
        _titleLabel.color = Color.black;
        _titleLabel.scale = 1.0f;
        _titleLabel.SetAnchor(0.0f, 1.0f);
        _titleLabel.SetPosition(200, 550);

        AddChild(_titleLabel);

        _finalLabel = new FLabel("Emulogic", "");
        _finalLabel.color = Color.black; //Color.green;
        _finalLabel.scale = 0.2f;
        _finalLabel.SetAnchor(0.0f, 1.0f);
        _finalLabel.SetPosition(575, 400);

        AddChild(_finalLabel);

        if (!Main.instance.playIntro){
            _introLabel.text = _introText;
            _titleLabel.text = _titleText;
            _finalLabel.text = _finalText;
        }

        _startButton = new FButton("buttonWide");
        _startButton.AddLabel("Emulogic","Play!",Color.black);  //new Color(0.45f,0.25f,0.0f,1.0f)
        _startButton.label.scale = 0.25f;
        _startButton.SetPosition(Futile.screen.width - 225, 155);
        AddChild(_startButton);

        _startButton.SignalRelease += HandleStartButtonRelease;

        _creditsButton = new FButton("buttonWide");
        _creditsButton.AddLabel("Emulogic","About",Color.black);  //new Color(0.45f,0.25f,0.0f,1.0f)
        _creditsButton.label.scale = 0.25f;
        _creditsButton.SetPosition(Futile.screen.width - 225, 75);
        AddChild(_creditsButton);

        _creditsButton.SignalRelease += HandleCreditsButtonRelease;

        _lastTextUpdate = Main.GameTime;

        FSprite escapePod = new FSprite("escapePod");
        FSprite doors = new FSprite("doorsIcon");
        FSprite crew = new FSprite("floatingCharacter");
        FSprite clock = new FSprite("moveTileIcon");
        //FSprite clock = new FSprite("clock4");

        escapePod.scale = 0.5f;
        doors.scale = 0.5f;

        escapePod.SetPosition(140, 305);
        doors.SetPosition(140, 230);
        crew.SetPosition(140, 155);
        clock.SetPosition(140, 80);

        AddChild(escapePod);
        AddChild(doors);
        AddChild(crew);
        AddChild(clock);

        FLabel escapePodLabel = new FLabel("Emulogic", "Get the crew to \nthe escape pods!");
        escapePodLabel.color = Color.black; //Color.green;
        escapePodLabel.scale = 0.15f;
        escapePodLabel.SetAnchor(0.0f, 0.5f);
        escapePodLabel.SetPosition(200, 305);
        AddChild(escapePodLabel);

        FLabel doorsLabel = new FLabel("Emulogic", "Touch doors to \nopen and close them.");
        doorsLabel.color = Color.black; //Color.green;
        doorsLabel.scale = 0.15f;
        doorsLabel.SetAnchor(0.0f, 0.5f);
        doorsLabel.SetPosition(200, 230);
        AddChild(doorsLabel);

        FLabel crewLabel = new FLabel("Emulogic", "The Crew. They will walk \nthrough open doors, \nbut don't expect much else.");
        crewLabel.color = Color.black; //Color.green;
        crewLabel.scale = 0.15f;
        crewLabel.SetAnchor(0.0f, 0.5f);
        crewLabel.SetPosition(200, 155);
        AddChild(crewLabel);

        FLabel clockLabel = new FLabel("Emulogic", "Place movement tiles \nto redirect the crew.");
        //FLabel clockLabel = new FLabel("Emulogic", "10 Seconds.");
        clockLabel.color = Color.black; //Color.green;
        clockLabel.scale = 0.15f;
        clockLabel.SetAnchor(0.0f, 0.5f);
        clockLabel.SetPosition(200, 80);
        AddChild(clockLabel);
    }
Ejemplo n.º 6
0
    public override void Start()
    {
        root = FPWorld.Create(64.0f);
        screenCenter=new Vector2(Futile.screen.halfWidth,Futile.screen.halfHeight);
        ListenForUpdate(Update);
        _gameObjects = new FContainer();
        AddChild(_gameObjects);
        _enemyContainer = new FContainer();
        AddChild(_enemyContainer);
        AddChild(impactParticles = new FParticleSystem(40));
        AddChild(projectilesParticles = new FParticleSystem(300));
        _playerBullets = new FContainer();
        AddChild(_playerBullets);

        t = Time.time;

        CreateWorld();
        InitPlayer();
        scoreLabel = new FLabel("font", "Score = "+ Score);
        gameOver = new FLabel("font", "Game Over, press 'R' to try again!");
        scoreLabel.SetAnchor(new Vector2(0,-10));
        AddChild(scoreLabel);

        FSoundManager.PlayMusic("Barymag");
        FSoundManager.isMuted=false;
    }
Ejemplo n.º 7
0
 public void SetAnchor(float anchorX, float anchorY)
 {
     mainLabel.SetAnchor(anchorX, anchorY);
     shadowLabel.SetAnchor(anchorX, anchorY);
 }
Ejemplo n.º 8
0
    public override void Start()
    {
        player1 = new Player(Color.red);
        player2 = new Player(Color.blue);
        background = new SpaceBackground();
        background.alpha = 0;
        this.AddChild(background);
        Go.to(background, 3f, new TweenConfig().setEaseType(EaseType.CircOut).floatProp("alpha", 1));

        showGrid(768, 768);

        CreateGameMap(768);
        AddChild(AllPlanets[0,0]);
        ClaimPlanet(AllPlanets[0,0], player1);
        AddChild(AllPlanets[11,11]);
        ClaimPlanet(AllPlanets[11,11], player2);

        resLabel = new FLabel("Abstract", "Resources");
        resLabel.SetAnchor(0.5f, 0);
        resLabel.scale *= 2;
        resLabel.y = -Futile.screen.halfHeight;
        AddChild(resLabel);
        costLabel = new FLabel("Abstract", "Cost");
        costLabel.SetAnchor(0.5f, 0);
        costLabel.scale *= 2;
        costLabel.y = -Futile.screen.halfHeight + 32;
        AddChild(costLabel);
        shipLabel = new FLabel("Abstract", "Ship");
        shipLabel.SetAnchor(0.5f, 0);
        shipLabel.scale *= 2;
        shipLabel.y = -Futile.screen.halfHeight + 64;
        AddChild(shipLabel);

        timerLabelvalue = new floatContainer();
        timerLabelvalue.val = 3;
        timerLabel = new FLabel("Abstract", timerLabelvalue.val.ToString());
        timerLabel.scale *= 10;
        timerLabel.color = Color.gray;
        timerLabel.alpha = 0.75f;
        timerLabel.SetAnchor(0.5f, 0.5f);
        AddChild(timerLabel);

        PlanetCost = 50;
        player1.CollectedResources = 1000000;
        player2.CollectedResources = 1000000;
    }