Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Pause?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Aly Abed  
View profile  
 More options Feb 23 2011, 8:38 pm
From: Aly Abed <aabed...@asdubai.org>
Date: Thu, 24 Feb 2011 05:38:42 +0400
Local: Wed, Feb 23 2011 8:38 pm
Subject: Pause?
Hey,

I'm a new member here, and new to the groups thing, I hope this will be very beneficial for me.

Anyway, my question is, is there a code to make a pause button? So when I'm running the game, all I have to do is pause the game, go somewhere and I can go and unpause the game.

Thanks
Aly


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Kölling  
View profile  
 More options Feb 24 2011, 1:26 pm
From: Michael Kölling <M.Koll...@kent.ac.uk>
Date: Thu, 24 Feb 2011 18:26:13 +0000
Local: Thurs, Feb 24 2011 1:26 pm
Subject: Re: [Greenfoot Discuss] Pause?
Well, the obvious and trivial answer would be to use the Greenfoot built-in Run/Pause button. Is there a reason not to use this one?

If you don't want to stop your scenario cold, but have a reason to keep it running while it's logically stopped, then you would need to make every actor stop acting. There are various ways to do this.

You could add a button on your screen that sets a boolean 'stopped' in the world, and all actors can check this flag (maybe via a world.isStopped() method).

So, at the top of the actor's act method, you could add

  if (world.isStopped()) {
      return;
  }

(assuming 'world' holds a properly typed world instance).

In fact, you could make a superclass 'StoppableActor' that all your actors that should stop inherit from and put it in there.

Michael

On 24 Feb 2011, at 01:38, Aly Abed wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »