{"id":24663909,"url":"https://github.com/sujalchoudhari/indie","last_synced_at":"2025-09-08T16:44:48.022Z","repository":{"id":146522195,"uuid":"395864542","full_name":"SujalChoudhari/Indie","owner":"SujalChoudhari","description":"framework for pygame","archived":false,"fork":false,"pushed_at":"2021-10-22T14:14:09.000Z","size":8679,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-26T05:17:18.510Z","etag":null,"topics":["game","game-2d","game-development","game-engine","gamedev","gameframework","pygame-2d-engine","pygame-application","pygame-gui","pygame-library","python-library"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SujalChoudhari.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-08-14T02:33:58.000Z","updated_at":"2024-08-05T10:41:07.000Z","dependencies_parsed_at":"2024-02-12T10:43:46.061Z","dependency_job_id":null,"html_url":"https://github.com/SujalChoudhari/Indie","commit_stats":null,"previous_names":["notsujal/indie"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SujalChoudhari%2FIndie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SujalChoudhari%2FIndie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SujalChoudhari%2FIndie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SujalChoudhari%2FIndie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SujalChoudhari","download_url":"https://codeload.github.com/SujalChoudhari/Indie/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244110091,"owners_count":20399562,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["game","game-2d","game-development","game-engine","gamedev","gameframework","pygame-2d-engine","pygame-application","pygame-gui","pygame-library","python-library"],"created_at":"2025-01-26T05:17:24.224Z","updated_at":"2025-03-21T08:42:29.859Z","avatar_url":"https://github.com/SujalChoudhari.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Indie Engine\n\n##  Getting Started\nHere is a quick-start guide to getting started with Indie Engine.\n\n1. Download the files from [github](https://github.com/Notsujal/Indie).\nor type in the terminal\n```py\npip install indie-engine\n```\n\n\n\n\n2. Create a new python file outside the IndieEngine folder\nIn this case its `test.py`\n\n\n3. Import IndieEngine into your file  \n    `import IndieEngine as ie`\n\n\n## Creating Screen\nA Screen is a place where the game runs and is visible to player.\nTo create screen/window follow these steps.\n\n1. Set the window constants\n    ```py\n        # Default Screen Constants\n        background_colour = colour.COLOUR.White\n        caption = \"Indie Engine\"\n        fps = 60\n        screen_size = QUAD(0,0,900,600) # a quad stores the corner points of a rectangle (x,y,width,height)\n\n        scale_amount = 1 # zoom of the main screen (to increase the pixel size)\n        icon_file = \"\" # path th the icon file goes here\n        scalable = False # set if user can resize the window for their comfert.\n\n    ```\n    Lets change the caption and screensize\n    ```py\n    # the code should look like this\n    import IndieEngine as ie  \n\n    ie.app.init(caption=\"Indie Engine\",fps= 30, scalable= True, screen_size=ie.Vector(500,400))\n    # make sure you initiate the package before you run the game\n    ```\n\n2. Run the main loop using `ie.run()`. We now have a blank screen to work with.\n    ```py\n    import IndieEngine as ie  \n\n    ie.app.init(caption=\"Indie Engine\",fps= 30, scalable= True, screen_size=ie.Vector(500,400))\n\n    ie.run()\n    ```\n\n\n## Update, Draw and Inputs\n\n\n`update`: code inside the update is called every frame.\n\n`draw` : draw mwthod is used to draw/blit objects on screen, it is called right after update method.\n\n`inputs` : this methods gives events and mouse position to the sub-methods for easy handling.\n\nIdeal way to start\n\n```py\nimport IndieEngine as ie  \n\nie.app.init(caption=\"Indie Engine\",fps= 30, scalable= True, screen_size=ie.Vector(500,400))\n\n\ndef game():\n    def Update():\n        pass\n\n    def Draw():\n        pass\n\n    def Inputs(event,mouse): \n        pass\n\n    ie.run(Update,Draw,Inputs) # run calls these methods when required\n    # make sure u don't call the functions, and pass them as a object.\n\ngame() # with this you can have multiple screens\n```\n\n## Game Objects\nEvery Object in the game is a Game Object.\nIt holds the parent object, may be usefull for alingning the childs later on.\n\n```py\n# set parent \nobj1 = ie.GameObject()\nobj2 = ie.GameObject()\nobj1.parent = obj2\n```\n\n## Transform\nTransform class allows access to position, size and rotation of the object.\n\n`align`  - align the object with respect to any object easily\n\n`stretch` - stretch a object to its parent size\n\n```py\n# create a parent object\nparent = ie.Transform(ie.Quad(0,0,200,200),0)\n\n#create a child\ntransform1 = ie.Transform(ie.Quad(0,0,100,100),0)\n# assign clild to the parent\ntransform1.parent = parent\n# modify values\ntransform1.size = ie.Vector(120,120)\ntransform1.rotation = 20\n# align function of transform\ntransform1.align(transform1.parent,\"top-left\")\n# arguments for anchor are:\n    # top-left\n    # top-center\n    # top-right\n\n    # middle-left\n    # middle-center\n    # middle-right\n\n    # bottom-left\n    # bottom-right\n    # bottom-center\n\ntransform1.stretch(\"fill\",transform1.parent)\n# arguments for stretch\n    # fill - fill the entire parent\n    # horizontal - fill only horizontally\n    # vertical - fill only vertically\n\n```\n\n\n## Colour\nThis class has a method to make new colours, with some predefined colours\n\n```py\nblack = ie.Colour().make(0,0,0)\n\n#Standared colours\nie.Colour.Black\nie.Colour.White\t\nie.Colour.Red\t    \nie.Colour.Lime\t\nie.Colour.Blue\t\nie.Colour.Yellow\t\nie.Colour.Aqua\t\nie.Colour.Fuchsia\t\nie.Colour.Silver\t\nie.Colour.Gray\t\nie.Colour.Maroon\t\nie.Colour.Olive\t\nie.Colour.Green\t\nie.Colour.Purple\t\nie.Colour.Teal\t\nie.Colour.Navy\t\n```\n\n\n\n## Image\nThis class allows us to draw images on screen.\n\n\n```py\n\ndef game():\n\n    image = ie.Image(ie.Quad(100,100,520,220),45,\"Resources/folder.png\")\n\n    def Draw():\n        image.blit()\n\n\n    ie.run(update=None,draw=Draw,inputs = None)\n\ngame()\n```\n\n## Panel\nThis allows us to draw Rectangles on the screen,\nThis is a backbone class for other classes.\n\n```py\ndef game():\n\n    panel = ie.Panel(ie.Quad(0,0,200,300),10,0,ie.Colour.Black)\n\n    def Draw():\n        panel.blit()\n\n    ie.run(update=None,draw=Draw,inputs = None)\n\n\ngame()\n```\n\n## Font\nFont class allows us to create font assets and use them on text when required\n\n```py\nfont_14 = ie.Font(\"Resources\\font_big.ttf\",14)\n```\n\n## Text\nText class allows us to create and display one-liner texts\n\n```py\ndef game():\n    font_14 = ie.Font(\"Resources/font_big.ttf\",14)\n    text = ie.Text(ie.Quad(0,0,100,100),\"Here is some text\",font_14,ie.Colour.Fuchsia,ie.Colour.Navy)\n\n    def Draw():\n        text.blit()\n   \n   ie.run(update=None,draw=Draw,inputs = None)\n\ngame()\n```\n\n## Button\nThis is a faster way to create buttons and handle inputs.\nButtton has three variables, `ishovered`, `ispressed` and `isselected` which we can use to control stuff.\n\nHere is a example of a button \n\n```py\nfont_14 = ie.Font(\"Resources/font_big.ttf\",14)\ndef game():\n    \n\n    button = ie.Button(ie.Quad(10,20,30,40),\"Button\",font_14,ie.Colour.Fuchsia,ie.Colour.Lime)\n\n\n    def Update():\n        if button.ishovered:\n            # do some stuff\n            pass\n        if button.ispressed:\n            # do some stuff\n            pass\n        if button.isselected:\n            # do some stuff\n            pass\n\n    def Draw():\n        button.blit()\n        pass\n\n    def Inputs(event,mouse): \n        button.control(event,mouse)\n        pass\n\n    ie.run(Update,Draw,Inputs)\n\ngame()\n```\n\n## Tile Maps\nTile maps help us to create environments with few lines of code( collision included with character controller)\nYou can assign each tile-type a id, based on that you can make it collidable.\nYou can overlay tiles to create effects, or layers.\n\n```py\nimport IndieEngine as ie\n\nie.app.init(caption=\"Indie Engine\", fps=30, scalable=True,\n            screen_size=ie.Vector(500, 400))\n\n\ndef game():\n    level1 = ie.Tilemap(16, \"Resources/map1.txt\",\n                        tiles={\n                            \"1\": ie.Image(ie.Quad(0, 0, 16, 16), 0, \"Resources/folder.png\"),\n                            \"2\": ie.Image(ie.Quad(0, 0, 16, 16), 0, \"Resources/blank_screen.png\"),\n                        })\n\n    # specify which tiles are acctually collidable from tiles array.\n    level1.loadmap(collidable_tiles=[\"1\"])  # tile with id 1 is collidable, rest are not.\n\n    def Draw():\n        level1.blit()\n        pass\n    ie.run(draw=Draw)\n\ngame()\n```\n\n/Resources/map1.txt\n```\n1111\n222\n1111\n2\n```\n\n## Character Controller\nThis is 8 way character controller,\nassign buttons and movements to get going.\n\n```py\nimport IndieEngine as ie\n\nie.app.init(caption=\"Indie Engine\", fps=30, scalable=True,scale_amount=5,\n            screen_size=ie.Vector(900,600))\n\ndef game():\n    level1 = ie.Tilemap(16, \"Resources/map1.txt\",\n                        tiles={\n                            \"1\": ie.Image(ie.Quad(0, 0, 16, 16), 0, \"Resources/folder.png\"),\n                            \"2\": ie.Image(ie.Quad(0, 0, 16, 16), 0, \"Resources/blank_screen.png\"),\n                        })\n\n    player = ie.Character_Controller(ie.Quad(0,0,16,16),20,\"Resources/folder.png\",20)\n\n    # specify which tiles are acctually collidable from tiles array.\n    level1.loadmap(collidable_tiles=[\"1\"])  # tile with id 1 is collidable, rest are not.\n\n    def Update():\n        player.move() # move the player as required\n\n\n    def Draw():\n        level1.blit()\n        player.blit()\n\n    def Inputs(event,mouse):\n        player.control(event)\n\n    ie.run(Update,Draw,Inputs)\n\ngame()\n```\n\n## Sprite Sheets\nsprite 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.\n\nThe classes are taken from [here](https://www.pygame.org/wiki/Spritesheet)\n\nExplore the package files to know about more functions related to it.\n\n```py\nimport IndieEngine as ie\n\nie.app.init(caption=\"Indie Engine\", fps=30, scalable=True,scale_amount=5,\n            screen_size=ie.Vector(900,600))\n\ndef game():\n    spritesheet = ie.Spritesheet(\"Resources/folder.png\")\n    # individual sprites\n    player = spritesheet.image_at((32,32,16,16),ie.Colour.White)\n\n    #can be used to create tilemaps\n    tilemap = ie.Tilemap(16,\"demo.txt\",tiles={\n        \"1\": spritesheet.image_at((0,0 ,16,16),ie.Colour.White),\n        \"2\": spritesheet.image_at((0,16,16,16),ie.Colour.White),\n        \"3\": spritesheet.image_at((0,32,16,16),ie.Colour.White),\n        \"4\": spritesheet.image_at((0,48,16,16),ie.Colour.White),\n        \n    })\n    def Update():\n        pass\n    def Draw():\n        player.blit()\n        pass\n    def Inputs(event,mouse):\n        pass\n\n    ie.run(Update,Draw,Inputs)\n\ngame()\n\n```\n\n## Sprite Strip Animations\nThis class derives from SpriteSheet and thus is taken from [here](https://www.pygame.org/wiki/Spritesheet).\n\nLoad a strip of images with this class and use it as a frame by frame animation sequence.\n\n```py\n\nfrom pygame import Color\nimport IndieEngine as ie\n\nie.app.init(caption=\"Indie Engine\", fps=30, scalable=True,scale_amount=5,\n            screen_size=ie.Vector(900,600))\n\ndef game():\n    player = ie.Character_Controller(ie.Quad(0,0,16,16),20,\"Resources/folder.png\",20)\n\n    player_anim = ie.Spritestrip_animation(\"Resources/folder.png\",(0,16,16,16),3,ie.Colour.White,loop=True,frames=3)\n    player_anim.iter() # iterate through the images once\n\n\n    def Update():\n        player.move()\n        player.image = player_anim.next() # bring on the next frame\n\n    def Draw():\n        player.blit()\n\n    def Inputs(event,mouse):\n        player.control(event)\n\n\n    ie.run(Update,Draw,Inputs)\n\ngame()\n```\n\n## Files\nWith this class You can store/get data in json files.\n\n```py\nfile_manager = ie.File(\"settings\")\n\nfile_manager.save(\"volume\", 0.5)\nfile_manager.save(\"name\", \"Indie Engine\")\n\n\nprint(file_manager.get(\"volume\"))\nprint(file_manager.get(\"name\"))\n\nfile_manager.delete(\"volume\")\n```\n\n\n## Music\nThis is extended Pygame.Mixer Library\n```py\nbg_music = ie.Music(\"demo.mp3\")\n\nbg_music.play(loops=-1,start=0,fade_ms=10)\n#      loops =-1 ---\u003e play infinitely\n#      start =0 ----\u003e start at 0 sec\n#      fade = 10 ---\u003e fade 10 ms\n\nbg_music.volume(0.4) \n\nbg_music.pause()\n\nbg_music.unpause()\n\nbg_music.fadeout()\n\nbg_music.stop()\n\n```\n\n## Sounds\nSounds is a class which can play sounds when needed.\n```py\ndeath = ie.Sound(sounds={\n    \"death_1\": \"sounds/death/1.mp3\",\n    \"death_2\": \"sounds/death/2.mp3\",\n    \"death_3\": \"sounds/death/3.mp3\",\n    \"death_4\": \"sounds/death/4.mp3\"\n})\n\ndeath.add(\"death_boss\",\"sounds/death/boss.wav\")\ndeath.remove(\"death_2\")\ndeath.play(\"death_1\")\n```\n\nThanks for using Indie Engine!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsujalchoudhari%2Findie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsujalchoudhari%2Findie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsujalchoudhari%2Findie/lists"}