/// <summary> /// Simple Controller vibration /// </summary> /// <param name="Duration">The length in seconds the vibration should last</param> /// <param name="IntensityLeftMotor">The intensity of the Left Motor vibration</param> /// <param name="IntensityRightMotor">The intensity of the Right Motor vibration</param> /// <param name="ShakeScreen">Should the screen shake in unison with the controller vibration</param> public void vibrate(float Duration = 0.5f, float IntensityLeftMotor = 0.15f, float IntensityRightMotor = 0.15f, bool ShakeScreen = false) { vibeDuration = Duration; leftVibe = IntensityLeftMotor; rightVibe = IntensityRightMotor; if (ShakeScreen) { FlxG.shake(IntensityLeftMotor / 20, Duration); } }
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); } }