Skip to main content

Indie Engine

Getting Started

Here is a quick-start guide to getting started with Indie Engine.

  1. Download the files from github.

  2. Create a new python file outside the IndieEngine folder In this case its test.py

  3. Import IndieEngine into your file
    import IndieEngine as ie

Creating Screen

A Screen is a place where the game runs and is visible to player. To create screen/window follow these steps.

  1. Set the window constants

        # Default Screen Constants
        background_colour = colour.COLOUR.White
        caption = "Indie Engine"
        fps = 60
        screen_size = QUAD(0,0,900,600) # a quad stores the corner points of a rectangle (x,y,width,height)
    
        scale_amount = 1 # zoom of the main screen (to increase the pixel size)
        icon_file = "" # path th the icon file goes here
        scalable = False # set if user can resize the window for their comfert.
    

    Lets change the caption and screensize

    # the code should look like this
    import IndieEngine as ie  
    
    ie.app.init(caption="Indie Engine",fps= 30, scalable= True, screen_size=ie.Vector(500,400))
    # make sure you initiate the package before you run the game
    
  2. Run the main loop using ie.run(). We now have a blank screen to work with.

    import IndieEngine as ie  
    
    ie.app.init(caption="Indie Engine",fps= 30, scalable= True, screen_size=ie.Vector(500,400))
    
    ie.run()
    

Update, Draw and Inputs

update: code inside the update is called every frame.

draw : draw mwthod is used to draw/blit objects on screen, it is called right after update method.

inputs : this methods gives events and mouse position to the sub-methods for easy handling.

Ideal way to start

import IndieEngine as ie  

ie.app.init(caption="Indie Engine",fps= 30, scalable= True, screen_size=ie.Vector(500,400))


def game():
    def Update():
        pass

    def Draw():
        pass

    def Inputs(event,mouse): 
        pass

    ie.run(Update,Draw,Inputs) # run calls these methods when required
    # make sure u don't call the functions, and pass them as a object.

game() # with this you can have multiple screens

Game Objects

Every Object in the game is a Game Object. It holds the parent object, may be usefull for alingning the childs later on.

# set parent 
obj1 = ie.GameObject()
obj2 = ie.GameObject()
obj1.parent = obj2

Transform

Transform class allows access to position, size and rotation of the object.

align - align the object with respect to any object easily

stretch - stretch a object to its parent size

# create a parent object
parent = ie.Transform(ie.Quad(0,0,200,200),0)

#create a child
transform1 = ie.Transform(ie.Quad(0,0,100,100),0)
# assign clild to the parent
transform1.parent = parent
# modify values
transform1.size = ie.Vector(120,120)
transform1.rotation = 20
# align function of transform
transform1.align(transform1.parent,"top-left")
# arguments for anchor are:
    # top-left
    # top-center
    # top-right

    # middle-left
    # middle-center
    # middle-right

    # bottom-left
    # bottom-right
    # bottom-center

transform1.stretch("fill",transform1.parent)
# arguments for stretch
    # fill - fill the entire parent
    # horizontal - fill only horizontally
    # vertical - fill only vertically

Colour

This class has a method to make new colours, with some predefined colours

black = ie.Colour().make(0,0,0)

#Standared colours
ie.Colour.Black
ie.Colour.White	
ie.Colour.Red	    
ie.Colour.Lime	
ie.Colour.Blue	
ie.Colour.Yellow	
ie.Colour.Aqua	
ie.Colour.Fuchsia	
ie.Colour.Silver	
ie.Colour.Gray	
ie.Colour.Maroon	
ie.Colour.Olive	
ie.Colour.Green	
ie.Colour.Purple	
ie.Colour.Teal	
ie.Colour.Navy	

Image

This class allows us to draw images on screen.

def game():

    image = ie.Image(ie.Quad(100,100,520,220),45,"Resources/folder.png")

    def Draw():
        image.blit()


    ie.run(update=None,draw=Draw,inputs = None)

game()

Panel

This allows us to draw Rectangles on the screen, This is a backbone class for other classes.

def game():

    panel = ie.Panel(ie.Quad(0,0,200,300),10,0,ie.Colour.Black)

    def Draw():
        panel.blit()

    ie.run(update=None,draw=Draw,inputs = None)


game()

Font

Font class allows us to create font assets and use them on text when required

font_14 = ie.Font("Resources\font_big.ttf",14)

Text

Text class allows us to create and display one-liner texts

def game():
    font_14 = ie.Font("Resources/font_big.ttf",14)
    text = ie.Text(ie.Quad(0,0,100,100),"Here is some text",font_14,ie.Colour.Fuchsia,ie.Colour.Navy)

    def Draw():
        text.blit()

   ie.run(update=None,draw=Draw,inputs = None)

game()

Button

This is a faster way to create buttons and handle inputs. Buttton has three variables, ishovered, ispressed and isselected which we can use to control stuff.

Here is a example of a button

font_14 = ie.Font("Resources/font_big.ttf",14)
def game():


    button = ie.Button(ie.Quad(10,20,30,40),"Button",font_14,ie.Colour.Fuchsia,ie.Colour.Lime)


    def Update():
        if button.ishovered:
            # do some stuff
            pass
        if button.ispressed:
            # do some stuff
            pass
        if button.isselected:
            # do some stuff
            pass

    def Draw():
        button.blit()
        pass

    def Inputs(event,mouse): 
        button.control(event,mouse)
        pass

    ie.run(Update,Draw,Inputs)

game()

Tile Maps

Tile maps help us to create environments with few lines of code( collision included with character controller) You can assign each tile-type a id, based on that you can make it collidable. You can overlay tiles to create effects, or layers.

import IndieEngine as ie

ie.app.init(caption="Indie Engine", fps=30, scalable=True,
            screen_size=ie.Vector(500, 400))


def game():
    level1 = ie.Tilemap(16, "Resources/map1.txt",
                        tiles={
                            "1": ie.Image(ie.Quad(0, 0, 16, 16), 0, "Resources/folder.png"),
                            "2": ie.Image(ie.Quad(0, 0, 16, 16), 0, "Resources/blank_screen.png"),
                        })

    # specify which tiles are acctually collidable from tiles array.
    level1.loadmap(collidable_tiles=["1"])  # tile with id 1 is collidable, rest are not.

    def Draw():
        level1.blit()
        pass
    ie.run(draw=Draw)

game()

/Resources/map1.txt

1111
222
1111
2

Character Controller

This is 8 way character controller, assign buttons and movements to get going.

import IndieEngine as ie

ie.app.init(caption="Indie Engine", fps=30, scalable=True,scale_amount=5,
            screen_size=ie.Vector(900,600))

def game():
    level1 = ie.Tilemap(16, "Resources/map1.txt",
                        tiles={
                            "1": ie.Image(ie.Quad(0, 0, 16, 16), 0, "Resources/folder.png"),
                            "2": ie.Image(ie.Quad(0, 0, 16, 16), 0, "Resources/blank_screen.png"),
                        })

    player = ie.Character_Controller(ie.Quad(0,0,16,16),20,"Resources/folder.png",20)

    # specify which tiles are acctually collidable from tiles array.
    level1.loadmap(collidable_tiles=["1"])  # tile with id 1 is collidable, rest are not.

    def Update():
        player.move() # move the player as required


    def Draw():
        level1.blit()
        player.blit()

    def Inputs(event,mouse):
        player.control(event)

    ie.run(Update,Draw,Inputs)

game()

Sprite Sheets

sprite sheets are performant way to add graphics to the game, it loads up a huge image instead of 1000 unique ones. And crops out the required part of it.

The classes are taken from here

Explore the package files to know about more functions related to it.

import IndieEngine as ie

ie.app.init(caption="Indie Engine", fps=30, scalable=True,scale_amount=5,
            screen_size=ie.Vector(900,600))

