Margray2D-Engine 0.1
A simple pygame based 2D game engine
License: MIT
Keywords: 2d,game engine

# Margray Game Engine
Margray game engine is a library based on Pygame and very easy to learn
## Margray game engine basics
#### Creating a window
```python
from margray import *

engine = MargrayGameEngine()

window = engine.create_screen("1000x500") # Create the window with the resolution 1000x500

while True:
	for ev in engine.run(): # engine.run() returns events passed to the window
		event = Events(ev)
		event.enableAutoQuit(engine) # Automatically Quites if the user clickes the "X" button
	engine.update() # Make sure to update the game All the time
```
**OR**
```python
from margray import *

 
engine = MargrayGameEngine()

window = engine.create_screen((1000,500)) # Create the window with the resolution 1000x500

while True:
	for ev in engine.run(): # engine.run() returns events passed to the window
		event = Events(ev)
		event.enableAutoQuit(engine) # Automatically Quites if the user clickes the "X" button
	engine.update() # Make sure to update the game All the time
```

#### Creating a Sprite
```python
from margray import *

 
engine = MargrayGameEngine()

window = engine.create_screen("1000x500") # Create the window with the resolution 1000x500

# The 1st parameter is the Color and 2nd is the Position and 3rd is the Size

sprite = engine.sprite((255,255,255),(100,100),(75,75)) # Creating the sprite

while True:
	for ev in engine.run(): # engine.run() returns events passed to the window
		event = Events(ev)
		event.enableAutoQuit(engine) # Automatically Quites if the user clickes the "X" button
	sprite.draw() # Drawing the sprite
	engine.update()
```
#### Creating a Sprite with Image
```python
from margray import *


IMAGE_PATH = ""  # Your image path

engine = MargrayGameEngine()

window = engine.create_screen("1000x500") # Create the window with the resolution 1000x500

# The 1st parameter is the Image path and 2nd is X position and 3rd is Y position and 4th is Size

sprite = engine.image_sprite(IMAGE_PATH,100,100,(50,50)) # Creating the image sprite

while True:
	for ev in engine.run(): # engine.run() returns events passed to the window
		event = Events(ev)
		event.enableAutoQuit(engine) # Automatically Quites if the user clickes the "X" button
		
	sprite.draw() # Drawing the image sprite

	engine.update()
```
#### Creating an Animated sprite
```python
from margray import *

  

IMAGES = ["image1","image2","image3","image4","image5","image6","image7"] # Your image path

engine = MargrayGameEngine()

window = engine.create_screen("1000x500") # Create the window with the resolution 1000x500

# The 1st parameter is the images and 2nd is the X position and 3rd is the Y position and 4th is size and the startingIndex (in which index should the image start)

animated_sprite = engine.animated_sprite(IMAGES,50,50,(25,25),0)
while True:
	for ev in engine.run(): # engine.run() returns events passed to the window
		event = Events(ev)
		event.enableAutoQuit(engine) # Automatically Quites if the user clickes the "X" button
		
	animated_sprite.draw() # Drawing the Sprite
	animated_sprite.animate(185) # Animating the Sprite the parameter is the duration between the animation frames
	engine.update()
	```

License
Copyright 2021 AbdulWahab321

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.