[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Birth & Death
From: |
lsrjz |
Subject: |
Birth & Death |
Date: |
Tue, 12 Nov 1996 15:59:04 +0000 |
Good Morning Stateside, Good Afternoon Europeans,
My inexperience at OOP and ObjC in particularly is showing through. I am
hacking a Predator-Prey with Pursuit & Evasion out of HeatBugs. I've got the
Run & Chase sorted but am having problems with the eating ie. dying and
birth. This behaviour is determined by code in prey and predator objects
which are subclasses of a common agent object (similar to heatbug). The
predatorList & preyList are created in ModelSwarm (analogous to HeatbugList
in HeatbugModelSwarm).
What is the correct syntax to place in a method of the Prey object to add a
ChildPrey created, in a Prey step, to the preyList. In other words how do I
access methods on the Lists created in ModelSwarm from methods associated
with the list objects. Even though I import "ModelSwarm.h" into Prey.m a
call such as [preyList addFirst: child] doesn't work since preyList is
undefined. I'm going to have the same problem when I get round to death.
I'm obviously not getting the point of the scope rules with ObjC.
Any help gratefully received.
Steve