def game():
    spritesheet = ie.Spritesheet("Resources/folder.png")
    # individual sprites
    player = spritesheet.image_at((32,32,16,16),ie.Colour.White)

    #can be used to create tilemaps
    tilemap = ie.Tilemap(16,"demo.txt",tiles={
        "1": spritesheet.image_at((0,0 ,16,16),ie.Colour.White),
        "2": spritesheet.image_at((0,16,16,16),ie.Colour.White),
        "3": spritesheet.image_at((0,32,16,16),ie.Colour.White),
        "4": spritesheet.image_at((0,48,16,16),ie.Colour.White),

    })
    def Update():
        pass
    def Draw():
        player.blit()
        pass
    def Inputs(event,mouse):
        pass

    ie.run(Update,Draw,Inputs)

game()

Sprite Strip Animations

This class derives from SpriteSheet and thus is taken from here.

Load a strip of images with this class and use it as a frame by frame animation sequence.

from pygame import Color
import IndieEngine as ie

ie.app.init(caption="Indie Engine", fps=30, scalable=True,scale_amount=5,
            screen_size=ie.Vector(900,600))

def game():
    player = ie.Character_Controller(ie.Quad(0,0,16,16),20,"Resources/folder.png",20)

    player_anim = ie.Spritestrip_animation("Resources/folder.png",(0,16,16,16),3,ie.Colour.White,loop=True,frames=3)
    player_anim.iter() # iterate through the images once


    def Update():
        player.move()
        player.image = player_anim.next() # bring on the next frame

    def Draw():
        player.blit()

    def Inputs(event,mouse):
        player.control(event)


    ie.run(Update,Draw,Inputs)

game()

Files

With this class You can store/get data in json files.

file_manager = ie.File("settings")

file_manager.save("volume", 0.5)
file_manager.save("name", "Indie Engine")


print(file_manager.get("volume"))
print(file_manager.get("name"))

file_manager.delete("volume")

Music

This is extended Pygame.Mixer Library

bg_music = ie.Music("demo.mp3")

bg_music.play(loops=-1,start=0,fade_ms=10)
#      loops =-1 ---> play infinitely
#      start =0 ----> start at 0 sec
#      fade = 10 ---> fade 10 ms

bg_music.volume(0.4) 

bg_music.pause()

bg_music.unpause()

bg_music.fadeout()

bg_music.stop()

Sounds

Sounds is a class which can play sounds when needed.

death = ie.Sound(sounds={
    "death_1": "sounds/death/1.mp3",
    "death_2": "sounds/death/2.mp3",
    "death_3": "sounds/death/3.mp3",
    "death_4": "sounds/death/4.mp3"
})

death.add("death_boss","sounds/death/boss.wav")
death.remove("death_2")
death.play("death_1")

Thanks for using Indie Engine!

Metadata

Release files for indie-engine 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for indie-engine 1.0.0
File Size Uploaded Provenance Actions
indie-engine-1.0.0.tar.gz 17.2 kB Without provenance Details for indie-engine-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for indie-engine 1.0.0
File Interpreter ABI Platform Actions
indie_engine-1.0.0-py3-none-any.whl Python 3 none any Details for indie_engine-1.0.0-py3-none-any.whl

Total release size: 39.2 kB

Release files / indie-engine-1.0.0.tar.gz

Download URL indie-engine-1.0.0.tar.gz
Size 17.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1d7ce86f0d73fad1ee6c3fb107ac4b2be07e43bf06266e5bfbf111b57bdcb1e8
BLAKE2b-256 checksum
How to use checksums
f34528bf2757d578b5603c4362b58084737b5e304e258a669e21b94eb7bb9ef9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.0

Release files / indie_engine-1.0.0-py3-none-any.whl

Download URL indie_engine-1.0.0-py3-none-any.whl
Size 21.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b6e31daf9178d13a31f06d64c4bd6770cbaa5ef0cea940a2177c83d82ca3834e
BLAKE2b-256 checksum
How to use checksums
82ed36869f08ae6dbf506112de5d237a5a1075b36900c54ac13d32fa7d80c6b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.0

Security for indie-engine 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page