This site requires JavaScript, please enable it in your browser!
Greenfoot back
VIvek_Rajagopal
VIvek_Rajagopal wrote ...

2015/3/31

How to getImage() from a location by using getIntersectingObjects() and compare a default image ?

VIvek_Rajagopal VIvek_Rajagopal

2015/3/31

#
I have to assign like this for comparation,
rimage = wred.png; //wred.png image to rimage
yimage = wyellow.png; //wyellow.png image to yimage
gimage = wgreen.png; //wgreen.png to gimage
I should get the image "wyellow.png" located on the location "550,700" by using getIntersectingObjects(); method. Because, my car moves from a location near to the traffic light's location. My car should detect the traffic light in a distance of 5. So I tried like this,
getIntersectingObjects(5, true, TrafficSignal.class);
I need to compare ,
if ( getImage() == rimage)
{
    pause();
}
elseif( getImage() == yimage)
{
   pause();
}
elseif( getImage() == gimage)
{
  move(1);
}
Please help me to fix this project !
VIvek_Rajagopal VIvek_Rajagopal

2015/3/31

#
I am waiting for a good reply from Specialists ! I need to complete this project in 4 hours !.. I am counting the time here ! Please help me !!
danpost danpost

2015/3/31

#
What does your 'getIntersectingObjects(int, boolean, Class)' look like? I mean, there is no method with that signature located in the Actor class documentation, so I must assume that you coded one. If you have not and are just trying things blindly, maybe you should look at the Actor class documentation and see what methods are available and choose one that may be best suited to your needs.
VIvek_Rajagopal VIvek_Rajagopal

2015/3/31

#
I have created like this,
getIntersectingObjects(10, true, TrafficSignal);
Being honest, I don't know how to understand things from the API documentation. Please tell me a way to stop and move the car according to the detected image.
You need to login to post a reply.