Description
This is a demonstration of how Python can be used along Pyside to create very dynamic applications in Maya.
Disclaimer: We don’t own any Nintendo characters, and the purpose of this script is purely experimental and educational.
It is by no means a perfect videogame engine as you will notice by the imperfect collisions, and there are some libraries that can be used such as pygame if you want to properly develop a game. However, this example does not use any external library and relies completely on standard python and math for collisions.
The static sprites are QLabels, while the animated ones are a collection of QWidgets and QLabels, switching to give the appearance of animation.
The current example contains only a few objects to play with, with no event happening if Mario drops down the edge. You will need to close the window and restart it.
USAGE (Python build is for Maya 2017 and 2018 only):
Unzip the contents into your maya/scripts/ folder. Then in a Maya script editor’s python tab, type this:
import MarioTribute
MarioTribute.run()
This will open the window with the Mario game. Pressing the left key and right key moves Mario around (If Mario if invisible when you first run the game, just press the keys and Mario will appear). To jump around, use the Left Mouse Click.
Click on the left buttons on the sidebar to create new objects. These object will interact with Mario instantly!
IMPORTANT!
Use an exclusive Maya session for this example. Do not run in your current scene or project, or save before you open. If left running for a very long time, it will exhaust the QTimer and Maya can crash!
Have fun