Skip to main content

A package to create games more easily

Project description

⭐ Simply Game

PyPI Downloads

A module to create games and animations more easily

🚀 Try

🛬 Download

First time:

pip install simplygame

To update:

pip install simplygame --upgrade

To import:

import simplygame as SG

🤖 Features

🚨The project is currently under construction, some features may not work. New features will also be coming🚨

Create a window

The first step in creating a project is to create a window. To do this, simply give it a name and size.

SG.create_window("title", 800, 600)

⚠️ You'll notice that the window will close instantly. To avoid this problem, you need to define a variable that keeps the window open. However, simply doing this will cause the program to crash. To do this, you need to tell it to wait for an event, usually the 'exit' event.

#define a running variable
running = True

SG.create_window("title", 800, 600) #Create a window

while running:
    event = SG.recover_event() #Save event into 'event' variable
    if event == 'exit':
        running = False #And close while loop

Load image into memory

Store image into a variable

SG.load_image(path)

For example:

img = SG.load_image('example.png')

Now, 'example.png' is stored in memory and accessible with the variable 'img'

Events

Several events are possible to be recovered:

  • 'exit' : If user wants to close the program
  • 'pressed': If user press a key
  • 'released': If user release a key
  • 'mouse_motion': If user move the mouse

First Step: Create a variable to store the event

event = SG.recover_event() #This function return the events mentioned before

⚠️ To work, it must be done in the loop 'running'

➡️Example: We want to know if a key is pressed. If so, we print 'hello world'

running = True

SG.create_window("title", 800, 600) 

while running:
    event = SG.recover_event() #Save event into 'event' variable
    if event == 'exit':
        running = False
    elif event == 'pressed':
        print('hello world')

Key

Return pressed or released key

SG.recover_key()

Mouse position

Returns the mouse position

SG.mouse_position()

Return mouse's x position only:

SG.mouse_x()

Return mouse's y position only:

SG.mouse_y()

Update

🚨It is mandatory for a project to have this at the end of its loop, otherwise nothing will happen on screen when you add objects

SG.update()

Reset window

Useful to return to the 'default' window

SG.reset_window()

Change background color

Allows you to enter an RGB value to define a new screen color

SG.window_fill((255,192,203)) #Have a pink window

⚠️ It is better to create a variable to avoid parentheses problems:

PINK = (255,192,203) #Declare a variable with color
SG.window_fill(PINK) #Use variable to have a pink window

FPS

Change the project's FPS 🚨We recommend applying '60'

SG.tick(60)

Draw a rectangle

To draw a rectangle, you need to know the x,y position of the top-left point. You then need to specify its length, then its width. Finally, give it a color.

Use:

SG.draw_rect(x,y,width,height,color)

➡️Example: We want a square that is 50px by 50px. Blue in color.

BLUE = (0,0,255)
SG.draw_rect(0,0,50,50,BLUE)

Draw a circle

To draw a circle, you need the x,y position of its center, its radius and its color

Use:

SG.draw_circle(x,y,radius,color)

➡️Example: We want a 100px by 100px circle in the middle of the screen. It's red.

RED = (255,0,0)
SG.draw_circle(400,300,100,RED)

Draw a pixel

To draw a circle, you need the x,y position of its center, its radius and its color

SG.draw_pixel(x,y,color)

Draw a image

To draw a image in the same folder of the current file, after import it

SG.draw_image(img, x, y, transparency)

🚨Transparency = 255 by default

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

simplygame-1.0.7.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

simplygame-1.0.7-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file simplygame-1.0.7.tar.gz.

File metadata

  • Download URL: simplygame-1.0.7.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for simplygame-1.0.7.tar.gz
Algorithm Hash digest
SHA256 de1d9a350cb07add9382c96673855a5e95f385e1370419d7c94af8f1eecab358
MD5 56eefd7b283a54dae67ebdc69fd45d99
BLAKE2b-256 6fd8cb311e68886c815e44adba9ea4bbb70247201c9dd027b0bea5de67166850

See more details on using hashes here.

File details

Details for the file simplygame-1.0.7-py3-none-any.whl.

File metadata

  • Download URL: simplygame-1.0.7-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for simplygame-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 911af65f6860f34ba3f451d785bfa44c52d0b3eeeba764c2a7c38286c07840e2
MD5 137c0acd361867b5c53e6942e3b9e01c
BLAKE2b-256 103f18428fc08375d3e2f894502c8777624d24483196426eeaffbbad26e89cd8

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