class AbstractBot : Movable { @CostumeAttribute var strength = 4 @CostumeAttribute var speechColor = Color.white() var oddEvenAnimation = true fun canMove( direction : int, other : LookedAt ) : boolean { return other.squashable( direction ) } fun canMove( direction : int) : boolean { return canMove( direction, look( direction ) ) } fun makeMove( direction : int) { val other = look( direction ) if ( other.canPush( direction, speed, strength ) ) { other.push( direction, speed ) } move( direction, speed ) } override fun createAnimation( direction : int ) : Action { // Note. Speed = 8, so it takes 8 frames to get across oddEvenAnimation = ! oddEvenAnimation if ( direction == EAST ) { if (oddEvenAnimation) { return EventsAction( actor, 4, "R1", "R2" ) } else { return EventsAction( actor, 4, "R3", "R4" ) } } else if ( direction == WEST ) { if (oddEvenAnimation) { return EventsAction( actor, 4, "L1", "L2" ) } else { return EventsAction( actor, 4, "L3", "L4" ) } } else if ( direction == NORTH ) { if (oddEvenAnimation) { return EventsAction( actor, 4, "U1", "U2" ) } else { return EventsAction( actor, 4, "U3", "U4" ) } } else { if (oddEvenAnimation) { return EventsAction( actor, 4, "U4", "U3" ) } else { return EventsAction( actor, 4, "U2", "U1" ) } } } }