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

2013/5/3

Anyone help on making the collision code?

Laurynas281 Laurynas281

2013/5/3

#
public void act() { if (Greenfoot.isKeyDown("left")) { setRotation (getRotation() - 5); } if (Greenfoot.isKeyDown("right")) { setRotation (getRotation() + 5); } if ("space".equals(Greenfoot.getKey())) { fire(); } } private void fire() { CatAmmo catammo = new CatAmmo(); getWorld().addObject(catammo, getX(), getY()); catammo.setRotation(getRotation()); catammo.move(40.0); } } The Ammo is already working and shooting perfectly i just want it to detect the dog when it hits him
RedManRocket RedManRocket

2013/5/4

#
Well what you would have to do is put the detection in the dog or CatAmmo class it would be a little something like this and I'm doing in the dog class
You need to login to post a reply.