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

danpost's Comments

Back to danpost's profile

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.
@kiarocks, I could not say for sure about you using java 6 being the issue. As far as the 'theta' symbol, I think it would be best for me to resolve the stack space issue first, as making things more complicated and adding more method calls would just add insult to injury, if you know what I mean. I already have methods calling methods, that recall methods, etc. to parse formulas input by users.