{"id":18672120,"url":"https://github.com/dfirebaugh/turtle","last_synced_at":"2025-11-06T21:30:39.871Z","repository":{"id":41961789,"uuid":"507448885","full_name":"dfirebaugh/turtle","owner":"dfirebaugh","description":"a fantasy console emulator","archived":false,"fork":false,"pushed_at":"2023-10-25T13:54:35.000Z","size":15367,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-27T19:29:53.297Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://dfirebaugh.github.io/turtle/","language":"Go","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/dfirebaugh.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,"publiccode":null,"codemeta":null}},"created_at":"2022-06-26T01:05:37.000Z","updated_at":"2023-04-16T03:42:03.000Z","dependencies_parsed_at":"2024-12-27T19:28:45.213Z","dependency_job_id":"89929fbb-ccba-478c-83db-0f3751e0b403","html_url":"https://github.com/dfirebaugh/turtle","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dfirebaugh%2Fturtle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dfirebaugh%2Fturtle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dfirebaugh%2Fturtle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dfirebaugh%2Fturtle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dfirebaugh","download_url":"https://codeload.github.com/dfirebaugh/turtle/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239513345,"owners_count":19651321,"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":[],"created_at":"2024-11-07T09:09:32.538Z","updated_at":"2025-11-06T21:30:39.836Z","avatar_url":"https://github.com/dfirebaugh.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# The Turtle Console Emulator\nTurtle is a [fantasy console](https://en.wikipedia.org/wiki/Fantasy_video_game_console) emulator.\nThe intention of turtle is to make it easy to make games.\n\n### Web Editor/Emulator\nYou can create/edit carts for turtle script directly in the browser.\n[web emulator](https://dfirebaugh.github.io/turtle/)\n\n### Sprite Editor\nPress Tab to access the sprite editor.\n\nSprites will be saved to the cart as a comment.\n\nYou can also render a sprite directly with `PARSESPRITE()`.\ne.g.\n```lua\nPARSESPRITE(\"8888888c8777777c888888880707707c0777777cccc22ccccc7227ccccc88ccc\", x, y)\n```\n\n## Turtle Carts\nThere is a subset of the lua scripting language embedded in turtle.\nSome example turtle scripts (aka `carts`) exist in the `./examples` dir.\n\nyou can load these carts by building the project and then running the following:\n```bash\n./turtle -cart ./examples/simple.lua\n```\n\nAlternatively, you can run these directly in the web browser.\n\n\nYou must implement 3 functions:\n```lua\nfunction INIT()\n-- runs on cart load\nend\n\nfunction UPDATE()\n-- runs every update of game loop\nend\n\nfunction RENDER()\n-- runs for draw calls\nend\n```\n\n### API avialable for carts:\n```lua\n-- util functions\nSCREENH()\nSCREENW()\nNOW() -- seconds since the console started\nBUTTON(n) -- returns true if button is pressed - shorthand: BTN(n)\nHEADING(x0, y0, x1, y1) -- heading from one point to another\nDISTANCE(x0, y0, x1, y1) -- distance between two points\n\n\n-- render functions\nRECTANGLE(x, y, w, h, color) -- color is an index on the pallette\nCIRCLE(x, y, r, color) -- shorthand: CIR(x, y, r, color)\nLINE(x, y, x0, y0, x1, y1, color)\nTRIANGLE(x0, y0, x1, y1, x2, y2, color) -- shorthand: TRI(x0, y0, x1, y1, x2, y2, color)\nPOINT(x, y, color) -- shorthand: PT(x, y, color)\nCLEAR() -- clear screen - shorthand: CLR() or CLS()\nSPRITE(i) -- renders a sprite at index n of a cart's sprite memory -- shorthand: SPR(i)\nUID() -- generate a unique id\nFPS() -- render FPS info\nPRINTAT(string, x, y, color) -- print some text to the screen\nPALLETTE() -- render the pallette\n```\n\n#### Object Linking\nYou can copy an object's properties with the following:\n```lua\ndestination=SHALLOWCOPY(source)\n```\n\nIf you want to copy an objects methods, use the clone method.\n\n\n```lua\nlocal Base=OBJECT:clone() -- clone the base class\nBase.val=\"hello\" -- set some value\nfunction Base:say_hello() -- declare some method\n    print(self.val)\nend\n\nEnemy=Base:clone() -- clone the base\n\nOther=Base:clone() -- clone the base\nOther.val=\"greetings\" -- set a new value\n\nEnemy:say_hello() --\u003e \"hello\"\nOther:say_hello() --\u003e \"greetings\"\n```\n\n#### Lua 5.1 reference manual\nhttps://www.lua.org/manual/5.1/\n\u003e note: the math library is handy (e.g. math.pi(); math.random(); math.cos(); math.sin();)\n\n### Controls\n\n```lua\n    if BTN(0) then -- up\n    end\n    if BTN(1) then -- down\n    end\n    if BTN(2) then -- left\n    end\n    if BTN(3) then -- right\n    end\n    if BTN(4) then -- Z\n    end\n    if BTN(5) then -- X\n    end\n```\n\n\n## Chips\nTurtle has `chips`.  `Chips` are really just convenience libraries that are available to the `carts` (carts are intended to represent game cartridges.)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdfirebaugh%2Fturtle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdfirebaugh%2Fturtle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdfirebaugh%2Fturtle/lists"}