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

2012/10/21

@nooby123 Some suggestions

Upupzealot Upupzealot

2012/10/21

#
First: Mech the mouse class has a Greenfoot default image, to hide it, add these:
public Mouse()
{
    setImage(new GreenfootImage(1,1));
}
and also the scenario is in pixel art, add some darkness is good, but it just lost it's own style, try to write the darkness class like below:
import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.awt.Color;

public class Darkness extends All {

    GreenfootImage GI_Darkness;
    MechBody mb;
    int width, height;
    int gridSize = 14;

    public Darkness(int width, int height) {
        this.width = width;
        this.height = height;
        GI_Darkness = new GreenfootImage(width,height);
        setImage(GI_Darkness);
        GI_Darkness.fill();
    }

    public void act() {
        UpdateImage();
    }

    private void UpdateImage() {
        GI_Darkness.clear();
        mb = (MechBody)getObjectsInRange(9999, MechBody.class).get(0);
        double mb_X = (double)mb.getX() / (double)gridSize;
        double mb_Y = (double)mb.getY() / (double)gridSize;
        
        for(int i = 0; i < width / gridSize + 1; i++)
        for(int j = 0; j < height / gridSize + 1; j++){
            double dx = (i + 0.5) - mb_X;
            double dy = (j + 0.5) - mb_Y;
            double distance = Math.sqrt(dx * dx + dy * dy);
            int transparency = Math.round(255 * (float)distance / 9);
            transparency = Math.min(255, transparency);
            transparency = Math.max(0, transparency);
            
            GI_Darkness.setColor(new Color(0, 0, 0, transparency));
            GI_Darkness.fillRect(i * gridSize, j * gridSize, gridSize, gridSize);
        }
    }
Upupzealot Upupzealot

2012/10/21

#
And second: there's also a suggestion for Snow(demo) : I already posted a reply
Upupzealot Upupzealot

2012/10/21

#
Wish U'd like my suggestions
Upupzealot Upupzealot

2012/10/21

#
Flickr 上 upzealotMech by nooby123
nooby123 nooby123

2012/10/21

#
Wow thanks! That looks actually pretty cool!
You need to login to post a reply.