|
From: | Paul Johnson |
Subject: | Re: [Swarm-Support] return Object color |
Date: | Wed, 16 Apr 2003 08:53:42 -0500 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20021003 |
Get the object, then ask it for its color. Write in your object a method - (int)getColor; maybe it is OK if the return is (Color), I don't recall. Then when you take an object off the grid, you have to cast itto be a certain type of object, say Heatbug, and then use getColor to find its color.
If you have only a few colors, a model like this may go faster if youcreate separate grids, one for each color. That way you know what color you are getting when you take an object out.
Suman Kanuganti wrote:
Ok; my simulation at a place needs the following task: The randomly moving objects in the space created using putObject$atX$Y . Now at some moment for the condition based on some object color i need to change thepresent object behaviour. Here I could make use of getObjectAtX$Y(Object,x,y) ;but i am not able to use it properly. Its description says it returns the pointer stored at x,y. What I need is to read the color of the object at x,y; can i make use of the above method somehow but what it returns for the objects other than null, i dont know. Any one, any suggestions, thanks very much, Suman Kanuganti ===== Suman Kanuganti,Swarm Group, Anth Dept.,
-- Paul E. Johnson email: address@hidden Dept. of Political Science http://lark.cc.ku.edu/~pauljohn University of Kansas Office: (785) 864-9086 Lawrence, Kansas 66045 FAX: (785) 864-5700
[Prev in Thread] | Current Thread | [Next in Thread] |