コード例 #1
0
    public TParallaxScene(Color backgroundColor)
    {
        FSprite background = SquareMaker.Square(Futile.screen.width, Futile.screen.height);

        background.x     = Futile.screen.halfWidth;
        background.y     = Futile.screen.halfHeight;
        background.color = backgroundColor;
        AddChild(background);

        layers = new List <TParallaxLayer>();
    }
コード例 #2
0
    void MakeBorder()
    {
        if (width < thickness * 2f || height < thickness * 2f)
        {
            FSprite square = SquareMaker.Square(width, height);
            square.anchorX = square.anchorY = 0.0f;
            square.color   = color;
            AddChild(square);
            return;
        }

        FSprite left   = SquareMaker.Square(thickness, height);
        FSprite right  = SquareMaker.Square(thickness, height);
        FSprite bottom = SquareMaker.Square(width - thickness * 2f, thickness);
        FSprite top    = SquareMaker.Square(width - thickness * 2f, thickness);

        left.anchorX   = 0.0f;
        left.anchorY   = 0.0f;
        right.anchorX  = 1.0f;
        right.anchorY  = 0.0f;
        bottom.anchorX = 0.0f;
        bottom.anchorY = 0.0f;
        top.anchorX    = 0.0f;
        top.anchorY    = 1.0f;

        left.x   = 0.0f;
        left.y   = 0.0f;
        right.x  = width;
        right.y  = 0.0f;
        bottom.x = thickness;
        bottom.y = 0.0f;
        top.x    = thickness;
        top.y    = height;

        left.color = right.color = bottom.color = top.color = color;

        AddChild(left);
        AddChild(right);
        AddChild(top);
        AddChild(bottom);
    }
コード例 #3
0
    void SetupUIElements()
    {
        goalProgressBar         = SquareMaker.Square(Futile.screen.width, 20f);
        goalProgressBar.anchorY = 1.0f;
        goalProgressBar.anchorX = 1.0f;
        goalProgressBar.color   = new Color(1.0f, 0.4f, 0.4f, 1.0f);
        goalProgressBar.x       = Futile.screen.width;
        goalProgressBar.y       = Futile.screen.height;
        everythingContainer.AddChild(goalProgressBar);

        start         = new FLabel("SoftSugar", "start");
        goal          = new FLabel("SoftSugar", "goal");
        start.anchorX = 0;
        goal.anchorX  = 1f;
        start.color   = goal.color = Color.black;
        start.x       = 5f;
        start.scale   = goal.scale = 0.3f;
        goal.x        = Futile.screen.width - 5f;
        start.y       = goal.y = Futile.screen.height - 12f;
        everythingContainer.AddChild(start);
        everythingContainer.AddChild(goal);
    }
コード例 #4
0
    public TPeopleScene(GoalType goalType) : base("")
    {
        FSprite background = SquareMaker.Square(Futile.screen.width, Futile.screen.height);

        background.color = Color.black;
        background.x     = Futile.screen.halfWidth;
        background.y     = Futile.screen.halfHeight;
        AddChild(background);

        startOverLabel       = new FLabel("SoftSugar", "Any key or click\nto start completely over");
        startOverLabel.x     = Futile.screen.halfWidth;
        startOverLabel.y     = Futile.screen.halfHeight;
        startOverLabel.alpha = 0;
        AddChild(startOverLabel);

        everythingContainer = new FContainer();
        AddChild(everythingContainer);

        parallaxScene = new TParallaxScene(new Color(0.7f, 0.9f, 1.0f, 1.0f));
        parallaxScene.foregroundVelocity = universalVelocity;
        parallaxScene.AddLayerWithImageName("mountains0.png", 0.15f, 0, true);
        parallaxScene.AddLayerWithImageName("mountains1.png", 0.3f, 0, true);
        parallaxScene.AddLayerWithImageName("cloud.psd", 0.2f, Futile.screen.halfHeight + 100f, false);
        parallaxScene.AddLayerWithImageName("ground.psd", 1.0f, 0, true);
        parallaxScene.StartUpdating();
        everythingContainer.AddChild(parallaxScene);

        FSprite fog = SquareMaker.Square(Futile.screen.width, Futile.screen.height);

        fog.x     = Futile.screen.halfWidth;
        fog.y     = Futile.screen.halfHeight;
        fog.color = Color.black;
        fog.alpha = 0.5f;
        everythingContainer.AddChild(fog);

        this.goalType  = goalType;
        tutorialIsDone = TMain.goalOneTutorialIsDone;

        if (this.goalType == GoalType.GoalOne)
        {
            goalDistance = 20000f;
        }
        else if (this.goalType == GoalType.GoalTwo)
        {
            goalDistance = 30000f;
        }
        else if (this.goalType == GoalType.GoalThree)
        {
            goalDistance = 50000f;
        }

        FSoundManager.PlayMusic("jazz");

        SetupHeartTokens();
        SetupUIElements();
        SetupTutorial();
        SetupHeartShower();
        SetupFinalNote();

        if (this.goalType == GoalType.GoalTwo)
        {
            FLabel label = new FLabel("SoftSugar", "\"I hope Dana's around\nhere somewhere!\"");
            label.x = Futile.screen.halfWidth;
            label.y = Futile.screen.height - 100f;
            everythingContainer.AddChild(label);
            Tween tween = new Tween(label, 0.3f, new TweenConfig()
                                    .setDelay(3.0f)
                                    .floatProp("y", Futile.screen.height + 200f)
                                    .setEaseType(EaseType.SineInOut));
            Go.addTween(tween);
            tween.play();
        }
        else if (this.goalType == GoalType.GoalThree)
        {
            FLabel label = new FLabel("SoftSugar", "\"Will I ever survive\nwithout her?\"");
            label.x = Futile.screen.halfWidth;
            label.y = Futile.screen.height - 100f;
            everythingContainer.AddChild(label);
            Tween tween = new Tween(label, 0.3f, new TweenConfig()
                                    .setDelay(3.0f)
                                    .floatProp("y", Futile.screen.height + 200f)
                                    .setEaseType(EaseType.SineInOut));
            Go.addTween(tween);
            tween.play();
        }

        whit   = new TWalkingCharacter("whitHead.png");
        whit.x = 130f;
        whit.y = 250f;
        everythingContainer.AddChild(whit);
        whit.StartWalking();

        TBorderLayer borderLayer = new TBorderLayer(Futile.screen.width, Futile.screen.height, 5f, new Color(0.2f, 0.2f, 0.2f, 1.0f));

        everythingContainer.AddChild(borderLayer);
    }