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

danpost's Comments

Back to danpost's profile

danpostdanpost

2012/3/22

matt.milan is right! You need to do something about the size of your world -- get it to match your maze somehow. maybe a cell size of about 40; but all your references and values to locations in the world would have to be adjusted to match.
Cannot quite seem to get the speed right. Either it is too fast, or I get a hesitating action throughout.
@kiarocks, does it match your computers grapher now? (I made it so when the exponent was '1/2' or '1/3', it would use Math.sqrt or Math.cbrt, instead of using Math.pow(factor, exponent)).
danpostdanpost

2012/3/21

Is this a school project? I have seen a couple of these that look strikingly similar.
I do not think Math.pow can handle taking negative numbers to non-integer powers.
@kiarocks, I could not say. Find a x value where they are different, and find out which has the y value that is correct. Then report back.
danpostdanpost

2012/3/20

First off, in the world class, move what you have in the act method up into the constructor where those statements belong. Secondly, why, in the world class, are you adding this.getWidth() and this.getHeight() (which are returning the width and height of your world) to the x and y of where you are adding the objects into the world at? That will place them outside of your world (that is why they all appear at the lower right corner of your world window).
danpostdanpost

2012/3/20

Couple of things that could have made making this a lot easier (1) Using a grid size of 24 would have saved a lot of calculations (other advantages as well) (2) Using block as background and adding a plain gray square (Pad) for each area of path (instead of blocking non-path, and leaving path empty). This way, when moved, if (getIntersectingObjects(Pad.class) != null), then good move else not (avoids checking if valid location and referring to original array in world class). Also, the Pad.class objects could have instance variables to track number of direction choices from it, as well as, if checked for real path, and if is actual path or not. Another thing you could do, is use a double int array instead of a single int array (int[][] as opposed to int[]) for the lvlArray. With that lvlArray.length() would be the number of rows and lvlArray[0].length() would be the number of columns. These suggestions would allow you to create more levels with ease (at least the grid-size one, and the double int one)
Thanks, kiarocks.