{"id":13528919,"url":"https://github.com/TimVN/GMTimeLine","last_synced_at":"2025-04-01T14:33:41.579Z","repository":{"id":72841146,"uuid":"557005690","full_name":"TimVN/GMTimeLine","owner":"TimVN","description":"An engine making it easy to implement waves of enemies in your game","archived":false,"fork":false,"pushed_at":"2022-11-03T22:35:32.000Z","size":1968,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-02T15:36:32.605Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Yacc","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/TimVN.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-10-24T23:17:53.000Z","updated_at":"2024-05-24T00:49:09.000Z","dependencies_parsed_at":"2023-03-11T14:08:53.329Z","dependency_job_id":null,"html_url":"https://github.com/TimVN/GMTimeLine","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/TimVN%2FGMTimeLine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimVN%2FGMTimeLine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimVN%2FGMTimeLine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimVN%2FGMTimeLine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TimVN","download_url":"https://codeload.github.com/TimVN/GMTimeLine/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246655463,"owners_count":20812639,"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-08-01T07:00:28.408Z","updated_at":"2025-04-01T14:33:36.566Z","avatar_url":"https://github.com/TimVN.png","language":"Yacc","readme":"# GMTimeLine\n\nA pure code approach to timelines in Game Maker\n\n## Examples\n\n[Live examples here!](https://timvn.github.io/GMTimeLine)\n\nGMTimeline allows you to create timelines by simply chaining events, like so:\n\n```javascript\ntimer = 0;\n\n/// @param {Real} msLeft\nvar updateTime = function (msLeft) {\n  timer = msLeft;\n};\n\ntimeline = new Timeline()\n  .keyPress(vk_enter) // Wait till the Enter key is pressed\n  .delay(2, updateTime) // Wait 2 seconds, pass time passed to updateTime function\n  // Instantiate 5 instances of OMonster in intervals of 1 second, wait for the instances to be destroyed\n  // before considering the event to be finished\n  .instantiate(room_width / 2, 500, 5, 1, OMonster, WaitingMode.Destroy, {\n    direction: 0, // Pass properties that will be applied to the instances\n  })\n  .await() // Wait for the previous event to finish\n  .delay(2, updateTime) // Wait for 2 seconds\n  .instantiate(room_width / 2, 500, 10, 0.5, OMonster, WaitingMode.Destroy, {\n    direction: 180,\n  })\n  .await()\n  // Run custom logic once\n  .once(\n    function (done, data) {\n      show_debug_message(data.foo);\n\n      done();\n    },\n    {\n      foo: \"bar\",\n    }\n  )\n  // Run custom logic every step, until done() is called or timeline is released\n  .every(\n    function (done, data) {\n      var seconds = floor(data._secondsPassed);\n\n      // Every second\n      if (data.seconds \u003c seconds) {\n        effect_create_above(\n          ef_firework,\n          random(room_width),\n          random(room_height),\n          10,\n          random(c_white)\n        );\n\n        data.seconds = seconds;\n      }\n\n      // Stop after 5 seconds\n      if (seconds == 5) {\n        done();\n      }\n    },\n    {\n      seconds: 0,\n    }\n  )\n  .await(); // Wait for the previous event to finish\n\ntimeline.onFinish(function () {\n  // Timeline is finished, stop processing any logic left behind by \"every\"\n  timeline.release();\n});\n\ntimeline.start();\n```\n\nOr how about a sequence of timelines:\n\n```javascript\nsequence = new Sequence([\n  new Timeline()\n    .once(function (done) {\n      OLog.logString(\"Starting a sequence of timelines\");\n\n      done();\n    })\n    .delay(3, updateTime)\n    .await(),\n\n  new Timeline()\n    .once(function (done) {\n      OLog.logString(\n        \"First timeline in sequence finished, second timeline started\"\n      );\n\n      done();\n    })\n    .delay(3, updateTime)\n    .await(),\n]);\n\nsequence.onFinish(function (data) {\n  show_debug_message(\n    \"Sequence complete in \" + string(data.duration / 1000) + \" seconds\"\n  );\n});\n\nsequence.start();\n```\n\n# Installing\n\nSimply download `GMTimeLine.yyp` and drag it over to your project. A Marketplace link will come soon!\n\n# Documentation\n\n## Classes\n\n\u003ca name=\"Timeline\"\u003e\u003c/a\u003e\n\n### Timeline() ⇒ \u003ccode\u003eStruct.Timeline\u003c/code\u003e\n\nCreates a new timeline\n\n\u003ca name=\"Timeline\"\u003e\u003c/a\u003e\n\n### Sequence(timelines) ⇒ \u003ccode\u003eStruct.Sequence\u003c/code\u003e\n\nCreates a new sequence of timelines\n\n| Param     | Type                                | Description           |\n| --------- | ----------------------------------- | --------------------- |\n| timelines | \u003ccode\u003eArray\u003cStruct.Timeline\u003e\u003c/code\u003e | An array of timelines |\n\n## Timescale\n\nTimelines take `global.timeScale` into account. 1 is normal speed, 0.5 is half speed, 2 is double speed, etc.\n\n## Timeline Functions\n\n\u003cdl\u003e\n   \u003cdt\u003e\u003ca href=\"#Timeline\"\u003eTimeline()\u003c/a\u003e ⇒ \u003ccode\u003eStruct.Timeline\u003c/code\u003e\u003c/dt\u003e\n   \u003cdd\u003e\n      \u003cp\u003eCreates a new timeline\u003c/p\u003e\n   \u003c/dd\u003e\n   \u003cdt\u003e\u003ca href=\"#start\"\u003estart()\u003c/a\u003e ⇒ \u003ccode\u003eStruct.Timeline\u003c/code\u003e\u003c/dt\u003e\n   \u003cdd\u003e\n      \u003cp\u003eStarts/continues the timeline\u003c/p\u003e\n   \u003c/dd\u003e\n   \u003cdd\u003e\n   \u003cdt\u003e\u003ca href=\"#await\"\u003e await()\u003c/a\u003e ⇒ \u003ccode\u003eStruct.Timeline\u003c/code\u003e\u003c/dt\u003e\n   \u003cdd\u003e\n      \u003cp\u003eCreates an Instantiate event that will instantiate objects\u003c/p\u003e\n   \u003c/dd\u003e\n   \u003cdt\u003e\u003ca href=\"#delay\"\u003e delay(seconds, [callback])\u003c/a\u003e ⇒ \u003ccode\u003eStruct.Timeline\u003c/code\u003e\u003c/dt\u003e\n   \u003cdd\u003e\n      \u003cp\u003eDelays events from further execution\u003c/p\u003e\n   \u003c/dd\u003e\n   \u003cdt\u003e\u003ca href=\"#limit\"\u003e limit(seconds)\u003c/a\u003e ⇒ \u003ccode\u003eStruct.Timeline\u003c/code\u003e\u003c/dt\u003e\n   \u003cdd\u003e\n      \u003cp\u003eLimits time for previous batch of events to finish. Takes timescale into account. If limit is reached, the timeline will proceed as if the previous batch completed\u003c/p\u003e\n   \u003c/dd\u003e\n   \u003cdt\u003e\u003ca href=\"#instantiate\"\u003e instantiate(x, y, amount, interval, obj, mode, properties)\u003c/a\u003e ⇒ \u003ccode\u003eStruct.Timeline\u003c/code\u003e\u003c/dt\u003e\n   \u003cdd\u003e\n      \u003cp\u003eCreates an Instantiate event that will instantiate objects\u003c/p\u003e\n   \u003c/dd\u003e\n   \u003cdt\u003e\u003ca href=\"#keyPress\"\u003ekeyPress(key)\u003c/a\u003e ⇒ \u003ccode\u003eStruct.Timeline\u003c/code\u003e\u003c/dt\u003e\n   \u003cdd\u003e\n      \u003cp\u003eWaits for a key to be pressed\u003c/p\u003e\n   \u003c/dd\u003e\n   \u003cdt\u003e\u003ca href=\"#keyReleased\"\u003ekeyReleased(key)\u003c/a\u003e ⇒ \u003ccode\u003eStruct.Timeline\u003c/code\u003e\u003c/dt\u003e\n   \u003cdd\u003e\n      \u003cp\u003eWaits for a key to be released\u003c/p\u003e\n   \u003c/dd\u003e\n   \u003cdt\u003e\u003ca href=\"#every\"\u003eevery(func, data)\u003c/a\u003e ⇒ \u003ccode\u003eStruct.Timeline\u003c/code\u003e\u003c/dt\u003e\n   \u003cdd\u003e\n      \u003cp\u003eAllows for a function to be run every step\u003c/p\u003e\n   \u003c/dd\u003e\n   \u003cdt\u003e\u003ca href=\"#once\"\u003eonce(callback, data)\u003c/a\u003e ⇒ \u003ccode\u003eStruct.Timeline\u003c/code\u003e\u003c/dt\u003e\n   \u003cdd\u003e\n      \u003cp\u003eAllows for a custom function to be called in between events,\n         the function gets called\tback a callback function that can be called to proceed with the timeline\n      \u003c/p\u003e\n   \u003c/dd\u003e\n   \u003cdt\u003e\u003ca href=\"#onFinish\"\u003eonFinish(callback)\u003c/a\u003e\u003c/dt\u003e\n   \u003cdd\u003e\n      \u003cp\u003eAllow you to pass a function to be called when the timeline is finished\u003c/p\u003e\n   \u003c/dd\u003e\n\u003c/dl\u003e\n\n\u003ca name=\"Timeline\"\u003e\u003c/a\u003e\n\n## Timeline() ⇒ \u003ccode\u003eStruct.Timeline\u003c/code\u003e\n\nCreates a new timeline\n\n\u003ca name=\"start\"\u003e\u003c/a\u003e\n\n## start() ⇒ \u003ccode\u003eStruct.Timeline\u003c/code\u003e\n\nStarts/continues the timeline\n\n\u003ca name=\"await\"\u003e\u003c/a\u003e\n\n## await() ⇒ \u003ccode\u003eStruct.Timeline\u003c/code\u003e\n\nWaits for previous events to finish\n\n\u003ca name=\"delay\"\u003e\u003c/a\u003e\n\n## delay(seconds, [onProgress]) ⇒ \u003ccode\u003eStruct.Timeline\u003c/code\u003e\n\nAllows for a delay between events\n\n| Param        | Type                  | Description                                                                            |\n| ------------ | --------------------- | -------------------------------------------------------------------------------------- |\n| seconds      | \u003ccode\u003eReal\u003c/code\u003e     | The delay in seconds, takes timescale into account                                     |\n| [onProgress] | \u003ccode\u003efunction\u003c/code\u003e | The function called every frame during the delay passing back remaining time in frames |\n\n\u003ca name=\"limit\"\u003e\u003c/a\u003e\n\n## limit(seconds) ⇒ \u003ccode\u003eStruct.Timeline\u003c/code\u003e\n\nSets a time limit in seconds for a batch of events to finish\n\n| Param   | Type              | Description                                        |\n| ------- | ----------------- | -------------------------------------------------- |\n| seconds | \u003ccode\u003eReal\u003c/code\u003e | The limit in seconds, takes timescale into account |\n\n\u003ca name=\"keyPress\"\u003e\u003c/a\u003e\n\n## keyPress(key) ⇒ \u003ccode\u003eStruct.Timeline\u003c/code\u003e\n\nWaits for a key to be pressed\n\n| Param | Type                                                  | Description       |\n| ----- | ----------------------------------------------------- | ----------------- |\n| key   | \u003ccode\u003eConstant.VirtualKey\u003c/code\u003e \\| \u003ccode\u003eReal\u003c/code\u003e | Virtual key index |\n\n\u003ca name=\"keyReleased\"\u003e\u003c/a\u003e\n\n## keyReleased(key) ⇒ \u003ccode\u003eStruct.Timeline\u003c/code\u003e\n\nWaits for a key to be released\n\n| Param | Type                                                  | Description       |\n| ----- | ----------------------------------------------------- | ----------------- |\n| key   | \u003ccode\u003eConstant.VirtualKey\u003c/code\u003e \\| \u003ccode\u003eReal\u003c/code\u003e | Virtual key index |\n\n\u003ca name=\"instantiate\"\u003e\u003c/a\u003e\n\n## instantiate(x, y, amount, interval, obj, mode, properties, callback) ⇒ \u003ccode\u003eStruct.Timeline\u003c/code\u003e\n\nWill instantiate objects at the specified interval\n\n| Param      | Type                     | Description                                               |\n| ---------- | ------------------------ | --------------------------------------------------------- |\n| x          | \u003ccode\u003eReal\u003c/code\u003e        | x coordinate to spawn instance at                         |\n| y          | \u003ccode\u003eReal\u003c/code\u003e        | y coordinate to spawn instance at                         |\n| amount     | \u003ccode\u003eReal\u003c/code\u003e        | Amount of instances to spawn                              |\n| interval   | \u003ccode\u003eReal\u003c/code\u003e        | Interval between each instance                            |\n| obj        | \u003ccode\u003eObject\u003c/code\u003e      | Object to instantiate                                     |\n| mode       | \u003ccode\u003eWaitingMode\u003c/code\u003e | Waiting mode                                              |\n| properties | \u003ccode\u003eStruct\u003c/code\u003e      | Properties to apply to each instance                      |\n| callback   | \u003ccode\u003eFunction\u003c/code\u003e    | Callback to be called when all instances are instantiated |\n\n`WaitingMode` is an enum with the following values:\n\n`Default` - Will simply create the instances and consider the event finished\n\n`Destroy` - Will consider the event finished when all instances are destroyed\n\n**Attention!**\n\nIf you want to use the `Destroy` mode, you must call `destroy(id)` on your instances to signal the timeline that they are destroyed.\nThe function will destroy the instance.\n\n\u003ca name=\"every\"\u003e\u003c/a\u003e\n\n## every(func, data) ⇒ \u003ccode\u003eStruct.Timeline\u003c/code\u003e\n\nAllows for a function to be run every step\n\n| Param | Type                              | Description                                                                                                                                              |\n| ----- |-----------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|\n| func  | \u003ccode\u003efunction(done, data)\u003c/code\u003e | Function to run every step - will be passed a function as its first argument. Call it to indicate that the function is done and the timeline can proceed |\n| data  | \u003ccode\u003eStruct.Any\u003c/code\u003e           | Data to be passed to the callback function                                                                                                               |\n\n\u003ca name=\"once\"\u003e\u003c/a\u003e\n\n## once(callback, data) ⇒ \u003ccode\u003eStruct.Timeline\u003c/code\u003e\n\nAllows for a custom function to be called in between events,\nthe function gets **called back a with callback function that can be called to proceed with the timeline**\n\n| Param    | Type                              | Description                                |\n| -------- |-----------------------------------|--------------------------------------------|\n| callback | \u003ccode\u003efunction(done, data)\u003c/code\u003e | The function to be called back. will be passed a function as its first argument. Call it to indicate that the function is done and the timeline can proceed  |\n| data     | \u003ccode\u003eStruct.Any\u003c/code\u003e           | Data to be passed to the callback function |\n\n\u003ca name=\"onFinish\"\u003e\u003c/a\u003e\n\n## onFinish(callback) ⇒ \u003ccode\u003evoid\u003c/code\u003e\n\nAllow you to pass a function to be called when the timeline is finished\n\n| Param    | Type                  | Description                                  |\n| -------- | --------------------- | -------------------------------------------- |\n| callback | \u003ccode\u003efunction\u003c/code\u003e | Function to be called when timeline finishes |\n","funding_links":[],"categories":["Timing"],"sub_categories":["Recommendations"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTimVN%2FGMTimeLine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTimVN%2FGMTimeLine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTimVN%2FGMTimeLine/lists"}