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

2013/10/10

how do i do this?

javanoob javanoob

2013/10/10

#
I want to make the bullet to go sideways from specific location , but it is only going up or down. How do i make this happen?
erdelf erdelf

2013/10/10

#
maybe u should show us your code, and we can help u
javanoob javanoob

2013/10/10

#
this is for bullet private int speed = -20; /** * Act - do whatever the bullet3 wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { setLocation(getX(), getY() + speed); } and this is for the shooter
 if (Greenfoot.isKeyDown("x"))
        {
            if (timer == 0)
            fire();
        }
}
public void fire()
{
    getWorld().addObject(new bullet3(), getX() -14, getY());
    timer = +5;
    if ( timer >= 5 )
    timer = 0;
}
danpost danpost

2013/10/11

#
Apply 'speed' to 'getX' instead of 'getY' (in your act method).
javanoob javanoob

2013/10/11

#
thank you~~ XD
You need to login to post a reply.