I know, I'm not worried though, the squares are just temporarily something to shoot at. I probabily speant more time trying to hit them with the slingshot in the scenario than writing the code for them!
Thanks kiarocks! @BuilderBoy have you done any work on your rigid body collision solver? I would be interested to see how you would approach the problem.
Try changing the position of Mario by an amount less than one, and then casting it back to an int when you setlocation(). For example, I don't know how you coded it, but you can trysomething like this:
double mariolocationx; // the x location of mario
double speed = 0.7; // the speed of mario
if (Greenfoot.isKeyDown("right")) {
// change location of mario by less than one
mariolocationx += speed;
}
... // other code
// now set the location...
setLocation((int) mariolocationx, etc...);
if that makes any sense. just make sure the location is a double. Don't do
setLocation(getX() + (int) speed,..);
if speed is a double, because I think it will get rounded to the same nearest int every time, and that won't work.
Here's the source code if you wanted to see it, keep in mind I am pretty much a beginner but that might be obvious! I'm holding off on fininshing this right now, but I will come back to it after I am done with this Java book that I'm reading.
2011/9/11
SlingShot
2011/9/9
A* Pathfinding
2011/9/6
Nightmare: Emergence
2011/9/3
SlingShot
2011/8/29
Donkey Kong Remake
2011/8/29
Donkey Kong Remake
2011/8/28
3d Haus
2011/8/9
Holdem
2011/8/6
Holdem