Skip to main content

basic pygame engine

Project description

Ogzoengine

This game engine is based on pygame. Our goal is to make it easy for people, even those who don't know python or coding, to create games.

If you want to get started with this game engine by creating a sample game,

How to Download

First, you need to download Python. You can do this by going to the Python official website and downloading it according to your operating system.

After downloading, to check, you can write this code in the terminal or CMD:

python --version

If the result is Python 3.11.5 or higher, you are ready to download the game engine. You can do this by typing the following code in the terminal or CMD:

pip install ogzoengine

Download a code editor of your choice. Recommended code editors are:

  • Visual Studio: It has powerful debugging and code completion features but can be challenging for beginners and takes up a lot of space. Visual Studio Code Download Page
  • PyCharm: Specifically made for the Python language, it provides a fast and efficient coding experience but the full version is not free. PyCharm Download Page
  • Sublime Text: It's fast and lightweight, offering quick performance, but the full version is paid and updates are not frequent. Sublime Text Download Page
  • Atom: It has good auto-completion and provides GitHub assistance with integrated Git support, but it may cause high memory usage for some users. Atom Download Page
  • Notepad++: It's simple and takes up less storage space, but it has a poor interface and lacks features like code completion. Notepad++ Download Page

Coding

First, we import the library and then add the screen and input process.

import ogzoengine

screen = ogzoengine.GameEngine()
input = ogzoengine.Input()

We set the size and title of the screen. The 1st value represents width, the 2nd value represents height, and the 3rd value represents the title.

screen.set_screen(800, 600, "Test Game")

We set the background color using the RGB code.

screen.set_background((0,0,0))

We create a function for the game loop.

def whiles():

Inside the game loop function, we set the drawing basics.

                         # (start_x, start_y, x_end, y_end, rgb_code, thickness)
    line1 = ogzoengine.Line(250, 300, 130, 130, (255,255,255), 5)
                             # (x_position, y_position, size, rgb_code)
    circle1 = ogzoengine.Circle(100, 200, 50, (255, 0, 0))
                             # (x_position, y_position, x_size, y_size, rgb_code)
    square1 = ogzoengine.Square(400, 400, 50, 50, square1_color)
                            # (x_position, y_position, text)
    #image1 = ogzoengine.Image(400, 200, "img.png")
                         # (x_position, y_position, text, font_location, font_size, rgb_code)
    text1 = ogzoengine.Text(50, 50, "No font text", None, 20, (255, 255, 255))

We draw the shapes.

    line1.draw(screen.screen)
    circle1.draw(screen.screen)
    square1.draw(screen.screen)
    #image1.draw(screen.screen)
    text1.draw(screen.screen)

We set the screen to clear when the ESC key is pressed.

                   #(check keyboard library for key codes)
    if input.pressed('esc'):
        # Colors the screen to the selected background and clears all drawings made up to that point.
        screen.clear_screen()

We specify the name of the function we want to repeat.

screen.use_while(whiles)

We create functions for touching and clicking the square.

    if square1.mouse_touch():
       print("The mouse is touching the square")
    if square1.mouse_clicked(screen.mouse_pressed, screen.mouse_click_type, 1):
        print("The square is clicked")

We read the position and status of the mouse.

    # Read the mouse position
    mouse_pos = screen.get_mouse_pos()
    # Read the mouse status
    mouse_type = screen.get_mouse_info()

Run the screen

screen.run()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ogzoengine-1.3.5.3.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ogzoengine-1.3.5.3-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file ogzoengine-1.3.5.3.tar.gz.

File metadata

  • Download URL: ogzoengine-1.3.5.3.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for ogzoengine-1.3.5.3.tar.gz
Algorithm Hash digest
SHA256 473452c8a13d6c896b55cddf3bca0f684b667db3a4eedabb60677f30f2eecd60
MD5 4de9380c920a7cbb11cd703980366886
BLAKE2b-256 a51c8aa9ae25e972e7977c14cd5994f761ddac62f82137b5f653c6b05ed7efe8

See more details on using hashes here.

File details

Details for the file ogzoengine-1.3.5.3-py3-none-any.whl.

File metadata

  • Download URL: ogzoengine-1.3.5.3-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for ogzoengine-1.3.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 06d4f7d11b6e99f562b320771db643c3026b2c2c6c8b7ce7ac6b3f3fed10b3af
MD5 eb785121cd7e749e4ac49af236ecce69
BLAKE2b-256 0067608ea0bfbd8b3f3f77332f4cc3174c2d2d9b4fb0328f339d04409259a47d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page