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

2013/10/25

Can you use something like "isTouching" for colors?

askgriff askgriff

2013/10/25

#
I want to make a game similar to the old "Caverns of Mars" (from my childhood) where I can either randomly generate or paint in Photoshop some cavern walls and navigate a spaceship through them. If the object (rocket/spaceship) touches the edge (i.e. the green border in the example) the object blows up. I may want to build some really graphic mazes and whatnot with Photoshop, so I think a specific target color might be good -- but I have no idea how to do something like that. (Or if it's possible). Thanks in advance.
danpost danpost

2013/10/25

#
The detection for the edges here would be similar to the detection for the actor in my Line Following Demo.
askgriff askgriff

2013/10/25

#
Interesting -- so something like this: if (getWorld().getBackground().getColorAt(getX(), getY()).equals(Color.blue)) Thanks, danpost. I'll give it a shot.
You need to login to post a reply.