private void Start() { instance = this; Go.defaultEaseType = EaseType.Linear; Go.duplicatePropertyRule = DuplicatePropertyRuleType.RemoveRunningProperty; //Time.timeScale = 0.4f; // ======= FUTILE INIT ======= // FutileParams fparams = new FutileParams(true, true, false, false); fparams.AddResolutionLevel(480.0f, 1.0f, 1.0f, "_Scale1"); //iPhone fparams.AddResolutionLevel(960.0f, 2.0f, 2.0f, "_Scale2"); //iPhone retina fparams.AddResolutionLevel(1280.0f, 2.0f, 2.0f, "_Scale2"); //Nexus 7 fparams.origin = new Vector2(0.5f, 0.5f); Futile.instance.Init(fparams); Futile.atlasManager.LoadAtlas("Atlases/BananaLargeAtlas"); Futile.atlasManager.LoadAtlas("Atlases/BananaGameAtlas"); Futile.atlasManager.LoadFont("Franchise", "FranchiseFont" + Futile.resourceSuffix, "Atlases/FranchiseFont" + Futile.resourceSuffix, 0.0f, -4.0f); // ======= ENVIRONMENT INIT ======= // _stage = Futile.stage; FSoundManager.PlayMusic("NormalMusic", 0.5f); // ======= GAME INIT ======= // bad_foods.AddRange(new string[] { "Banana" }); // ======= SWITCH PAGE ======= // // GoToPage(BPageType.TitlePage); GoToPage(BPageType.SelectPage); }
public Car(FAtlasElement element, FContainer grid) : base(element) { ListenForUpdate(Update); Speed = 0; Colliders = grid; FSoundManager.PlayMusic("loop_0"); }
public TClickHeartsScene() : base("") { FSoundManager.PlayMusic("reverbPiano"); Go.validateTargetObjectsEachTick = false; FSoundManager.PlaySound("harpDescend"); MakeBackground(); MakeUIElements(); hearts = new List <FSprite>(); heartShowerHearts = new List <FSprite>(); for (int i = 0; i < 200; i++) { FSprite heart = new FSprite("heart.psd"); heart.color = new Color(0.75f, Random.Range(0, 0.3f), Random.Range(0, 0.3f), 1.0f); heart.isVisible = false; heart.alpha = Random.Range(0.6f, 1.0f); heart.rotation = Random.Range(0, 359); heart.scale = Random.Range(0.1f, 1.0f); heartShowerHearts.Add(heart); AddChild(heart); } TBorderLayer borderLayer = new TBorderLayer(Futile.screen.width, Futile.screen.height, 5f, new Color(0.2f, 0.2f, 0.2f, 1.0f)); AddChild(borderLayer); }
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; }
public StartMenu() { if (DogfighterMain.instance.musicOn && DogfighterMain.instance.titleMusic) { DogfighterMain.instance.titleMusic = false; FSoundManager.PlayMusic("Music/CiderTime", 0.25f); } //Create and show menu buttons title = new FSprite("MM_Title_1.png"); title.scale = 0.25f; title.y = 75.0f; AddChild(title); startButton = new FButton("MM_START.png", "MM_START_Selected.png"); startButton.scale = 0.5f; AddChild(startButton); optionsButton = new FButton("MM_OPTIONS.png", "MM_OPTIONS_Selected.png"); optionsButton.scale = 0.5f; optionsButton.y = -60.0f; AddChild(optionsButton); exitButton = new FButton("MM_EXIT.png", "MM_EXIT_Selected.png"); exitButton.scale = 0.5f; exitButton.y = -110.0f; AddChild(exitButton); //Adds listener to menu buttons that calls the associated function startButton.SignalRelease += StartButtonRelease; optionsButton.SignalRelease += OptionsButtonRelease; exitButton.SignalRelease += ExitButtonRelease; }
// Use this for initialization void Start() { FutileParams fParms = new FutileParams(false, false, true, true); fParms.AddResolutionLevel(1024.0f, 1.0f, 1.0f, ""); fParms.origin = new Vector2(0.5f, 0.5f); Futile.instance.Init(fParms); Futile.atlasManager.LoadAtlas("Atlases/art"); Futile.atlasManager.LoadFont("Franchise", "FranchiseFontAtlas.png", "Atlases/FranchiseLarge"); FSprite background = new FSprite("background.png"); Futile.stage.AddChild(background); Futile.stage.AddChild(mBombaNode = new FContainer()); Futile.stage.AddChild(mPepperNode = new FContainer()); mPepperNode.AddChild(mPepper = new Pepper(new FireDelegate(fire))); mSeed = new Seed(18, mPepper.y + mPepper.height / 2 - 15); Futile.stage.AddChild(mSeed); mScoreLabel = new FLabel("Franchise", "Score :"); mScoreLabel.anchorX = 0; mScoreLabel.anchorY = 1; mScoreLabel.color = new Color(1.0f, 0.90f, 0.0f); mScoreLabel.x = -Futile.halfWidth; mScoreLabel.y = Futile.halfHeight; Futile.stage.AddChild(mScoreLabel); Futile.touchManager.AddSingleTouchTarget(this); FSoundManager.PlayMusic("music", 0.45f); }
public void SetGameStart(bool playsound = true) { GameControl.Instance.game_data.canshowtip = false; if (playsound) { FSoundManager.PlayMusic("Background"); } this.gameStartTime = Time.realtimeSinceStartup; GameControl.Instance.game_data.isGamePlay = true; var level_data = GameControl.Instance.game_data.GetLevelData(GameControl.Instance.game_data.currentGameLevel, GameControl.Instance.game_data.Current_Difficulty); this.CreateOperationalImage(level_data); this.CreateImageOnShiLiPan(level_data); }
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; }
protected void HandleUpdate() { _secondsLeft -= Time.deltaTime; if (_secondsLeft <= 0) { FSoundManager.PlayMusic("VictoryMusic", 0.5f); BMain.instance.GoToPage(BPageType.ScorePage); return; } _timeLabel.text = ((int)_secondsLeft) + " Seconds Left"; if (_secondsLeft < 10) //make the timer red with 10 seconds left { _timeLabel.color = new Color(1.0f, 0.2f, 0.0f); } _framesTillNextBanana--; if (_framesTillNextBanana <= 0) { if (_totalBananasCreated % 4 == 0) //every 4 bananas, make the bananas come a little bit sooner { _maxFramesTillNextBanana--; } _framesTillNextBanana = _maxFramesTillNextBanana; CreateBanana(); } //loop backwards so that if we remove a banana from _bananas it won't cause problems for (int b = _bananas.Count - 1; b >= 0; b--) { BBanana banana = _bananas[b]; //remove a banana if it falls off screen if (banana.y < -Futile.screen.halfHeight - 50) { _bananas.Remove(banana); _bananaContainer.RemoveChild(banana); } } _frameCount++; }
public void UpdateHeartTokenCollisions() { foreach (THeartToken token in heartTokens) { if (!token.sprite.isVisible) { continue; } if (whit.GetGlobalBoundsRect().CheckIntersect(token.GetGlobalBoundsRect())) { FSoundManager.PlayMusic("nooo"); parallaxScene.StopUpdating(); GameOver(); } } }
// Use this for initialization void Start() { FutileParams fparams = new FutileParams(true, true, false, false); fparams.AddResolutionLevel(480.0f, 1.0f, 1.0f, ""); fparams.origin = new Vector2(0.0f, 0.0f); Futile.instance.Init(fparams); Futile.atlasManager.LoadAtlas("Atlases/mainAtlas"); Futile.atlasManager.LoadAtlas("Atlases/backgroundAtlas"); Futile.atlasManager.LoadFont("BlairMdITC", "BlairMdITC.png", "Atlases/BlairMdITC"); FSoundManager.PlayMusic("song", 0.7f); SwitchToPage(PageType.Title); }
protected void HandleUpdate() { //_secondsLeft -= Time.deltaTime; if (_secondsLeft <= 0) { FSoundManager.PlayMusic("VictoryMusic", 0.5f); BMain.instance.GoToPage(BPageType.ScorePage); return; } _timeLabel.text = ((int)_secondsLeft) + " Seconds Left"; if (_secondsLeft < 10) //make the timer red with 10 seconds left { _timeLabel.color = new Color(1.0f, 0.2f, 0.0f); } }
private void setMusic(FButton button) { if (DogfighterMain.instance.musicOn == true) { DogfighterMain.instance.musicOn = false; FSoundManager.StopMusic(); RemoveChild(musicOffLabel); AddChild(musicOnLabel); } else if (DogfighterMain.instance.musicOn == false) { DogfighterMain.instance.musicOn = true; DogfighterMain.instance.titleMusic = false; FSoundManager.PlayMusic("Music/intro", 0.25f); RemoveChild(musicOnLabel); AddChild(musicOffLabel); } }
override public void Start() { // Access immunity menu immunityMenu = GameObject.Find("Futile").GetComponent <ImmunityMenu>(); // Sound FSoundManager.StopMusic(); FSoundManager.UnloadAllSoundsAndMusic(); FSoundManager.PlayMusic("background_music"); FSoundManager.PreloadSound("button_click"); // GUI objects background_ = new FSprite("start screen final"); play_button = new FButton("Play", "PlayPressed"); how_to_play_button = new FButton("how_to_play", "how_to_play_pressed"); credits_button = new FButton("Credits", "CreditsPressed"); // Add objects to stage AddChild(background_); AddChild(play_button); AddChild(how_to_play_button); AddChild(credits_button); // Scale and set position background_.scale = 0.0f; play_button.scale = .6f; play_button.x = Futile.screen.halfWidth * .3f; play_button.y = Futile.screen.halfHeight * .1f; how_to_play_button.x = Futile.screen.halfWidth * .45f; how_to_play_button.y = Futile.screen.halfHeight * -.3f; credits_button.scale = .6f; credits_button.x = Futile.screen.halfWidth * .35f; credits_button.y = Futile.screen.halfHeight * -.7f; // Set button delegates play_button.SignalRelease += HandlePlayButton; how_to_play_button.SignalRelease += HandleHowToPlayButton; credits_button.SignalRelease += HandleCreditsButton; Go.to(background_, 0.5f, new TweenConfig().setDelay(0.1f).floatProp("scale", 1.0f).setEaseType(EaseType.BackOut)); }
protected void HandleUpdate() { _secondsLeft -= Time.deltaTime; if (_secondsLeft <= 0) { FSoundManager.PlayMusic("VictoryMusic", 0.5f); BMain.instance.GoToPage(BPageType.ScorePage); return; } _timeLabel.text = ((int)_secondsLeft) + " Seconds Left"; if (_secondsLeft < 10) //make the timer red with 10 seconds left { _timeLabel.color = new Color(1.0f, 0.2f, 0.0f); } //loop backwards so that if we remove a banana from _bananas it won't cause problems }
// Use this for initialization void Start() { FSoundManager.isMuted = false; FutileParams futileParams = new FutileParams(true, false, false, false); futileParams.AddResolutionLevel(480, 1.0f, 1.0f, ""); futileParams.origin = new Vector2(0.5f, 0.5f); futileParams.backgroundColor = new Color(.2f, .2f, .2f); Futile.instance.Init(futileParams); Futile.atlasManager.LoadAtlas("Atlases/atlasOne"); Futile.atlasManager.LoadAtlas("Atlases/Fonts"); Futile.atlasManager.LoadFont("Small", "Small Font", "Atlases/Small Font", 0, 0); Futile.atlasManager.LoadFont("Large", "Large Font", "Atlases/Large Font", 0, 0); TitleScreen titleScreen = new TitleScreen(); Futile.stage.AddChild(titleScreen); FSoundManager.PlayMusic("LD27Music", .3f); }
public TDreamScene(DreamSceneType dreamSceneType) : base("") { FSoundManager.PlayMusic("celesta"); TParallaxScene parallaxScene = new TParallaxScene(Color.white); parallaxScene.AddLayerWithImageName("Atlases/clouds", 1.0f, 0, true); parallaxScene.foregroundVelocity = -100f; AddChild(parallaxScene); parallaxScene.StartUpdating(); TBorderLayer borderLayer = new TBorderLayer(Futile.screen.width, Futile.screen.height, 5f, new Color(0.2f, 0.2f, 0.2f, 1.0f)); AddChild(borderLayer); this.dreamSceneType = dreamSceneType; TMain.labelDisplayLayer.shouldIncreaseHoldDurationBasedOnStringLength = true; TMain.labelDisplayLayer.fontColor = Color.black; if (this.dreamSceneType == DreamSceneType.DreamSceneOne) { TMain.labelDisplayLayer.AddStringsToQueue(new string[] { "Suddenly, I fall asleep", "In my dream,\nI reminisce about\ncreating the\nperfect last name", "Help me piece together\nour last name!" }); } else if (this.dreamSceneType == DreamSceneType.DreamSceneTwo) { TMain.labelDisplayLayer.AddStringsToQueue(new string[] { "Oh no, all this running\nhas made me fall\nasleep again!", "This time, I dream\nabout how much\nI love you", "Help me quantify just how\nmuch I love you!" }); } TMain.labelDisplayLayer.defaultHoldDuration = 3.0f; TMain.labelDisplayLayer.labelShowType = LabelShowType.SlideFromTop; TMain.labelDisplayLayer.labelHideType = LabelHideType.SlideToBottom; }
private FStage _stage; //保存FStage引用 private void Start() { instance = this; Go.defaultEaseType = EaseType.Linear; Go.duplicatePropertyRule = DuplicatePropertyRuleType.RemoveRunningProperty; //Time.timeScale = 0.1f; bool isIPad = SystemInfo.deviceModel.Contains("iPad"); bool shouldSupportPortraitUpsideDown = isIPad; //only support portrait upside-down on iPad FutileParams fparams = new FutileParams(true, true, true, shouldSupportPortraitUpsideDown); fparams.AddResolutionLevel(480.0f, 1.0f, 1.0f, "_Scale1"); //iPhone fparams.AddResolutionLevel(960.0f, 2.0f, 2.0f, "_Scale2"); //iPhone retina fparams.AddResolutionLevel(1024.0f, 2.0f, 2.0f, "_Scale2"); //iPad fparams.AddResolutionLevel(1280.0f, 2.0f, 2.0f, "_Scale2"); //Nexus 7 fparams.AddResolutionLevel(2048.0f, 4.0f, 4.0f, "_Scale4"); //iPad Retina fparams.origin = new Vector2(0.5f, 0.5f); //初始化Futile引擎 Futile.instance.Init(fparams); //加载图集、字体资源 Futile.atlasManager.LoadAtlas("Atlases/BananaLargeAtlas"); Futile.atlasManager.LoadAtlas("Atlases/BananaGameAtlas"); Futile.atlasManager.LoadFont("Franchise", "FranchiseFont" + Futile.resourceSuffix, "Atlases/FranchiseFont" + Futile.resourceSuffix, 0.0f, -4.0f); //获取FStage引用 _stage = Futile.stage; FSoundManager.PlayMusic("NormalMusic", 0.5f); GoToPage(BPageType.TitlePage); }
void initGame() { Level.enemyList = new List <EnemySprite>(); FSoundManager.PlayMusic("bgmusic", 0.3f); PlayerState.player = new PlayerSprite(); PlayerState.DEPTH = 0.0f; PlayerState.SCORE = 0; enemyController.lastDepth = 50.0f; enemyController.lastSpawn = 0.0f; Futile.stage.RemoveAllChildren(); Futile.stage.AddChildAtIndex(bgContainer, 0); Futile.stage.AddChildAtIndex(PlayerState.player, 50); Futile.stage.AddChild(depthLabel); Futile.stage.AddChild(scoreLabel); Futile.stage.AddChild(this.playerInput); Level.STARTED = true; this.DEATH_SHOWN = false; }
void Update() { float hInput = Input.GetAxis("Horizontal"); float vInput = Input.GetAxis("Vertical"); var angH = Input.GetAxis("RightH"); var angV = Input.GetAxis("RightV"); if (angH > 0.5f) { this.rotation += 3; } else if (angH < -0.5f) { this.rotation -= 3; } if (this.Speed > 0 && _drivin != true) { FSoundManager.PlayMusic("loop_1", 0.2f); _drivin = true; Debug.Log("YEEEHAW"); } else if (this.Speed == 0 && _drivin == true) { FSoundManager.PlayMusic("loop_0"); _drivin = false; Debug.Log("naw"); } Move(0, vInput); if (Input.GetKeyUp(KeyCode.Space) && _honkin == false) { CoroutineRunner.StartFutileCoroutine(Honk()); } }
static public void PlayRegularMusic() { FSoundManager.PlayMusic("Music", 0.3f); }
/* * La actualizacion se llama cada cuadro de actualizacion */ public void Update() { if (!GameOver) { //Key Controllers if (Input.GetKeyDown(KeyCode.LeftArrow)) { leftArrow = true; } if (Input.GetKeyDown(KeyCode.RightArrow)) { rightArrow = true; } if (Input.GetKeyDown(KeyCode.Space)) { jugador.setJump(); } if (Input.GetKeyDown(KeyCode.X)) { jugador.setAttack(); } if (Input.GetKeyDown(KeyCode.DownArrow)) { jugador.getDown(); } if (Input.GetKeyUp(KeyCode.LeftArrow)) { leftArrow = false; } if (Input.GetKeyUp(KeyCode.RightArrow)) { rightArrow = false; } //para evitar llenar de enmigos, solo crearemos uno si se cumple esta condicion if ((_frameCount % 120) == 0) { if (!GameOver) { GenerateMonster(); } } } else { if (Input.GetKeyDown(KeyCode.R)) { for (int x = 0; x < enemies.Count; x++) { if (enemies[x] != null) { enemies[x].Destroy(); } } RemoveChild(_enemyContainer); _enemyContainer = new FContainer(); AddChild(_enemyContainer); Score = 0; GameOver = false; _playerBullets.RemoveAllChildren(); FSoundManager.isMuted = false; FSoundManager.PlayMusic("Barymag"); InitPlayer(); scoreLabel.text = "Score = " + Score; RemoveChild(gameOver); rightArrow = false; leftArrow = false; } } _frameCount++; }
void Start() { Go.defaultEaseType = EaseType.SineInOut; FutileParams fp = new FutileParams(true, true, false, false); fp.AddResolutionLevel(480f, 1.0f, 1.0f, "-res1"); fp.AddResolutionLevel(1136f, 2.0f, 2.0f, "-res2"); fp.AddResolutionLevel(2048f, 4.0f, 4.0f, "-res4"); fp.backgroundColor = Color.white; fp.origin = Vector2.zero; Futile.instance.Init(fp); Futile.atlasManager.LoadAtlas("Atlases/MainSheet"); Futile.atlasManager.LoadFont("franchise", "franchise", "Atlases/franchise", -7, -16); // futile done initing FSoundManager.PlayMusic("song"); FPWorld.Create(64.0f); // make the walls super thick so stuff doesn't accidentally fly through when forces are massive float wallThickness = 100000; WTBasicWall leftWall = new WTBasicWall(wallThickness, Futile.screen.height * 10); WTBasicWall rightWall = new WTBasicWall(wallThickness, Futile.screen.height * 10); WTBasicWall bottomWall = new WTBasicWall(Futile.screen.width * 10, wallThickness); WTBasicWall topWall = new WTBasicWall(Futile.screen.width * 10, wallThickness); leftWall.SetPosition(-wallThickness / 2f + 10, Futile.screen.halfHeight); rightWall.SetPosition(Futile.screen.width + wallThickness / 2f - 10, Futile.screen.halfHeight); bottomWall.SetPosition(Futile.screen.halfWidth, -wallThickness / 2f + 10); topWall.SetPosition(Futile.screen.halfWidth, Futile.screen.height + wallThickness / 2f - 10); Futile.stage.AddChild(leftWall); Futile.stage.AddChild(rightWall); Futile.stage.AddChild(bottomWall); Futile.stage.AddChild(topWall); physicsNodes = new List <WTPhysicsNode>(); // create the square FSprite squareSprite = new FSprite("coolSquare"); square = new WTPhysicsNode("square"); square.AddChild(squareSprite); square.SetNewPosition(Futile.screen.width / 4f, Futile.screen.halfHeight); square.physicsComponent.AddBoxCollider(squareSprite.width, squareSprite.height); physicsNodes.Add(square); // create the circle FSprite circleSprite = new FSprite("coolCircle"); circle = new WTPhysicsNode("circle"); circle.AddChild(circleSprite); circle.SetNewPosition(Futile.screen.width / 4f * 2f, Futile.screen.halfHeight); circle.physicsComponent.AddSphereCollider(circleSprite.width / 2f); physicsNodes.Add(circle); // polygon object FSprite polygonSprite = new FSprite("coolPolygon"); polygon = new WTPhysicsNode("polygon"); polygon.AddChild(polygonSprite); polygon.SetNewPosition(Futile.screen.width / 4f * 3f, Futile.screen.halfHeight); Vector2[] vertices = new Vector2[] { new Vector2(-27, -10), new Vector2(-14, 6), new Vector2(-20, 24), new Vector2(-2, 11), new Vector2(27, 25), new Vector2(-7, -8), new Vector2(22, -17), new Vector2(-26, -27) }; polygon.physicsComponent.AddPolygonalCollider(vertices); physicsNodes.Add(polygon); // setup all the objects and start their physics foreach (WTPhysicsNode pn in physicsNodes) { pn.physicsComponent.AddRigidBody(1, 1); pn.physicsComponent.SetupPhysicMaterial(0.9f, 0.1f, 0.1f, PhysicMaterialCombine.Maximum); pn.physicsComponent.StartPhysics(); pn.physicsComponent.AddForce(Random.Range(-1000, 1000), Random.Range(-1000, 1000)); Futile.stage.AddChild(pn); } // for fun, let's stop this and have it float around a bit before being controlled by physics polygon.physicsComponent.StopPhysics(); }
private void HandleAgainButtonRelease(FButton button) { FSoundManager.PlayMusic("NormalMusic", 0.5f); BMain.instance.GoToPage(BPageType.InGamePage); }
public static void PlayMusic(string resourceName) { FSoundManager.PlayMusic(resourceName, 1f); }
public static void PlayMusic(string resourceName, float volume) { FSoundManager.PlayMusic(resourceName, volume, true); }
// Use this for initialization override public void Start() { if (ImmunityCombatManager.instance.stage_name.Equals("stomach")) { level = new StomachLevel(); } else if (ImmunityCombatManager.instance.stage_name.Equals("lung")) { level = new LungLevel(); } else { level = new BrainLevel(); } AddChild(level); FSoundManager.StopMusic(); FSoundManager.UnloadAllSoundsAndMusic(); FSoundManager.PlayMusic("battle_music", .204f); FSprite enemy_headshot = new FSprite("punchy_headshot"); enemy_headshot.x = Futile.screen.halfWidth - enemy_headshot.width / 2.0f - 50.0f; enemy_headshot.y = Futile.screen.halfHeight - enemy_headshot.height / 2.0f - 50.0f; enemy_healthbar_ = new HealthBar(); enemy_healthbar_.scaleX = -.8f; enemy_healthbar_.x = enemy_headshot.x - enemy_headshot.width / 2.0f - 25.0f; enemy_healthbar_.y = enemy_headshot.y; enemy_ = new EnemyCharacter(enemy_healthbar_); if (ImmunityCombatManager.instance.stage_name.Equals("lung") || ImmunityCombatManager.instance.stage_name.Equals("brain")) { enemy_.y = -Futile.screen.halfHeight * .27f; } AddChild(enemy_); FSprite player_headshot = new FSprite("hero_headshot"); player_headshot.scale = .2f; player_headshot.x = -Futile.screen.halfWidth + player_headshot.width / 2.0f + 50.0f; player_headshot.y = Futile.screen.halfHeight - player_headshot.height / 2.0f - 50.0f; player_healthbar = new HealthBar(); player_healthbar.scaleX = .8f; player_healthbar.x = player_headshot.x + player_headshot.width / 2.0f + 25.0f; player_healthbar.y = player_headshot.y; player_ = new PlayerCharacter(player_healthbar); if (ImmunityCombatManager.instance.stage_name.Equals("lung") || ImmunityCombatManager.instance.stage_name.Equals("brain")) { player_.y = -Futile.screen.halfHeight * .5f; } playerContainer = new FContainer(); //Debug.Log ("the player is at " + playerPosition.x + "," + playerPosition.y); playerContainer.AddChild(player_); AddChild(playerContainer); bacteriaContainer_ = new FContainer(); AddChild(bacteriaContainer_); bubbleContainer_ = new FContainer(); AddChild(bubbleContainer_); dyingBacteriaHolder_ = new FContainer(); AddChild(dyingBacteriaHolder_); ImmunityCombatManager.instance.camera_.follow(playerContainer); AddChild(player_headshot); AddChild(player_healthbar); AddChild(enemy_headshot); AddChild(enemy_healthbar_); level_bounding_box = new Rect(-Futile.screen.halfWidth * .9f, Futile.screen.halfHeight * .9f, Futile.screen.halfWidth * 1.8f, Futile.screen.halfHeight * 1.8f); }
public void UpdateGoal() { if (totalDistance < goalDistance - 1000f || initiatedSceneSwitch) { return; } if (goalType == GoalType.GoalOne) { if (faceCoin == null) { faceCoin = new FSprite("danaHappy.png"); faceCoin.x = Futile.screen.width + 100f; faceCoin.y = 250f; everythingContainer.AddChild(faceCoin); everythingContainer.AddChild(whit); // move him to top Tween tween1 = new Tween(faceCoin, 0.5f, new TweenConfig() .floatProp("scaleX", -1.0f) .setEaseType(EaseType.SineInOut)); Tween tween2 = new Tween(faceCoin, 0.5f, new TweenConfig() .floatProp("scaleX", 1.0f) .setEaseType(EaseType.SineInOut)); TweenChain chain = new TweenChain(); chain.setIterations(-1); chain.append(tween1); chain.append(tween2); Go.addTween(chain); chain.play(); } faceCoin.x += Time.fixedDeltaTime * universalVelocity; if (faceCoin.x < 100f) { initiatedSceneSwitch = true; FSoundManager.PlaySound("success"); TMain.SwitchToScene(TMain.SceneType.DreamSceneOne); } } else if (goalType == GoalType.GoalTwo) { if (bigHeartCoin == null) { bigHeartCoin = new FSprite("heart.psd"); bigHeartCoin.scale = 2.0f; bigHeartCoin.x = Futile.screen.width + 100f; bigHeartCoin.color = new Color(1.0f, 0.2f, 0.2f, 1.0f); bigHeartCoin.y = 250f; everythingContainer.AddChild(bigHeartCoin); everythingContainer.AddChild(whit); // move to top Tween tween1 = new Tween(bigHeartCoin, 0.5f, new TweenConfig() .floatProp("scaleX", -1.0f) .setEaseType(EaseType.SineInOut)); Tween tween2 = new Tween(bigHeartCoin, 0.5f, new TweenConfig() .floatProp("scaleX", 1.0f) .setEaseType(EaseType.SineInOut)); TweenChain chain = new TweenChain(); chain.setIterations(-1); chain.append(tween1); chain.append(tween2); Go.addTween(chain); chain.play(); } bigHeartCoin.x += Time.fixedDeltaTime * universalVelocity; if (bigHeartCoin.x < 100f) { initiatedSceneSwitch = true; FSoundManager.StopMusic(); FSoundManager.PlaySound("success"); TMain.SwitchToScene(TMain.SceneType.DreamSceneTwo); } } else if (goalType == GoalType.GoalThree) { if (dana == null) { dana = new TWalkingCharacter("danaHead.png"); dana.x = Futile.screen.width + 100f; dana.y = 250f; everythingContainer.AddChild(dana); dana.StartWalking(); } dana.x += Time.fixedDeltaTime * universalVelocity * 0.25f; if (dana.x < 350f) { start.isVisible = goal.isVisible = false; FSoundManager.PlayMusic("yay"); foundEachother = true; dana.TurnAround(); dana.StopWalking(); whit.StopWalking(); parallaxScene.StopUpdating(); whit.StopCrouching(); StartHeartShower(); } } }
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); }
// private Random random = new Random(); public ShipSelect() { instance = this; if (DogfighterMain.instance.musicOn == true) { FSoundManager.PlayMusic("Music/MeleeSelect", 0.2f); } background = new FSprite("Ship_Select_BG.png"); // eventually this will change to 1080 background.scaleY = (Futile.screen.height / 1080.0f); // eventually this will change to 1920 background.scaleX = (Futile.screen.width / 1920.0f); AddChild(background); redBar = new FSprite("Ship_Select_Bar.png"); redBar.scaleX = (Futile.screen.width / (3f * 369f)); redBar.scaleY = (Futile.screen.height / 1080f); redBar.x = Futile.screen.halfWidth - (Futile.screen.width / 6f); AddChild(redBar); player1Logo = new FSprite("Ship_Select_Player_1.png"); player1Logo.scale = 0.25f; player1Logo.x = -(Futile.screen.halfWidth) + 61f; player1Logo.y = Futile.screen.halfHeight - 25f; AddChild(player1Logo); for (int j = 1; j > -1; j--) { for (int i = 1; i < 5; i++) { if (!(j == -0 && i == 4)) { createCircle(-(Futile.screen.halfWidth) + (i * xBox) - 9.75f, Futile.screen.halfHeight + player1yOffset + (j * yBox) - 1f); } } } random1 = new FButton("Holding_Circle_Unselected.png"); random1.scale = 0.14f; random1.x = (-Futile.screen.halfWidth) + (4 * xBox) - 9.75f; random1.y = Futile.screen.halfHeight + player1yOffset + (0 * yBox) - 1f; AddChild(random1); random1.SignalRelease += Random1Release; for (int j = 1; j > -1; j--) { for (int i = 1; i < 5; i++) { if (!(j == -0 && i == 4)) { createCircle(-(Futile.screen.halfWidth) + (i * xBox) - 9.75f, Futile.screen.halfHeight + player2yOffset + (j * yBox) - 1f); } } } random2 = new FButton("Holding_Circle_Unselected.png"); random2.scale = 0.14f; random2.x = (-Futile.screen.halfWidth) + boxXOffset - (1 * xBox); random2.y = Futile.screen.halfHeight + player2yOffset + (0 * yBox) - 1f; AddChild(random2); random2.SignalRelease += Random2Release; selectedCircle1 = new FSprite("Holding_Circle_Selected.png"); selectedCircle1.scale = 0.14f; selectedCircle1.x = -(Futile.screen.halfWidth) - 9.75f + (4 * xBox); selectedCircle1.y = Futile.screen.halfHeight + player1yOffset - 1f; AddChild(selectedCircle1); selectedCircle2 = new FSprite("Holding_Circle_Selected.png"); selectedCircle2.scale = 0.14f; selectedCircle2.x = -(Futile.screen.halfWidth) - 9.75f + (4 * xBox); selectedCircle2.y = Futile.screen.halfHeight + player2yOffset - 1f; AddChild(selectedCircle2); player2Logo = new FSprite("Ship_Select_Player_2.png"); player2Logo.scale = 0.25f; player2Logo.x = -(Futile.screen.halfWidth) + 61f; player2Logo.y = Futile.screen.halfHeight - 144f; AddChild(player2Logo); startButton = new FButton("Ship_Select_Start.png"); startButton.scale = 0.51f; startButton.x = Futile.screen.halfWidth - (Futile.screen.width / 6f) + 2f; startButton.y = -(Futile.screen.halfHeight) + 45f; AddChild(startButton); startButton.SignalRelease += StartButtonRelease; exitButton = new FButton("Ship_Select_Exit.png"); exitButton.scale = 0.51f; exitButton.x = Futile.screen.halfWidth - (Futile.screen.width / 6f) + 2f; exitButton.y = -(Futile.screen.halfHeight) + 15f; AddChild(exitButton); exitButton.SignalRelease += ExitButtonRelease; plusAsteroids = new FButton("Ship_Select_Asteroids_+.png"); plusAsteroids.scale = 0.51f; plusAsteroids.x = Futile.screen.halfWidth - (Futile.screen.width / 6f) + 2f; plusAsteroids.y = 0f; AddChild(plusAsteroids); plusAsteroids.SignalRelease += moreAsteroids; minusAsteroids = new FButton("Ship_Select_Asteroids_-.png"); minusAsteroids.scale = 0.51f; minusAsteroids.x = Futile.screen.halfWidth - (Futile.screen.width / 6f) + 2f; minusAsteroids.y = -30f; AddChild(minusAsteroids); minusAsteroids.SignalRelease += lessAsteroids; noAsteroids = new FButton("Ship_Select_Asteroids_No.png"); noAsteroids.scale = 0.51f; noAsteroids.x = Futile.screen.halfWidth - (Futile.screen.width / 6f) + 2f; noAsteroids.y = -59.5f; AddChild(noAsteroids); noAsteroids.SignalRelease += removeAsteroids; /* Disabled for Android Release */ toggleAutoPilot1 = new FButton("YellowButton_normal.png"); toggleAutoPilot1.scale = 0.51f; toggleAutoPilot1.x = -(Futile.screen.halfWidth) + (7 * xBox) - 9.75f; toggleAutoPilot1.y = Futile.screen.halfHeight + player1yOffset + (1 * yBox) - 1f; AddChild(toggleAutoPilot1); toggleAutoPilot1.SignalRelease += toggleAP1; APOnLabel1 = new FLabel("FranchiseFont_Scale1", "Turn AP On"); APOnLabel1.x = toggleAutoPilot1.x; APOnLabel1.y = toggleAutoPilot1.y; APOnLabel1.scale = 0.5f; AddChild(APOnLabel1); APOffLabel1 = new FLabel("FranchiseFont_Scale1", "Turn AP Off"); APOffLabel1.x = toggleAutoPilot1.x; APOffLabel1.y = toggleAutoPilot1.y; APOffLabel1.scale = 0.5f; //AddChild(APOffLabel1); toggleAutoPilot2 = new FButton("YellowButton_normal.png"); toggleAutoPilot2.scale = 0.51f; toggleAutoPilot2.x = -(Futile.screen.halfWidth) + (7 * xBox) - 9.75f; toggleAutoPilot2.y = Futile.screen.halfHeight + player2yOffset + (1 * yBox) - 1f; AddChild(toggleAutoPilot2); toggleAutoPilot2.SignalRelease += toggleAP2; APOnLabel2 = new FLabel("FranchiseFont_Scale1", "Turn AP On"); APOnLabel2.x = toggleAutoPilot2.x; APOnLabel2.y = toggleAutoPilot2.y; APOnLabel2.scale = 0.5f; APOffLabel2 = new FLabel("FranchiseFont_Scale1", "Turn AP Off"); APOffLabel2.x = toggleAutoPilot2.x; APOffLabel2.y = toggleAutoPilot2.y; APOffLabel2.scale = 0.5f; AddChild(APOffLabel2); #region Ships demon1 = new FButton("Demon_Ship.png"); demon1.scale = 0.1f; demon1.x = -(Futile.screen.halfWidth) + boxXOffset - (4 * xBox); demon1.y = Futile.screen.halfHeight + player1yOffset + (1 * yBox); AddChild(demon1); demon1.SignalRelease += Demon1Release; demon2 = new FButton("Demon_Ship.png"); demon2.scale = 0.1f; demon2.x = -(Futile.screen.halfWidth) + boxXOffset - (4 * xBox); demon2.y = Futile.screen.halfHeight + player2yOffset + (1 * yBox); AddChild(demon2); demon2.SignalRelease += Demon2Release; angel1 = new FButton("Angel_Ship.png"); angel1.scale = 0.1f; angel1.x = -(Futile.screen.halfWidth) + boxXOffset - (3 * xBox); angel1.y = Futile.screen.halfHeight + player1yOffset + (1 * yBox); AddChild(angel1); angel1.SignalRelease += Angel1Release; angel2 = new FButton("Angel_Ship.png"); angel2.scale = 0.1f; angel2.x = -(Futile.screen.halfWidth) + boxXOffset - (3 * xBox); angel2.y = Futile.screen.halfHeight + player2yOffset + (1 * yBox); AddChild(angel2); angel2.SignalRelease += Angel2Release; fatty1 = new FButton("Fatty_Ship.png"); fatty1.scale = 0.1f; fatty1.x = -(Futile.screen.halfWidth) + boxXOffset - (2 * xBox); fatty1.y = Futile.screen.halfHeight + player1yOffset + (1 * yBox); AddChild(fatty1); fatty1.SignalRelease += Fatty1Release; fatty2 = new FButton("Fatty_Ship.png"); fatty2.scale = 0.1f; fatty2.x = -(Futile.screen.halfWidth) + boxXOffset - (2 * xBox); fatty2.y = Futile.screen.halfHeight + player2yOffset + (1 * yBox); AddChild(fatty2); fatty2.SignalRelease += Fatty2Release; ghost1 = new FButton("Ghost_Ship.png"); ghost1.scale = 0.1f; ghost1.x = -(Futile.screen.halfWidth) + boxXOffset - (1 * xBox); ghost1.y = Futile.screen.halfHeight + player1yOffset + (1 * yBox); AddChild(ghost1); ghost1.SignalRelease += Ghost1Release; ghost2 = new FButton("Ghost_Ship.png"); ghost2.scale = 0.1f; ghost2.x = -(Futile.screen.halfWidth) + boxXOffset - (1 * xBox); ghost2.y = Futile.screen.halfHeight + player2yOffset + (1 * yBox); AddChild(ghost2); ghost2.SignalRelease += Ghost2Release; ninja1 = new FButton("Ninja_Ship.png"); ninja1.scale = 0.1f; ninja1.x = -(Futile.screen.halfWidth) + boxXOffset - (4 * xBox); ninja1.y = Futile.screen.halfHeight + player1yOffset + (0 * yBox); AddChild(ninja1); ninja1.SignalRelease += Ninja1Release; ninja2 = new FButton("Ninja_Ship.png"); ninja2.scale = 0.1f; ninja2.x = -(Futile.screen.halfWidth) + boxXOffset - (4 * xBox); ninja2.y = Futile.screen.halfHeight + player2yOffset + (0 * yBox); AddChild(ninja2); ninja2.SignalRelease += Ninja2Release; storm1 = new FButton("Storm_Ship.png"); storm1.scale = 0.1f; storm1.x = -(Futile.screen.halfWidth) + boxXOffset - (3 * xBox); storm1.y = Futile.screen.halfHeight + player1yOffset + (0 * yBox); AddChild(storm1); storm1.SignalRelease += Storm1Release; storm2 = new FButton("Storm_Ship.png"); storm2.scale = 0.1f; storm2.x = -(Futile.screen.halfWidth) + boxXOffset - (3 * xBox); storm2.y = Futile.screen.halfHeight + player2yOffset + (0 * yBox); AddChild(storm2); storm2.SignalRelease += Storm2Release; plague1 = new FButton("Plague_Ship.png"); plague1.scale = 0.1f; plague1.x = -(Futile.screen.halfWidth) + boxXOffset - (2 * xBox); plague1.y = Futile.screen.halfHeight + player1yOffset + (0 * yBox); AddChild(plague1); plague1.SignalRelease += Plague1Release; plague2 = new FButton("Plague_Ship.png"); plague2.scale = 0.1f; plague2.x = -(Futile.screen.halfWidth) + boxXOffset - (2 * xBox); plague2.y = Futile.screen.halfHeight + player2yOffset + (0 * yBox); AddChild(plague2); plague2.SignalRelease += Plague2Release; randomLabel1 = new FLabel("FranchiseFont_Scale1", "?"); randomLabel1.x = random1.x; randomLabel1.y = random1.y; randomLabel1.scale = 0.5f; AddChild(randomLabel1); randomLabel2 = new FLabel("FranchiseFont_Scale1", "?"); randomLabel2.x = random2.x; randomLabel2.y = random2.y; randomLabel2.scale = 0.5f; AddChild(randomLabel2); #endregion }