Skip to main content

A package to create games more easily

Project description

⭐ Simply Game

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

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)

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.6.tar.gz (3.9 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.6-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: simplygame-1.0.6.tar.gz
  • Upload date:
  • Size: 3.9 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.6.tar.gz
Algorithm Hash digest
SHA256 c958870a02fcb5a8a1ad8735f410734caf53d1ed43677c5710add3be5761ff0f
MD5 0b0c3d916f60ff5e7036507259fe53fd
BLAKE2b-256 ba9d144b442dd3bcdaa723254bbcad5eab903fbb34b4624d14331b061b0b55a8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: simplygame-1.0.6-py3-none-any.whl
  • Upload date:
  • Size: 4.3 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 07b95720af8ca853a1d0d7352435d47f9fe8b842e1260808f138a13da6950c53
MD5 4179efbfd007be12ac3159a755b2b78e
BLAKE2b-256 508e87566d55bcb79bdf084bb0a6cac9528edbea6fec854cafa5a4d9b412c703

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