2
* This file is part of the dis-Emi-A HaXe Library. Copyright (c) edA-qa mort-ora-y
3
* For full copyright and license information please refer to doc/license.txt.
10
import ui.anim.lib.EyePair;
12
class EdgeMonster extends EdgeWalker
14
public function new( game : Game, profile : Int )
16
//profile specifies where it starts and what direction it moves
17
profile = profile % 8;
18
var dir = (profile % 2 == 0) ? GridUtil.cClockwise : GridUtil.cCounterClockwise;
20
dir = GridUtil.reverseCW( dir ); //for second round of monster to go in opposite direction
21
var start = switch( profile % 4 )
23
case 0: Point2.at( 0, 0 );
24
case 1: Point2.at( game.surface.width, 0 );
25
case 2: Point2.at( game.surface.width, game.surface.height );
26
case 3: Point2.at( 0, game.surface.height );
31
new ui.anim.lib.EyePair(),
32
game.global.edgeMonsterSpeed,
33
game.global.edgeMonsterSize
36
//setup optional elements
37
dieSeq = EyePair.seq.SadBlink;
39
actor.actorSetSequence( EyePair.seq.SlowWake, ui.Action.bind( setAlive ) );
42
override function _afterStep( elapsed : Float )
44
//set some actor traits
45
if( game.cursor == null )
48
var dist = sAt.distanceTo( cursorPosition() );
49
if( dist < game.surface.width / 5 )
50
actor.actorSetTrait( EyePair.trait.Mood.Angry );
52
actor.actorSetTrait( EyePair.trait.Mood.Normal );
54
if( dist < game.surface.width / 10 )
55
actor.actorSetTrait( EyePair.trait.Color.Red );
57
actor.actorSetTrait( EyePair.trait.Color.White );