Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package;
- import flixel.FlxG;
- import flixel.FlxSprite;
- import flixel.FlxObject;
- import flixel.tweens.FlxEase;
- import flixel.tweens.FlxTween;
- import flixel.util.FlxMath;
- import flixel.util.FlxPoint;
- import flixel.util.FlxVelocity;
- enum HypnoModes
- {
- AWAKE; // means not hypnotized
- HYPNOTIZED;
- LEVITATE;
- CARRIED;
- }
- /**
- * ...
- * @author Keith Weatherby II
- */
- class Enemy extends GameObject
- {
- public var hypnoTimeCounter = 0;
- public var hypnoTime = 420;
- public var awakenTime = 360;
- public var hypnoMode : HypnoModes = AWAKE;
- public function new( gameLevel : PlayState, object : Dynamic )
- {
- super( gameLevel, object );
- ID = object.ID;
- this.awakenTime = object.awakenTime;
- this.hypnoTime = object.hypnoTime;
- }
- override public function update():Void
- {
- this.DoActions();
- this.Animate();
- super.update();
- }
- public function DoActions()
- {
- switch( hypnoMode )
- {
- case AWAKE:
- case HYPNOTIZED:
- case LEVITATE:
- case CARRIED:
- } // end switch
- if ( hypnoMode == HYPNOTIZED || hypnoMode == LEVITATE || hypnoMode == CARRIED )
- {
- this.hypnoTimeCounter++;
- if ( this.hypnoTimeCounter > this.hypnoTime )
- {
- this.hypnoTimeCounter = 0;
- this.hypnoMode = AWAKE;
- }
- }
- }
- public function Animate()
- {
- switch( hypnoMode )
- {
- case AWAKE:
- this.animation.play( "normal" );
- case HYPNOTIZED:
- if ( this.hypnoTimeCounter > this.awakenTime )
- this.animation.play( "awaken" );
- else
- this.animation.play( "hypnotized" );
- case LEVITATE, CARRIED:
- if ( this.hypnoTimeCounter > this.awakenTime )
- this.animation.play( "awaken" );
- else
- this.animation.play( "pop" );
- } // end switch
- }
- public function Murder()
- {
- this.kill();
- }
- public function SetHypnoMode( mode : HypnoModes )
- {
- hypnoMode = mode;
- }
- public override function Regen()
- {
- super.Regen();
- width = oldWidth - 8;
- offset.x = 4;
- this.immovable = false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement