Swimming Fish

Type: Prop Brain
Level: 2 star
Pages: 1
Description: Default brain for fish. When in water it swims around in random directions, turning every 5 seconds.

Kode

  1. WHEN [not][on ground] DO [move][at speed][0.1]
  2. WHEN [coundown timer][5][loop][trigger on start] DO [numvar: turn direction][equals][random number][as integer][1][to][2]
  3. WHEN [numvar: turn direction][equal to][1] DO [turn][in direction][right][slowly]
  4. WHEN [numvar:turn direction][equal to][2] DO [turn][in diretion][left][slowly]
  5. WHEN [not][swimming] DO [jump]

Alterations

Improved fish 
This fish has a flapping movement when out of water, and a quick turn if it hits the sides of your pond. You can move the fish into the water and it will swim. Remove it from water and it will flap about.

page 1 @Swimming AI

  1. WHEN DO [up][equals][world up] // ensures fish is upright in the water
  2. WHEN [not][swimming] DO [switch page][page:@out of water]
  3. WHEN [not][on ground] DO [move][at speed][0.1]
  4. WHEN [swimming]
  5. …WHEN DO [numvar:random time][equals][tandom number][as integer][3][to][7]
  6. …WHEN [coundown timer][numvar:random time][loop][trigger on start] DO [numvar: turn direction][equals][random number][as integer][1][to][3]
  7. …WHEN [numvar: turn direction][equal to][1] DO [turn][in direction][right][slowly]
  8. …WHEN [numvar:turn direction][equal to][2] DO [turn][in direction][left][slowly]
  9. …WHEN  [numvar:turn direction][equal to][2] DO [move][at speed][0.2]
  10. WHEN [bump terrain]
  11. ,,,WHEN [started to] DO [turn][angle][180]

page 2 @out of water

  1. WHEN [countdown timer][1]hold time][1][loop] DO [roll]
  2. WHEN [countdown timer][3]
  3. …WHEN [countdown timer][1][hold time][1][loop] DO [roll][invert]
  4. WHEN [swimming] DO [switch page][page@Swimming AI]

Comments are closed.

Website Powered by WordPress.com.

Up ↑

%d bloggers like this: