swarm-modeling
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Swarm-Modelling] world getObjectAt


From: Paul E. Johnson
Subject: Re: [Swarm-Modelling] world getObjectAt
Date: Tue, 03 Jun 2003 09:26:23 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030225

I can't help unless you tell what exactly you did why/how it did not work.

But consider this:

id someThing = [yourGrid getObjectAtX: x Y: y];
if (someThing != nil)
{
    int certainAttribute = [someThing getCertainAttribute];
   if (certainAttribute == 1)
       {
            //move in a direction
        }
    else if (certainAttribute == 2)
      {
           //move in other direction.
   }
}

This presupposes your class  of objects has a method "getCertainAttribute"


Georg A. wrote:



id someThing = [yourGrid getObjectAtX: x Y: y];
if (someThing != nil)
{
     //tell someThing to do something
}


that's right, but I want to get a object, check its attributes
and if it has a certain attribut I want it to move in one direction
and if it has another attribute I want it to move in another direction

and so far the getObject method didn't work

Georg



--
Paul E. Johnson                       email: address@hidden
Dept. of Political Science            http://lark.cc.ukans.edu/~pauljohn
University of Kansas                  Office: (785) 864-9086
Lawrence, Kansas 66045                FAX: (785) 864-5700




reply via email to

[Prev in Thread] Current Thread [Next in Thread]