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

2013/11/19

need help with...

capylego capylego

2013/11/19

#
im making a game and i want to use mouse control but when i put in the code i get an error message. heres my code for using the mouse to shot and aim. private void fire() { MouseInfo m = new MouseInfo(); if (reloadDelayCount >= gunReloadTime && m.getButton() ==1) { Greenfoot.turnTowards(m.getX(),m.getY()); Bullet bullet = new Bullet (); getWorld().addObject (bullet, ppl1X, ppl1Y); bullet.move (10); reloadDelayCount = 0; } the message i keep getting is Mouseinfo() is not public in Greenfooot.mouseinfo; cannot be accessed from outside package. what does this mean and what do i do
danpost danpost

2013/11/19

#
This: MouseInfo m = new MouseInfo(); is not how you get a MouseInfo object. Refer to the Greenfoot class API to find the method you need. You will find this part not to work either: Greenfoot.turnTowards(m.getX(),m.getY()); as 'turnTowards' is not a method of the Greenfoot class.
You need to login to post a reply.