SimpleGame Module

This module implement a simple Bomberman game. No concrete net yet (just some try : connect all players to a server, and log all move).

Warning

This script is deprecated, don’t use it. Delete me ! I’m useless now...

Can also be used as a program, currently just for testing. ./SimpleGame.py [OPTIONS]

Options:

  • --help, -h

    Exit and print this help message.

  • -v1 Increase verbosity (default).

  • -v2 Increase again ! (not very good).

  • --debug

    Run with pygdb.

  • --noANSI

    Disable colors and escape caracters from ANSIColors. Usefull to run the program with bpython.

  • --noUTF

    Disable UTF caracters for boxes printing. Uggly, but more universal !

SimpleGame.initGame(lx=11, ly=11, nb=3, server=('0.0.0.0', 12882))[source]

Creating all Game variables.

SimpleGame.save_current_game(variables_to_save, info='variables_to_save')[source]

Save all variables content the list variables_to_save, in a .pkl file.

The game can be restored then, by setting all variables equals
to their previous values (of course this only work if the .pkl file is still there).
SimpleGame.main(nbmax, lx, ly, pl, board, Mi, Mj, verb=False, verb2=False, keyBindingList=[North/Up:'['K_z']'; South/Down:'['K_s']'; East/Left:'['K_q']'; West/Right:'['K_d']'; Bomb:'['K_x']'; Help:'['K_h']'., North/Up:'['K_z']'; South/Down:'['K_s']'; East/Left:'['K_q']'; West/Right:'['K_d']'; Bomb:'['K_x']'; Help:'['K_h']'., North/Up:'['K_z']'; South/Down:'['K_s']'; East/Left:'['K_q']'; West/Right:'['K_d']'; Bomb:'['K_x']'; Help:'['K_h']'.])[source]

Big loop to test some behaviour. How to print bombs and bonuses in text mod ? How to move players, allow theme to drop bombs ? Make bombs explosion ?

There are a lot of stuff to work arround !

  • [nbmax] Is max number of players,

  • [lx], [ly] Are lenght of the board,

  • [pl] Is the list of player (represented as Player.Player instances),

  • [board] Is ... the board (represented as Board.Board instance !),

  • [Mi], [Mj] Are list of players’ position to initiate the game,

  • [verb], [verb2] Are option for verbosity of the game,

  • [keyBindingList] Is a KeyBinding.KeyBinding to map key to moves.

    For now, just ONE key (from a to z, A to Z, or ASCII caracters e.g. ~?;/ etc...).

SimpleGame.verb = False

Default = True

SimpleGame.verb2 = False

Default = False

Table Of Contents

Previous topic

Constants Module

Next topic

AffichPygame Module

This Page