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

2011/12/21

Game trouble

3
4
5
6
danpost danpost

2011/12/24

#
That is:
public Lemur()
{
    setRotation(90);
    getImage().rotate(270);
}
If after this change, the movement is the reverse of what it should be, switch the 90 and 270.
jdemshki jdemshki

2011/12/24

#
IT WORKED!!! the bombs were firing up so i did this private void fire() { Bomb bomb = new Bomb() ; getWorld().addObject(bomb, getX(), getY()) ; bomb.setRotation(getRotation() - 90); bomb.move(30.0); } i changed the setRotation(getRotation() and told it to -90
jdemshki jdemshki

2011/12/24

#
haha i lied sorry. i did have to switch the 270 and the 90. and then at that point the bombs were coming out hit butt so i changed that rotation like earlier but made it 270 instead
jdemshki jdemshki

2011/12/24

#
how would i increase the rate of random fire for the blocker?
jdemshki jdemshki

2011/12/24

#
nvm figured that last part oout
danpost danpost

2011/12/25

#
Glad your on a roll! :+)
jdemshki jdemshki

2011/12/25

#
bahaha right? now i just need to figure out what to do next
samir samir

2014/2/11

#
hallo im trying to get disappear the ship when its going to out of the world how can i do that? public boolean isOffScreen() { if (getX() < 0 - getImage().getWidth()/2 || getX() > getWorld.getWidth() + getImage(ship).getWidth()/2 || getY() < 0 - getImage().getHeight()/2 || getY() > getWorld().getHeight() + getImage().getHeight()/2) { return true; } return false; } }
danpost danpost

2014/2/11

#
Remove the world 'ship' from line 4. With this method, you can use 'if (isOffScreen()) getWorld().removeObject(this);'. All this is presuming that your world is unbounded (that objects do not stop moving when they are half-way off the edge of the window).
samir samir

2014/2/12

#
hallo, can u please check my code: import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class ship here. * * @author (your name) * @version (a version number or a date) */ public class ship extends schips { /** * Act - do whatever the ship wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { if (Greenfoot.isKeyDown("left")) { move(-8); } if (Greenfoot.isKeyDown("right")) { move(8); } } public boolean isOffScreen() { if (getX() < 0 - getImage().getWidth()/2 || getX() > getWorld.getWidth() + getImage(ship).getWidth()/2 || getY() < 0 - getImage().getHeight()/2 || } 'if (isOffScreen()) getWorld().removeObject(this) } } im really confuse , dont know how to fix it. i actually want that if the first ship get out of the world comes another ship after it,. Regard.
danpost danpost

2014/2/12

#
The last line should be the last line in your act method. Your world needs to be unbounded (if it is not already).
You need to login to post a reply.
3
4
5
6