Skip to main content

A small library for creating objects, game sims, and physics in python, more things coming soon

Project description

GoofPy

A library for creating objects and game sims in Python, more things coming soon

Currently supports:

  • Pygame
  • GameObjects
  • Players
  • Games

Current limitations:

  • 3D objects are somewhat limited and may be broken, movement on the z-axis, especially for the Player class is not fully supported
  • Pygame window is buggy, runs at 1x1 scale by default, but even when changed, is impossible to close using the "X" in the top right or Alt + F4
  • No renders, and no built-in rendering capabilities planned, however, Pygame support would help users make renders

Docs:

  • goof class: Takes ID(int) and meta(any)

    import goofpy
    
    obj = goofpy.goof(0, "TestMeta")
    
    

    Class functions: getID(), getMeta(), and setMeta(value), are properties of any goof class, self-explanatory The below are not part of the goof class but relate to it.

    • getObjectByClass(class) returns all instances of a certain class
    • getMetaById(id) is self-explanatory
    • compareMeta(originalID, newID) gets the meta of the object based on id, returns True if the 2 are equal
    • getObjsWithMeta(meta) returns all objects with a particular meta value
  • GameObject class: Takes an ID, x, y, z, data, type, can take zIndex(default is 0)

    import goofpy
    
    obj = goofpy.goof(0, "TestMeta")
    gObj = goofpy.GameObject(obj.goofid, 
    

    Class functions: There are class functions, but most are either self-explanatory or are useless to the user, because there are much simpler ways with the Creator class

  • Creator class: Takes no parameters

    import goofpy
    
    c = goofpy.Creator()
    

    Class functions:

    • givePosition2D(obj: goof, x, y, zIndex) takes these variables and creates a GameObject with them, with a set z of 0.0, a data of "", and a type of "2D"
    • givePosition3D(obj: goof, x, y, z) same as givePosition2D but gives a z of z and a type of "3D", and doesn't change zIndex
    • new2D(x, y, zIndex, data) same as givePosition2D but passes in data and doesn't pass in an object
    • new3D(x, y, z, data) same as new2D but passes in a float of z and not zIndex
  • Player class: Takes a x, y, z, facing, and fov

    import goofpy
    
    p = goofpy.Player(0.0, 0.0, 0.0, 0, 90)
    

    Class functions:

    • isColliding(obj) tests if the player is colliding with an object
    • canSee(obj) tests if obj is being faced at by the player,

    uses THE BEST FUNCTION IN ALL OF PYTHON, math.atan2(y, x)

    • move(d) moves d units in the direction the player is facing
    • turn(deg) turns the player deg degrees(positve or negative, loops from 0-360, cannot be > 360)
  • Game class Optionally takes width and height, if you want an actual window/render, and the module for the engine, default and ONLY CURRENTLY SUPPORTED engine is pygame

    import goofpy
    
    g = goofpy.Game()
    

    Class functions:

    • initEngine() starts the engine, required for using other Game class functions
    • keyPressed(key) tests if the key named key
    • runAtFPS(fps) ticks the game at fps frames per second
    • getEvents() returns all events from the last tick
    • run(gameFunction, fps) runs the game, using gameFunction() as the code and setup for the game, and running it at fps frames per second, easier alternitve to custom setup, but more limited and standard

Support:

  • Email business.endergames@gmail.com for additional help or feedback

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

goofpy-0.2.2.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

goofpy-0.2.2-py3-none-any.whl (2.7 kB view details)

Uploaded Python 3

File details

Details for the file goofpy-0.2.2.tar.gz.

File metadata

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

File hashes

Hashes for goofpy-0.2.2.tar.gz
Algorithm Hash digest
SHA256 a1b5c29dd25d595d3cbe7c82030afc6d9cf58d6ffcdbaf85edb1bb3b6755080a
MD5 55f928cd9107cf65671ed7aab32ff7cb
BLAKE2b-256 6062f3a2ba4e6ab89d17a6f0444b6e479f90393070955c1db9b2c50587e1ec31

See more details on using hashes here.

File details

Details for the file goofpy-0.2.2-py3-none-any.whl.

File metadata

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

File hashes

Hashes for goofpy-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e0bc528a700f49654a8e7299ac84953bbe4ea6d4beaa98049a1162a9921b62d9
MD5 a47a4b3e98a278d8d04455fb348a465f
BLAKE2b-256 58b55e219c71d5205befa37e3f436b0ee93b261cf4f16ecd78ac1c83f2db6d22

See more details on using hashes here.

Supported by

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