public override void update() { base.update(); if (!_fading) { _timer += FlxG.elapsed; if ((_timer > 0.35) && ((_timer > 10) || FlxG.keys.justPressed(Keys.X) || FlxG.keys.justPressed(Keys.C))) { _fading = true; /*FlxG.play(SndMenu, 1f, false, false);*/ FlxG.fade(Color.Black, 2, onPlay); } } }
public override void update() { /* * if(_pad.Visible) * _pad.update(); */ //save off the current score and update the game state int oldScore = FlxG.score; base.update(); //collisions with environment FlxG.collide(_blocks, _objects); FlxG.overlap(_hazards, _player, overlapped); FlxG.overlap(_bullets, _hazards, overlapped); //check to see if the player scored any points this frame bool scoreChanged = oldScore != FlxG.score; //Jammed message if ((FlxG.keys.justPressed(Keys.C) /*|| _pad.buttonB.status == FlxButton.Pressed*/) && _player.flickering) { _jamTimer = 1; _gunjam.Visible = true; } if (_jamTimer > 0) { if (!_player.flickering) { _jamTimer = 0; } _jamTimer -= FlxG.elapsed; if (_jamTimer < 0) { _gunjam.Visible = false; } } if (!_fading) { //Score + countdown stuffs if (scoreChanged) { _scoreTimer = 2; } _scoreTimer -= FlxG.elapsed; if (_scoreTimer < 0) { if (FlxG.score > 0) { if (FlxG.score > 100) { FlxG.score -= 100; } else { FlxG.score = 0; _player.kill(); } _scoreTimer = 1; scoreChanged = true; //Play loud beeps if your score is low float volume = 0.35f; if (FlxG.score < 600) { volume = 1.0f; } _sfxCount.Volume = volume; _sfxCount.play(true); } } //Fade out to victory screen stuffs if (_spawners.CountLiving() <= 0) { _fading = true; FlxG.fade(Color.Black, 3, onVictory); } } //actually update score text if it changed if (scoreChanged) { if (!_player.Alive) { FlxG.score = 0; } _score.text = "" + FlxG.score; } }
public override void update() { base.update(); if(title2.X > title1.X + title1.Width - 4) { //Once mo and de cross each other, fix their positions title2.X = title1.X + title1.Width - 4; title1.Velocity.X = 0; title2.Velocity.X = 0; //Then, play a cool sound, change their color, and blow up pieces everywhere /* FlxG.play(SndHit, 1f, false, false); */ FlxG.flash(Color.White,0.5f); FlxG.shake(0.035f,0.5f); title1.Color = Color.White; title2.Color = Color.White; gibs.start(true,5); title1.Angle = FlxG.random()*30-15; title2.Angle = FlxG.random()*30-15; //Then we're going to add the text and buttons and things that appear //If we were hip we'd use our own button animations, but we'll just recolor //the stock ones for now instead. FlxText text; text = new FlxText(FlxG.width/2-50,FlxG.height/3+39,100,"by Adam Atomic"); /*text.Alignment = "center";*/ text.Color = Color.White; add(text); /* FlxButton flixelButton = new FlxButton(FlxG.width/2-40,FlxG.height/3+54,"flixel.org",new IFlxButton(){ public void callback(){onFlixel();}}); flixelButton.setColor(0xff729954); flixelButton.label.setColor(0xffd8eba2); ModeMenuState(flixelButton); FlxButton dannyButton = new FlxButton(flixelButton.X,flixelButton.Y + 22,"music: dannyB",new IFlxButton(){ public void callback(){onDanny();}}); dannyButton.setColor(flixelButton.getColor()); dannyButton.label.setColor(flixelButton.label.getColor()); add(dannyButton); */ text = new FlxText(FlxG.width/2-40,FlxG.height/3+139,80,"X+C TO PLAY"); text.Color = Color.White; //text.setAlignment("center"); add(text); /* playButton = new FlxButton(flixelButton.X,flixelButton.Y + 82,"CLICK HERE", onPlay()); playButton.setColor(flixelButton.getColor()); playButton.label.setColor(flixelButton.label.getColor()); add(playButton); */ } //X + C were pressed, fade out and change to play state. //OR, if we sat on the menu too long, launch the attract mode instead! timer += FlxG.elapsed; if(timer >= 10) //go into demo mode if no buttons are pressed for 10 seconds attractMode = true; if(!fading && ((FlxG.keys.pressed(Keys.X) && FlxG.keys.pressed(Keys.C)) /*|| (_pad.buttonA.status == FlxButton.Pressed && _pad.buttonB.status == FlxButton.Pressed) */ || attractMode)) { fading = true; /*FlxG.play(SndHit2, 1f, false, false);*/ FlxG.flash(Color.White,0.5f); FlxG.fade(Color.Black,1, onFade); } }