[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Game State Switching Example
i use the state change raising a ChangeState( newstate ) exception, and the loop are ready for try and except this and change the value self.state
Good luck
2007/7/19, Simon Oberhammer <
simon.oberhammer@xxxxxxxxx>:Thank you, kschnee... looks good to me - I will use that in my next game. But imho adding the widget/interface info+sampleclass is too much for an otherwise nice and simple cookbook-entry
simon
ps.: And you code tells me that calling 'screen' what you call 'state' is not too far fetched ;-)
> next_screen = self.game_state.pop()
On 7/17/07,
kschnee@xxxxxxxxxx
<kschnee@xxxxxxxxxx> wrote:
I found a better way than I'd done before to switch between the various
states of a game, such as a main gameplay screen and a status screen.
Attached is some example code. Something for the Cookbook, maybe?
--
Juan José Alonso. KarlsBerg.
eMail: kernel.no.found@xxxxxxxxx
MSN:
kernel.no.found@xxxxxxxxx