Thread history

From Category talk:Code Snippets
Viewing a history listing
Jump to navigation Jump to search
Time User Activity Comment
06:00, 19 December 2011 Blubex (talk | contribs) New reply created (Reply to New Snippet)
20:57, 18 December 2011 Rednaxela (talk | contribs) New reply created (Reply to New Snippet)
20:22, 18 December 2011 Blubex (talk | contribs) New thread created  

New Snippet

I've got a bit of code for going straight to a corner. It needs to be optimized (choose best corner, etc.) but it's really useful for beginners. How do I create a new page in this category for it?

double x = getX() - getWidth() / 2;
    double y = getY() - getWidth() / 2;
    double a = Math.toDegrees(Math.atan(x / y));
		double length = getBattleFieldWidth() - (getBattleFieldWidth() - getX());
		double height = getBattleFieldHeight() - (getBattleFieldHeight() - getY());
		double hypotenuse = Math.sqrt(length*length + height*height); //pythagorian theorum
    turnRight(180 - getHeading() + a);
ahead(hypotenuse - 40);
Blubex20:22, 18 December 2011

Hmmm, I'd suggest you put it either on Corner Movement or something like User:Blubex/Snippets. On whatever page it's on, the page can be added to the category by inserting

[[Category:Code Snippets]]

in it's code.

Rednaxela20:57, 18 December 2011
 

Thanks, making it now.

Blubex06:00, 19 December 2011