# OpenJill project

### Site Tools

jill:algo:bees

This is an old revision of the document!

# Bees

Bees are create by Hive when player is next to.
Bees created with all fields to 0, except with (always 16), height (always 16), y (same that hive), x (same that hive + 8).
Bees kill when iState is 160 (iState increase by 1 at each cycle).
Bees follow player like Knife but goal is bees.x=player.x, bees.y=player.y.

## Algorithme to move bees :

Algorithme may be wrong ! It's very hard, without source code to understand how bees works.

To know size move of bees (iXD or iYD), you must use :

```a = int((state + 7) / 32)
b = a * 32
c = (state + 7) - b```
c 0-3 4-10 11-14 15-26 27-30 31 Comment
moveY -3 to 3 -4 to 4 -3 to 3 0 -1 to 1 -2 to 2 if player is on same Y. If not, use sign to goto palyer
moveX 1 0 1 random(2-4) random(2-4) random(2-4)

Now :

```//iYD// = random(moveY[c])
//iXD// = moveX[c]```

## Animation

iCounter = iState & 3

iCounter player position tileset tile
0 >=0 37 7
1 >=0 37 8
2 >=0 37 9
0 <0 37 4
1 <0 37 5
2 <0 37 6