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

2020/4/10

need help with my file dialog

1
2
3
4
danpost danpost

2020/4/13

#
Cats123 wrote...
whenever i press the arrow keys it just posts a ton of them
I know. You need a boolean field to track the state of the firing key. Any time its value is different that the current state of the key, it means the key just went up or down. Only shoot when the new state becomes the down state.
danpost wrote...
See discussions listed upon searching "shoot once".
Cats123 Cats123

2020/4/13

#
private void fire() { ViralLoad viralload = new ViralLoad(0,0); getWorld().addObject(viralload,getArcX(), getArcY()); viralload.setRotation(-degFull); viralload.move(radius); load.setRotation(-degFull); } LIke this???
danpost danpost

2020/4/13

#
The following would be more like it (so far):
private void fire()
{
    ViralLoad viralload = new ViralLoad(getArcX(), getArcY());
    getWorld().addObject(viralload, getX(), getY()+radius/2);
    viralload.setRotation(-degFull);
    viralload.move(radius);
}
Cats123 Cats123

2020/4/13

#
ok i got that now just need it to move as the circlemeter fills up
danpost danpost

2020/4/13

#
Cats123 wrote...
ok i got that now just need it to move as the circlemeter fills up
Just call updateLoadPosition right after changing the value of degFull (should be two places).
Cats123 Cats123

2020/4/13

#
private void fire() { ViralLoad viralload = new ViralLoad(getArcX(), getArcY()); getWorld().addObject(viralload, getX(), getY()+radius/2); viralload.setRotation(-degFull); viralload.move(radius); updateLoadPosition(); } protected void addedToWorld(World world) { world.addObject(load, 0, 0); updateLoadPosition(); } private void updateLoadPosition() { load.setLocation(getArcX(), getArcY()); load.setRotation(-degFull); load.move(0); } ok i did that and i still have the ViralLoad staying at the bottom and not moving as the meter goes up
danpost danpost

2020/4/14

#
Cats123 wrote...
load.move(0);
ok i did that and i still have the ViralLoad staying at the bottom and not moving as the meter goes up
That would be a problem.
Dr.Blythe Dr.Blythe

2020/4/17

#
*ahem*, really?
You need to login to post a reply.
1
2
3
4