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

2013/11/27

Candy smasher: quadratics

RJ13579 RJ13579

2013/11/27

#
Hi, I have a problem with this code and I really don't know how to create the quadratics properly. Can anyone help me with this?
bourne bourne

2013/11/27

#
Where is the code?
RJ13579 RJ13579

2013/11/28

#
public void act() { // Add your action code here. Northpole world = (Northpole) getWorld(); setLocation(getX()+rightspeed,getY()-gravity); gravity -= 1; if (getX() > world.getWidth() - threshold) { //getWorld().removeObject(this); getImage().setTransparency(0); } if (getY() > world.getHeight() - threshold) { getImage().setTransparency(0); } } }
RJ13579 RJ13579

2013/11/28

#
I cant get it to come in contact with my hammer. it is meant to touch the candy and the candy is meant to disappear.
RJ13579 RJ13579

2013/11/28

#
Here is the hammer code : public void act() { checkMouse(); } public void checkMouse() { MouseInfo mouse = Greenfoot.getMouseInfo(); if(mouse!=null){ int button = mouse.getButton(); if(button == 1) { int mouseX=mouse.getX(); int mouseY=mouse.getY(); setLocation(mouseX, mouseY); } } }
You need to login to post a reply.