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

mjrb4's Comments

Back to mjrb4's profile

One other thing (and this is just me being extremely picky) with scenarios like this it makes sense to have the speed at 100% since the faster the speed the smoother the movement. Just a small tip :)
mjrb4mjrb4

2008/7/14

Has anyone managed to get past the first alien?
mjrb4mjrb4

2008/7/14

New version now uploaded - it doesn't seem to want to overwrite it onto this one though.
My mistake - to avoid confusing people, the comment: //Get the value in radians and cast to an int shouldn't have the int cast bit in, that's not done until the last line. Not very awake today!
Hi :) The problem is in your getRotationToPoint method - it doesn't quite do what you want all the time. There's also a much shorter (and simpler) way of accomplishing it - there's a method in the Math class called atan2, and this returns the rotation based on the distance (in x and y values) from a certain point. So if you replace the method with something like this: //Get the distances to the mouse in x and y co-ordinates int dX = x - getX(); int dY = y - getY(); //Get the value in radians and cast to an int double rotation = Math.atan2(dY, dX); //Convert to degrees rotation = Math.toDegrees(rotation); //Need to cast the double to an int return (int)rotation; ..it should work as you want. The above can be condensed into a single line - I usually write it in 2 or 3 lines to avoid confusion, in this instance I've typed and commented the whole thing out fully so you can see what's going on.
Nice start - some form of levels and making the score easier to read and perhaps adding lives would be my suggestions personally.
Simple and effective! Can't say the music is really my thing but ya can't have everything :P
Ah it's hard! I can't do it!
If this could be fixed it'd be good - I'm wondering how it compares to my space invaders one :)