Package: indie-engine
Indie EngineGetting StartedHere is a quick-start guide to getting started with Indie Engine.Download the files fromgithub.Create a new python file outside the IndieEngine folder
In this case itstest.pyImport IndieEngine into your fileimport IndieEngine as ieCreating ScreenA Screen is a place where the game runs and is visible to player.
To create screen/window follow these steps.Set the window constants# Default Screen Constantsbackground_colour=colour.COLOUR.Whitecaption="Indie Engine"fps=60screen_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 herescalable=False# set if user can resize the window for their comfert.Lets change the caption and screensize# the code should look like thisimportIndieEngineasieie.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 gameRun the main loop usingie.run(). We now have a blank screen to work with.importIndieEngineasieie.app.init(caption="Indie Engine",fps=30,scalable=True,screen_size=ie.Vector(500,400))ie.run()Update, Draw and Inputsupdate: 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 startimportIndieEngineasieie.app.init(caption="Indie Engine",fps=30,scalable=True,screen_size=ie.Vector(500,400))defgame():defUpdate():passdefDraw():passdefInputs(event,mouse):passie.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 screensGame ObjectsEvery Object in the game is a Game Object.
It holds the parent object, may be usefull for alingning the childs later on.# set parentobj1=ie.GameObject()obj2=ie.GameObject()obj1.parent=obj2TransformTransform class allows access to position, size and rotation of the object.align- align the object with respect to any object easilystretch- stretch a object to its parent size# create a parent objectparent=ie.Transform(ie.Quad(0,0,200,200),0)#create a childtransform1=ie.Transform(ie.Quad(0,0,100,100),0)# assign clild to the parenttransform1.parent=parent# modify valuestransform1.size=ie.Vector(120,120)transform1.rotation=20# align function of transformtransform1.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-centertransform1.stretch("fill",transform1.parent)# arguments for stretch# fill - fill the entire parent# horizontal - fill only horizontally# vertical - fill only verticallyColourThis class has a method to make new colours, with some predefined coloursblack=ie.Colour().make(0,0,0)#Standared coloursie.Colour.Blackie.Colour.Whiteie.Colour.Redie.Colour.Limeie.Colour.Blueie.Colour.Yellowie.Colour.Aquaie.Colour.Fuchsiaie.Colour.Silverie.Colour.Grayie.Colour.Maroonie.Colour.Oliveie.Colour.Greenie.Colour.Purpleie.Colour.Tealie.Colour.NavyImageThis class allows us to draw images on screen.defgame():image=ie.Image(ie.Quad(100,100,520,220),45,"Resources/folder.png")defDraw():image.blit()ie.run(update=None,draw=Draw,inputs=None)game()PanelThis allows us to draw Rectangles on the screen,
This is a backbone class for other classes.defgame():panel=ie.Panel(ie.Quad(0,0,200,300),10,0,ie.Colour.Black)defDraw():panel.blit()ie.run(update=None,draw=Draw,inputs=None)game()FontFont class allows us to create font assets and use them on text when requiredfont_14=ie.Font("Resources\font_big.ttf",14)TextText class allows us to create and display one-liner textsdefgame():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)defDraw():text.blit()ie.run(update=None,draw=Draw,inputs=None)game()ButtonThis is a faster way to create buttons and handle inputs.
Buttton has three variables,ishovered,ispressedandisselectedwhich we can use to control stuff.Here is a example of a buttonfont_14=ie.Font("Resources/font_big.ttf",14)defgame():button=ie.Button(ie.Quad(10,20,30,40),"Button",font_14,ie.Colour.Fuchsia,ie.Colour.Lime)defUpdate():ifbutton.ishovered:# do some stuffpassifbutton.ispressed:# do some stuffpassifbutton.isselected:# do some stuffpassdefDraw():button.blit()passdefInputs(event,mouse):button.control(event,mouse)passie.run(Update,Draw,Inputs)game()Tile MapsTile 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.importIndieEngineasieie.app.init(caption="Indie Engine",fps=30,scalable=True,screen_size=ie.Vector(500,400))defgame():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.defDraw():level1.blit()passie.run(draw=Draw)game()/Resources/map1.txt1111
222
1111
2Character ControllerThis is 8 way character controller,
assign buttons and movements to get going.importIndieEngineasieie.app.init(caption="Indie Engine",fps=30,scalable=True,scale_amount=5,screen_size=ie.Vector(900,600))defgame():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.defUpdate():player.move()# move the player as requireddefDraw():level1.blit()player.blit()defInputs(event,mouse):player.control(event)ie.run(Update,Draw,Inputs)game()Sprite Sheetssprite 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 fromhereExplore the package files to know about more functions related to it.importIndieEngineasieie.app.init(caption="Indie Engine",fps=30,scalable=True,scale_amount=5,screen_size=ie.Vector(900,600))defgame():spritesheet=ie.Spritesheet("Resources/folder.png")# individual spritesplayer=spritesheet.image_at((32,32,16,16),ie.Colour.White)#can be used to create tilemapstilemap=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),})defUpdate():passdefDraw():player.blit()passdefInputs(event,mouse):passie.run(Update,Draw,Inputs)game()Sprite Strip AnimationsThis class derives from SpriteSheet and thus is taken fromhere.Load a strip of images with this class and use it as a frame by frame animation sequence.frompygameimportColorimportIndieEngineasieie.app.init(caption="Indie Engine",fps=30,scalable=True,scale_amount=5,screen_size=ie.Vector(900,600))defgame():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 oncedefUpdate():player.move()player.image=player_anim.next()# bring on the next framedefDraw():player.blit()defInputs(event,mouse):player.control(event)ie.run(Update,Draw,Inputs)game()FilesWith 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")MusicThis is extended Pygame.Mixer Librarybg_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 msbg_music.volume(0.4)bg_music.pause()bg_music.unpause()bg_music.fadeout()bg_music.stop()SoundsSounds 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!