Skip to content

Latest commit

 

History

History
66 lines (44 loc) · 1.48 KB

README.md

File metadata and controls

66 lines (44 loc) · 1.48 KB

Switch Game - is an Engine to create games based on python. It supports some sprites like a StaticSprite, AnimatedSprite and many useful classes such as Image, Animation, Tileset and other. This project is in development, but you can already use it in your games.

Wiki

Import

from SwitchGame import *

How to create window

from SwitchGame import *


app = WindowLoop(Vec2(1000, 600))

def main():
    while True: # mainloop
        app.update_display()


if __name__ == "__main__":
    main()

Basic class

from SwitchGame import *


class Main(WindowLoop):
    def __init__(self) -> None:
        super().__init__(Vec2(1000, 600), 165)
    
    def update_events(self, __event) -> None:
        if __event.type == KEYDOWN:
            print("key pressed")

        else:
            super().update_events(__event)
    
    def main(self) -> None:
        while True: # mainloop
            self.update_display()


if __name__ == "__main__":
    Main().main()