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

danpost's Comments

Back to danpost's profile

@Kartoffelbrot, it is 'Resistance is futile!'.
Updating a scenario is done pretty much the same as uploading it to begin with. As long as you do not change the Scenario name in the dialog box.
Sorry, both 'img' in the above should be 'getImage()'.
It would only take one or two random choices to produce added effect. Try this for the Dot constructor: public Dot() { setImage(new GreenfootImage(15, 15)); getImage().drawRect(Greenfoot.getRandomNumber(2)==0?img.getWidth()-2:0, Greenfoot.getRandomNumber(2)==0?img.getHeight()-2:0, 1, 1); }
Area of sphere is missing. Also, could include trig and integration formulae. Noticed that the text image shadow-flashes during display of formula(e).
Finally, in your world class 'makeDefault' method, add the following condition for the statements in the following block: if (UserInfo.isStorageAvailable()) { GreenfootImage ui = new GreenfootImage(UserInfo.getMyInfo().getUserImage()); ui.scale(100,100); def2.drawImage(ui,getWidth()/2-50,getHeight()/2-50); }
Also, instead of copying each pixel color from one image to the next, just use the GreenfootImage method 'drawImage'. For example you can change one of your MagnifyImage class 'magnifyImage' methods to: public static GreenfootImage magnifyImage(GreenfootImage img) { GreenfootImage image = new GreenfootImage(img.getWidth()/2, img.getHeight()/2); image.drawImage(img, -img.getWidth()/4, -img.getHeight()/4); image.scale(img.getWidth(), img.getHeight()); return image; } and similar for the other one.
Change your MouseActor class act method to this: public void act() { MouseInfo mouse = Greenfoot.getMouseInfo(); if (mouse == null) return; setLocation(mouse.getX(), mouse.getY()); updateImage(); }
'getWorld' return a World object (not particularly a 'Space' object; though it could be one). That is what '(Space)' does. It makes it a 'Space' object. This is called 'typecasting' and it informs the system to look in the 'Space' class for any methods or fields referenced with the World object. Any methods or fields that are declared in the 'Space' class would not be found otherwise.