Search code examples
pythonanimationsceneasciimaticscross-hair-label

How can i move to the next scene with cross_hairs in python asciImatics?


Im new to using asciimatics, and im playing around with it to make a game. However, when i add a cross_hairs to a scene, it wont move to the next scene. How can i move to the next scene when i have cross_hairs?


Solution

  • Assuming you are using something very similar to this sample, asciimatics is playing a Scene with 2 or more Sprites.

    If so, this sample already allows you to move to the next Scene by pressing space. Job done! :-)

    In a little more detail... It relies on the default global key handler to do this. As covered here, it just raises the NextScene exception to tell asciimatics to move on.

    If you want to move to a new Scene based off a different event (e.g. the cross hairs hitting another Sprite), you should just raise that Exception at the time you detect the condition.