' ---------------------------------------------------------------- ' NEW TIMER TICK METHOD ' ---------------------------------------------------------------- Dim x, y, pass As Integer For pass = 1 To 2 For x = 1 To myWidth For y = 1 To myHeight Dim thing As OceanElement = getObject(New Point(x, y)) If (GetType(SeaCreature).IsInstanceOfType(thing)) Then ' Cast the thing to a sea creature Dim creature As SeaCreature = CType(thing, SeaCreature) ' This is a sea creature; is it a fish? If (GetType(Fish).IsInstanceOfType(thing)) Then ' This is a fish; move only if pass 1 If (pass = 1) Then creature.Move(newOcean) End If Else ' This is a sea creature other than a fish; move if pass 2 If (pass = 2) Then creature.Move(newOcean) End If End If End If Next Next Next ' ---------------------------------------------------------------- ' SUPERSHARK MOVEMENT CODE ' ---------------------------------------------------------------- Public Overrides Sub Move(ByVal newOcean As Ocean) Dim destination As Point Select Case myDirection Case 1 destination = newOcean.northOf(myLocation) Case 2 destination = newOcean.eastOf(myLocation) Case 3 destination = newOcean.southOf(myLocation) Case 4 destination = newOcean.westOf(myLocation) End Select Dim ate As Boolean = MyBase.Hunt(newOcean, destination) If ate Then ' There was a fish so I'm full myHunger = 0 Else ' No fish so I get hungrier myHunger = myHunger + 1 If myHunger <= 5 Then ' I'm not so dead, so I can still swim myLocation = destination newOcean.putObject(Me) End If End If myTicksUntilBreed = myTicksUntilBreed - 1 End Sub