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

2018/2/21

making pics smaller

EmperorHaddad EmperorHaddad

2018/2/21

#
how do u make images smaller?
danpost danpost

2018/2/21

#
The is a 'scale' method in the GreenfootImage class. See the documentation. Be aware the multiple scaling can distort an image (that is to say, in general, only scale an image once).
EmperorHaddad EmperorHaddad

2018/2/21

#
its says error when i put in the code and i don't know where to put it in this: import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class Bullet here. * * @author (your name) * @version (a version number or a date) */ public class Bullet extends Animal { /** * Act - do whatever the Bullet wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { setLocation(getX() + speed, getY()); checkBoundaries(); destroyEnemies(); } public void checkBoundaries() { if(getX() > getWorld().getWidth() - 1) getWorld().removeObject(this); else if(getX() < 1) getWorld().removeObject(this); if(getY() > getWorld().getHeight() - 1) getWorld().removeObject(this); else if(getY() < 1) getWorld().removeObject(this); } public void destroyEnemies() { //"Enemy" can be any class that you want the bullet to destroy. Actor enemy = getOneIntersectingObject(player.class); if(enemy != null) { getWorld().removeObject(enemy); getWorld().removeObject(this); } } private int speed = 10; }
danpost danpost

2018/2/21

#
What did you try? Where did you try it? What error did you get (specify each and link them to what you used when that error occurred)?
You need to login to post a reply.