1. Arne Babenhauserheide
  2. fungus


fungus / fungus_hexbattle.py

The default branch has multiple heads

#!/usr/bin/env python
# encoding: utf-8

"""The hexbattle game scene.


- Get mouse position
- Add hexgrid. hex over which the mouse is gets highlighted.
- Add a charakter on the hexgrid.
- Beam the Charakter (click, then click new position).
- Let two charakters fight (click, then click other char). Who dies disappears  (→ to “died” list)
- Add several charakters and cycle through them in each round. All player controlled.
- Add movement on the grid with forbidden fields (different for final position and intermediate: Final not on anyone, intermediate not adjadent to an enemy).
- Add basic AI. Guess maximum effect per round up to the units next attack (single step, no complex tactics → all attack the weakest point). 

#### Call the correct fungus_game when called from the command line or clicked in a GUI ####

if __name__ == "__main__": 
    # Call this Scene via fungus_game
    # For this to work, the main scene inside the module MUST be the class with the name "Scene"
    from fungus_core import call_this_scene
    # pass the commandline args
    from sys import argv
    call_this_scene(__file__, argv)

#### Imports ####

from fungus_scene import BaseScene, key, MethodNotImplemented

#### The Hexbattle Scene  ####

### Things needed for the scene

IMAGE_BLOB = "blob.png"

### The Scene itself. 

class Scene(BaseScene): 
    """The Hexbattle Scene."""
    def __init__(self, core, *args, **kwds): 
        """Initialize the scene with a core object for basic functions."""
        super(Scene, self).__init__(core, *args, **kwds)
        self.blob = self.core.sprite(IMAGE_BLOB, x=212, y=208)

    def update(self): 
        """Update the stats of all scene objects. 

Don't blit them, though. That's done by the Game itself.

To show something, add it to the self.visible list. 
To add a collider, add it to the self.colliding list. 
To add an overlay sprite, add it to the self.overlay list. 

    # mouse control
    def on_mouse_motion(self, x, y, dx, dy):
        self.blob.x = x
        self.blob.y = y

    def on_mouse_press(self, x, y, buttons, modifiers): 
        """Forwarded mouse input."""
    def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers): 
        """Forwarded mouse input."""
    def on_mouse_release(self, x, y, buttons, modifiers): 
        """Forwarded mouse input."""

    def on_mouse_scroll(self, x, y, scroll_x, scroll_y):

    def on_mouse_enter(self, x, y):

    def on_mouse_leave(self, x, y):