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

2017/3/7

I keep getting an Error saying Shiny cannot be cast to Seagull

Junyi Junyi

2017/3/7

#
Seagull a = (Seagull)getOneIntersectingObject(Shiny.class); if( a!= null) { stomach++; getWorld().removeObject(a); if( stomach == DEATH) { getWorld().removeObject(this); } } }
Nosson1459 Nosson1459

2017/3/7

#
If you want to check for a collision with Shiny class then do:
Shiny a = (Shiny) getOneIntersectingObject(Shiny.class);
// to check for Seagull do
Seagull a = (Seagull) getOneIntersectingObject(Seagull.class);
You need to login to post a reply.