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

2017/5/26

MiniMap help

Trystar360 Trystar360

2017/5/26

#
so im making a maze game and i want the actor to be on the map as well as the enemy's. I had just the main actor working like thie i have this
map.getImage().setColor(new Color(0, 255, 253));
        map.getImage().fillRect((int)((xdist + 13) * 4),(int)((ydist + 13) * 4),4,4);
but it draws a line. how do i make it just show a dot where it is ?
danpost danpost

2017/5/26

#
What you have should draw a 4x4 square. Use 'fillOval' to make a dot.
Trystar360 Trystar360

2017/5/30

#
danpost wrote...
What you have should draw a 4x4 square. Use 'fillOval' to make a dot.
Thank you but my problem is it doesnt remove its previous dot so it makes a line of where its been. i just want one dot where it is at that moment
danpost danpost

2017/5/30

#
Oh, I see. You need to retain the base image (one without any dots) and make copies of that and add the dots to each copy to be set as the current image. So,
// if you had the following field that is given an image of a base map
private GreenfootImage base;

// then to update the image of the actor
GreenfootImage image = new GreenfootImage(base);
// add dots to 'image' here
setImage(image);
You need to login to post a reply.