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
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')
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*)
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file simplygame-1.0.5.tar.gz.
File metadata
- Download URL: simplygame-1.0.5.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d872a885219b4a3e3b4d6715ad253d649ed282f87ae36237078c40127c4ca8e9
|
|
| MD5 |
2bc288fe3d9f58bb44c898cdad0ed991
|
|
| BLAKE2b-256 |
2d5f578a75ee191392099bb37d53a7333c701de00b2f7c7f9194684b7732f8cf
|
File details
Details for the file simplygame-1.0.5-py3-none-any.whl.
File metadata
- Download URL: simplygame-1.0.5-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4948bfbfbdc92a4bc2c92eb52e63bb888b97b8a946da7bf4901a8356ab27eb03
|
|
| MD5 |
5b6fe3e94c107eea0a4dff1024879be9
|
|
| BLAKE2b-256 |
1232c249dd7b4412b0fa9f9430f27aea33b3a242c575ad482e6c2842f5fa994a
|