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

2018/4/28

Using a GIF

1
2
Yehuda Yehuda

2018/4/30

#
Try adding the following as line 31:
getWorld().removeObject(this);
Now I see more changed posts. If it works then the above is unnecessary.
Miguel.Valdez Miguel.Valdez

2018/4/30

#
Yehuda wrote...
Try adding the following as line 31:
getWorld().removeObject(this);
Now I see more changed posts. If it works then the above is unnecessary.
the GIF is still causing the game to crash.
Yehuda Yehuda

2018/4/30

#
Miguel.Valdez wrote...
and i jsut now saw i still had a Greenfoot.stop() which i did remove.
That means you didn't "show the full Bird class code", otherwise I would have seen that here.
the GIF is still causing the game to crash.
What is meant by that? P. S. I have less than ten minutes left.
Yehuda Yehuda

2018/4/30

#
I would think you should try the above since it does not work. You don't want to endlessly be adding more GameOvers every act cycle.
danpost danpost

2018/4/30

#
Try using this in the bird class:
public void act() 
{
    theEndGame(); // the code is beign called here
} 

public void birdDead() {}// remove  this method

public void silentBirdDead() {} // remove  this method

private void theEndGame()
{
    //Falls off the background.    
    if (getY() >= getWorld().getHeight()-1 && getWorld().getObjects(GameOver.class).isEmpty())
    {
        getWorld().addObject(new GameOver(), getWorld().getWidth()/2,getWorld().getHeight()/2);
        if (GameMusic.isPlaying())
        {
            GameMusic.stop();
            Greenfoot.playSound("sfx_hit.wav");
            Greenfoot.playSound("MBGameOver.mp3");
        }  
   }
}
Miguel.Valdez Miguel.Valdez

2018/4/30

#
danpost wrote...
Try using this in the bird class:
public void act() 
{
    theEndGame(); // the code is beign called here
} 

public void birdDead() {}// remove  this method

public void silentBirdDead() {} // remove  this method

private void theEndGame()
{
    //Falls off the background.    
    if (getY() >= getWorld().getHeight()-1 && getWorld().getObjects(GameOver.class).isEmpty())
    {
        getWorld().addObject(new GameOver(), getWorld().getWidth()/2,getWorld().getHeight()/2);
        if (GameMusic.isPlaying())
        {
            GameMusic.stop();
            Greenfoot.playSound("sfx_hit.wav");
            Greenfoot.playSound("MBGameOver.mp3");
        }  
   }
}
still only made the image show, but did not generate the GIF play
danpost danpost

2018/4/30

#
Miguel.Valdez wrote...
still only made the image show, but did not generate the GIF play
but, no longer crashing, I hoped.
Miguel.Valdez Miguel.Valdez

2018/4/30

#
That I can recall, there was no more crashing...
danpost danpost

2018/4/30

#
Miguel.Valdez wrote...
That I can recall, there was no more crashing...
and the scenario is not stopping (or getting paused)?
You need to login to post a reply.
1
2