Components
diff --git a/api/input/index.html b/api/input/index.html index b4ebcc9..f0be9a2 100644 --- a/api/input/index.html +++ b/api/input/index.html @@ -3,9 +3,9 @@ -Input
diff --git a/api/intro/index.html b/api/intro/index.html index dd81793..8738c8a 100644 --- a/api/intro/index.html +++ b/api/intro/index.html @@ -3,9 +3,9 @@ -API Docs Introduction
diff --git a/api/scene/index.html b/api/scene/index.html index 62ba8bb..3a8b32d 100644 --- a/api/scene/index.html +++ b/api/scene/index.html @@ -3,9 +3,9 @@ -Scene
diff --git a/api/simuloobject/index.html b/api/simuloobject/index.html index 35e9e52..180012a 100644 --- a/api/simuloobject/index.html +++ b/api/simuloobject/index.html @@ -3,9 +3,9 @@ -SimuloObject
diff --git a/api/vec2/index.html b/api/vec2/index.html index d3d45a3..c5b6d27 100644 --- a/api/vec2/index.html +++ b/api/vec2/index.html @@ -3,9 +3,9 @@ -Vec2
diff --git a/assets/js/22dd74f7.762b1890.js b/assets/js/22dd74f7.ac5dcb9f.js similarity index 64% rename from assets/js/22dd74f7.762b1890.js rename to assets/js/22dd74f7.ac5dcb9f.js index b327515..ceaff74 100644 --- a/assets/js/22dd74f7.762b1890.js +++ b/assets/js/22dd74f7.ac5dcb9f.js @@ -1 +1 @@ -"use strict";(self.webpackChunksimulo_docs=self.webpackChunksimulo_docs||[]).push([[567],{5226:e=>{e.exports=JSON.parse('{"version":{"pluginId":"default","version":"current","label":"Next","banner":null,"badge":false,"noIndex":false,"className":"docs-version-current","isLast":true,"docsSidebars":{"apiSidebar":[{"type":"link","label":"API Docs Introduction","href":"/api/intro","docId":"api/intro","unlisted":false},{"type":"link","label":"Scene","href":"/api/scene/","docId":"api/scene/scene","unlisted":false},{"type":"link","label":"Vec2","href":"/api/vec2","docId":"api/vec2","unlisted":false},{"type":"link","label":"Components","href":"/api/components/","docId":"api/components/components","unlisted":false},{"type":"link","label":"Input","href":"/api/input/","docId":"api/input/input","unlisted":false},{"type":"link","label":"SimuloObject","href":"/api/simuloobject/","docId":"api/simuloobject/simuloobject","unlisted":false}],"samplesSidebar":[{"type":"link","label":"Samples","href":"/samples/intro","docId":"samples/intro","unlisted":false},{"type":"category","label":"Components","collapsible":true,"collapsed":false,"customProps":{"description":"Examples of component scripts"},"items":[{"type":"link","label":"Multi-File","href":"/samples/components/multifile","docId":"samples/components/multifile","unlisted":false},{"type":"link","label":"Platformer","href":"/samples/components/platformer","docId":"samples/components/platformer","unlisted":false}],"href":"/category/components"},{"type":"link","label":"Resetting The Scene","href":"/samples/reset","docId":"samples/reset","unlisted":false},{"type":"link","label":"Themes","href":"/samples/themes","docId":"samples/themes","unlisted":false}]},"docs":{"api/components/components":{"id":"api/components/components","title":"Components","description":"Components are scripts you place on objects in Simulo. They\'re very powerful and allow doing almost anything with scripting, even creating a platformer game in Simulo.","sidebar":"apiSidebar"},"api/input/input":{"id":"api/input/input","title":"Input","description":"The Input global provides functions relating to user input in the Simulo scene.","sidebar":"apiSidebar"},"api/intro":{"id":"api/intro","title":"API Docs Introduction","description":"Welcome to the Simulo API Docs! From here, you can learn all about the various parts of Simulo\'s Luau scripting API.","sidebar":"apiSidebar"},"api/scene/scene":{"id":"api/scene/scene","title":"Scene","description":"The Scene global provides fields and functions relating to the Simulo scene.","sidebar":"apiSidebar"},"api/simuloobject/simuloobject":{"id":"api/simuloobject/simuloobject","title":"SimuloObject","description":"All objects in a Simulo scene, such as boxes, circles, polygons, etc, are known to the API as s.","sidebar":"apiSidebar"},"api/vec2":{"id":"api/vec2","title":"Vec2","description":"is Simulo\'s built-in type for 2D vectors.","sidebar":"apiSidebar"},"samples/components/multifile":{"id":"samples/components/multifile","title":"Multi-File","description":"Instead of writing the component code inline in our Script Box script, we can use the temploadstring global:","sidebar":"samplesSidebar"},"samples/components/platformer":{"id":"samples/components/platformer","title":"Platformer","description":"Here\'s an example of a simple platformer parkour with components:","sidebar":"samplesSidebar"},"samples/intro":{"id":"samples/intro","title":"Samples","description":"Welcome to the Simulo samples, here we have some examples of Script Box scripts and Component scripts, etc.","sidebar":"samplesSidebar"},"samples/reset":{"id":"samples/reset","title":"Resetting The Scene","description":"The Simulo API currently has no built-in way to reset the scene to its default state. However, by using the following code, we can accomplish it anyway:","sidebar":"samplesSidebar"},"samples/themes":{"id":"samples/themes","title":"Themes","description":"We can create themes using scripts! Remember to run the reset function after defining it, or nothing will happen. We simply provide them without running them for convenience in copy-pasting them.","sidebar":"samplesSidebar"}}}}')}}]); \ No newline at end of file +"use strict";(self.webpackChunksimulo_docs=self.webpackChunksimulo_docs||[]).push([[567],{5226:e=>{e.exports=JSON.parse('{"version":{"pluginId":"default","version":"current","label":"Next","banner":null,"badge":false,"noIndex":false,"className":"docs-version-current","isLast":true,"docsSidebars":{"apiSidebar":[{"type":"link","label":"API Docs Introduction","href":"/api/intro","docId":"api/intro","unlisted":false},{"type":"link","label":"Scene","href":"/api/scene/","docId":"api/scene/scene","unlisted":false},{"type":"link","label":"Vec2","href":"/api/vec2","docId":"api/vec2","unlisted":false},{"type":"link","label":"Components","href":"/api/components/","docId":"api/components/components","unlisted":false},{"type":"link","label":"Input","href":"/api/input/","docId":"api/input/input","unlisted":false},{"type":"link","label":"SimuloObject","href":"/api/simuloobject/","docId":"api/simuloobject/simuloobject","unlisted":false}],"samplesSidebar":[{"type":"link","label":"Samples","href":"/samples/intro","docId":"samples/intro","unlisted":false},{"type":"category","label":"Components","collapsible":true,"collapsed":false,"customProps":{"description":"Examples of component scripts"},"items":[{"type":"link","label":"Multi-File","href":"/samples/components/multifile","docId":"samples/components/multifile","unlisted":false},{"type":"link","label":"Platformer","href":"/samples/components/platformer","docId":"samples/components/platformer","unlisted":false}],"href":"/category/components"},{"type":"link","label":"Resetting The Scene","href":"/samples/reset","docId":"samples/reset","unlisted":false},{"type":"link","label":"Themes","href":"/samples/themes","docId":"samples/themes","unlisted":false}]},"docs":{"api/components/components":{"id":"api/components/components","title":"Components","description":"Components are scripts you place on objects in Simulo. They\'re very powerful and allow doing almost anything with scripting, even creating a platformer game in Simulo.","sidebar":"apiSidebar"},"api/input/input":{"id":"api/input/input","title":"Input","description":"The Input global provides functions relating to user input in the Simulo scene.","sidebar":"apiSidebar"},"api/intro":{"id":"api/intro","title":"API Docs Introduction","description":"Welcome to the Simulo API Docs! From here, you can learn all about the various parts of Simulo\'s Luau scripting API.","sidebar":"apiSidebar"},"api/scene/scene":{"id":"api/scene/scene","title":"Scene","description":"The Scene global provides fields and functions relating to the Simulo scene.","sidebar":"apiSidebar"},"api/simuloobject/simuloobject":{"id":"api/simuloobject/simuloobject","title":"SimuloObject","description":"API documentation for SimuloObjects","sidebar":"apiSidebar"},"api/vec2":{"id":"api/vec2","title":"Vec2","description":"Vec2 is Simulo\'s built-in type for 2D vectors.","sidebar":"apiSidebar"},"samples/components/multifile":{"id":"samples/components/multifile","title":"Multi-File","description":"Sample of how to work with Simulo Components in multiple files","sidebar":"samplesSidebar"},"samples/components/platformer":{"id":"samples/components/platformer","title":"Platformer","description":"Sample of a simple platformer parkour in Simulo\'s Scripting API","sidebar":"samplesSidebar"},"samples/intro":{"id":"samples/intro","title":"Samples","description":"Various samples of scripts with the Simulo Scripting API","sidebar":"samplesSidebar"},"samples/reset":{"id":"samples/reset","title":"Resetting The Scene","description":"Sample of how to reset the Simulo scene in scripting","sidebar":"samplesSidebar"},"samples/themes":{"id":"samples/themes","title":"Themes","description":"Sample of how to apply themes to the Simulo scene using scripting","sidebar":"samplesSidebar"}}}}')}}]); \ No newline at end of file diff --git a/assets/js/26f6ec2d.c207375b.js b/assets/js/26f6ec2d.c207375b.js deleted file mode 100644 index 837a0d0..0000000 --- a/assets/js/26f6ec2d.c207375b.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunksimulo_docs=self.webpackChunksimulo_docs||[]).push([[801],{3823:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>d,contentTitle:()=>r,default:()=>u,frontMatter:()=>l,metadata:()=>p,toc:()=>o});var t=s(4848),i=s(8453);const l={},r="Input",p={id:"api/input/input",title:"Input",description:"The Input global provides functions relating to user input in the Simulo scene.",source:"@site/docs/api/input/input.mdx",sourceDirName:"api/input",slug:"/api/input/",permalink:"/api/input/",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{},sidebar:"apiSidebar",previous:{title:"Components",permalink:"/api/components/"},next:{title:"SimuloObject",permalink:"/api/simuloobject/"}},d={},o=[{value:"Functions",id:"functions",level:2},{value:"Input:pointer_pos()",id:"inputpointer_pos",level:3},{value:"Example",id:"example",level:4},{value:"Input:pointer_just_pressed()",id:"inputpointer_just_pressed",level:3},{value:"Example",id:"example-1",level:4},{value:"Input:pointer_just_released()",id:"inputpointer_just_released",level:3},{value:"Example",id:"example-2",level:4},{value:"Input:pointer_pressed()",id:"inputpointer_pressed",level:3},{value:"Example",id:"example-3",level:4},{value:"Input:key_just_pressed(...)",id:"inputkey_just_pressed",level:3},{value:"Example",id:"example-4",level:4},{value:"Input:key_just_released(...)",id:"inputkey_just_released",level:3},{value:"Example",id:"example-5",level:4},{value:"Input:key_pressed(...)",id:"inputkey_pressed",level:3},{value:"Example",id:"example-6",level:4}];function a(e){const n={admonition:"admonition",code:"code",h1:"h1",h2:"h2",h3:"h3",h4:"h4",hr:"hr",p:"p",pre:"pre",...(0,i.R)(),...e.components},{Type:s}=n;return s||function(e,n){throw new Error("Expected "+(n?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}("Type",!0),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h1,{id:"input",children:"Input"}),"\n",(0,t.jsxs)(n.p,{children:["The ",(0,t.jsx)(n.code,{children:"Input"})," global provides functions relating to user input in the Simulo scene."]}),"\n",(0,t.jsx)(n.admonition,{type:"warning",children:(0,t.jsx)(n.p,{children:"All of these APIs will change when multiplayer is added! But who knows when that will be Haha!"})}),"\n",(0,t.jsx)(n.h2,{id:"functions",children:"Functions"}),"\n",(0,t.jsx)(n.admonition,{type:"note",children:(0,t.jsxs)(n.p,{children:["Make sure to use ",(0,t.jsx)(n.code,{children:"Input:function()"})," and not ",(0,t.jsx)(n.code,{children:"Input.function()"}),", or you'll get an error"]})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"inputpointer_pos",children:"Input:pointer_pos()"}),"\n",(0,t.jsxs)(n.p,{children:["Returns the position of the mouse pointer in the world as a ",(0,t.jsx)(s,{name:"vec2"}),"."]}),"\n",(0,t.jsx)(n.h4,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"local pos = Input:pointer_pos();\n"})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"inputpointer_just_pressed",children:"Input:pointer_just_pressed()"}),"\n",(0,t.jsxs)(n.p,{children:["Returns whether the mouse left click was just pressed as a ",(0,t.jsx)(s,{name:"bool"}),"."]}),"\n",(0,t.jsx)(n.h4,{id:"example-1",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"if Input:pointer_just_pressed() then\n -- do something\nend;\n"})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"inputpointer_just_released",children:"Input:pointer_just_released()"}),"\n",(0,t.jsxs)(n.p,{children:["Returns whether the mouse left click was just released as a ",(0,t.jsx)(s,{name:"bool"}),"."]}),"\n",(0,t.jsx)(n.h4,{id:"example-2",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"if Input:pointer_just_released() then\n -- do something\nend;\n"})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"inputpointer_pressed",children:"Input:pointer_pressed()"}),"\n",(0,t.jsxs)(n.p,{children:["Returns whether the mouse left click is currently released as a ",(0,t.jsx)(s,{name:"bool"}),"."]}),"\n",(0,t.jsx)(n.h4,{id:"example-3",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"if Input:pointer_pressed() then\n -- do something\nend;\n"})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"inputkey_just_pressed",children:"Input:key_just_pressed(...)"}),"\n",(0,t.jsxs)(n.p,{children:["Returns whether the given key was just pressed as a ",(0,t.jsx)(s,{name:"bool"}),". Currently only supports ",(0,t.jsx)(n.code,{children:'"W"'}),", ",(0,t.jsx)(n.code,{children:'"A"'}),", ",(0,t.jsx)(n.code,{children:'"S"'})," and ",(0,t.jsx)(n.code,{children:'"D"'}),"."]}),"\n",(0,t.jsx)(n.h4,{id:"example-4",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:'if Input:key_just_pressed("W") then\n -- do something\nend;\n'})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"inputkey_just_released",children:"Input:key_just_released(...)"}),"\n",(0,t.jsxs)(n.p,{children:["Returns whether the given key was just released as a ",(0,t.jsx)(s,{name:"bool"}),". Currently only supports ",(0,t.jsx)(n.code,{children:'"W"'}),", ",(0,t.jsx)(n.code,{children:'"A"'}),", ",(0,t.jsx)(n.code,{children:'"S"'})," and ",(0,t.jsx)(n.code,{children:'"D"'}),"."]}),"\n",(0,t.jsx)(n.h4,{id:"example-5",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:'if Input:key_just_released("W") then\n -- do something\nend;\n'})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"inputkey_pressed",children:"Input:key_pressed(...)"}),"\n",(0,t.jsxs)(n.p,{children:["Returns whether the given key is currently pressed as a ",(0,t.jsx)(s,{name:"bool"}),". Currently only supports ",(0,t.jsx)(n.code,{children:'"W"'}),", ",(0,t.jsx)(n.code,{children:'"A"'}),", ",(0,t.jsx)(n.code,{children:'"S"'})," and ",(0,t.jsx)(n.code,{children:'"D"'}),"."]}),"\n",(0,t.jsx)(n.h4,{id:"example-6",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:'if Input:key_pressed("W") then\n -- do something\nend;\n'})})]})}function u(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(a,{...e})}):a(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>r,x:()=>p});var t=s(6540);const i={},l=t.createContext(i);function r(e){const n=t.useContext(l);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function p(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),t.createElement(l.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/26f6ec2d.dd53ac8d.js b/assets/js/26f6ec2d.dd53ac8d.js new file mode 100644 index 0000000..2d049d0 --- /dev/null +++ b/assets/js/26f6ec2d.dd53ac8d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunksimulo_docs=self.webpackChunksimulo_docs||[]).push([[801],{3823:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>d,contentTitle:()=>r,default:()=>a,frontMatter:()=>l,metadata:()=>p,toc:()=>o});var t=s(4848),i=s(8453);const l={title:"Input",description:"The Input global provides functions relating to user input in the Simulo scene."},r="Input",p={id:"api/input/input",title:"Input",description:"The Input global provides functions relating to user input in the Simulo scene.",source:"@site/docs/api/input/input.mdx",sourceDirName:"api/input",slug:"/api/input/",permalink:"/api/input/",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{title:"Input",description:"The Input global provides functions relating to user input in the Simulo scene."},sidebar:"apiSidebar",previous:{title:"Components",permalink:"/api/components/"},next:{title:"SimuloObject",permalink:"/api/simuloobject/"}},d={},o=[{value:"Functions",id:"functions",level:2},{value:"Input:pointer_pos()",id:"inputpointer_pos",level:3},{value:"Example",id:"example",level:4},{value:"Input:pointer_just_pressed()",id:"inputpointer_just_pressed",level:3},{value:"Example",id:"example-1",level:4},{value:"Input:pointer_just_released()",id:"inputpointer_just_released",level:3},{value:"Example",id:"example-2",level:4},{value:"Input:pointer_pressed()",id:"inputpointer_pressed",level:3},{value:"Example",id:"example-3",level:4},{value:"Input:key_just_pressed(...)",id:"inputkey_just_pressed",level:3},{value:"Example",id:"example-4",level:4},{value:"Input:key_just_released(...)",id:"inputkey_just_released",level:3},{value:"Example",id:"example-5",level:4},{value:"Input:key_pressed(...)",id:"inputkey_pressed",level:3},{value:"Example",id:"example-6",level:4}];function u(e){const n={admonition:"admonition",code:"code",h1:"h1",h2:"h2",h3:"h3",h4:"h4",hr:"hr",p:"p",pre:"pre",...(0,i.R)(),...e.components},{Type:s}=n;return s||function(e,n){throw new Error("Expected "+(n?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}("Type",!0),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h1,{id:"input",children:"Input"}),"\n",(0,t.jsxs)(n.p,{children:["The ",(0,t.jsx)(n.code,{children:"Input"})," global provides functions relating to user input in the Simulo scene."]}),"\n",(0,t.jsx)(n.admonition,{type:"warning",children:(0,t.jsx)(n.p,{children:"All of these APIs will change when multiplayer is added! But who knows when that will be Haha!"})}),"\n",(0,t.jsx)(n.h2,{id:"functions",children:"Functions"}),"\n",(0,t.jsx)(n.admonition,{type:"note",children:(0,t.jsxs)(n.p,{children:["Make sure to use ",(0,t.jsx)(n.code,{children:"Input:function()"})," and not ",(0,t.jsx)(n.code,{children:"Input.function()"}),", or you'll get an error"]})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"inputpointer_pos",children:"Input:pointer_pos()"}),"\n",(0,t.jsxs)(n.p,{children:["Returns the position of the mouse pointer in the world as a ",(0,t.jsx)(s,{name:"vec2"}),"."]}),"\n",(0,t.jsx)(n.h4,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"local pos = Input:pointer_pos();\n"})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"inputpointer_just_pressed",children:"Input:pointer_just_pressed()"}),"\n",(0,t.jsxs)(n.p,{children:["Returns whether the mouse left click was just pressed as a ",(0,t.jsx)(s,{name:"bool"}),"."]}),"\n",(0,t.jsx)(n.h4,{id:"example-1",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"if Input:pointer_just_pressed() then\n -- do something\nend;\n"})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"inputpointer_just_released",children:"Input:pointer_just_released()"}),"\n",(0,t.jsxs)(n.p,{children:["Returns whether the mouse left click was just released as a ",(0,t.jsx)(s,{name:"bool"}),"."]}),"\n",(0,t.jsx)(n.h4,{id:"example-2",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"if Input:pointer_just_released() then\n -- do something\nend;\n"})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"inputpointer_pressed",children:"Input:pointer_pressed()"}),"\n",(0,t.jsxs)(n.p,{children:["Returns whether the mouse left click is currently released as a ",(0,t.jsx)(s,{name:"bool"}),"."]}),"\n",(0,t.jsx)(n.h4,{id:"example-3",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"if Input:pointer_pressed() then\n -- do something\nend;\n"})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"inputkey_just_pressed",children:"Input:key_just_pressed(...)"}),"\n",(0,t.jsxs)(n.p,{children:["Returns whether the given key was just pressed as a ",(0,t.jsx)(s,{name:"bool"}),". Currently only supports ",(0,t.jsx)(n.code,{children:'"W"'}),", ",(0,t.jsx)(n.code,{children:'"A"'}),", ",(0,t.jsx)(n.code,{children:'"S"'})," and ",(0,t.jsx)(n.code,{children:'"D"'}),"."]}),"\n",(0,t.jsx)(n.h4,{id:"example-4",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:'if Input:key_just_pressed("W") then\n -- do something\nend;\n'})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"inputkey_just_released",children:"Input:key_just_released(...)"}),"\n",(0,t.jsxs)(n.p,{children:["Returns whether the given key was just released as a ",(0,t.jsx)(s,{name:"bool"}),". Currently only supports ",(0,t.jsx)(n.code,{children:'"W"'}),", ",(0,t.jsx)(n.code,{children:'"A"'}),", ",(0,t.jsx)(n.code,{children:'"S"'})," and ",(0,t.jsx)(n.code,{children:'"D"'}),"."]}),"\n",(0,t.jsx)(n.h4,{id:"example-5",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:'if Input:key_just_released("W") then\n -- do something\nend;\n'})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"inputkey_pressed",children:"Input:key_pressed(...)"}),"\n",(0,t.jsxs)(n.p,{children:["Returns whether the given key is currently pressed as a ",(0,t.jsx)(s,{name:"bool"}),". Currently only supports ",(0,t.jsx)(n.code,{children:'"W"'}),", ",(0,t.jsx)(n.code,{children:'"A"'}),", ",(0,t.jsx)(n.code,{children:'"S"'})," and ",(0,t.jsx)(n.code,{children:'"D"'}),"."]}),"\n",(0,t.jsx)(n.h4,{id:"example-6",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:'if Input:key_pressed("W") then\n -- do something\nend;\n'})})]})}function a(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(u,{...e})}):u(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>r,x:()=>p});var t=s(6540);const i={},l=t.createContext(i);function r(e){const n=t.useContext(l);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function p(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),t.createElement(l.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/2c273a5f.864b1504.js b/assets/js/2c273a5f.864b1504.js deleted file mode 100644 index 2fce5a6..0000000 --- a/assets/js/2c273a5f.864b1504.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunksimulo_docs=self.webpackChunksimulo_docs||[]).push([[306],{692:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>p,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>l,toc:()=>c});var o=r(4848),t=r(8453);const a={},s="Platformer",l={id:"samples/components/platformer",title:"Platformer",description:"Here's an example of a simple platformer parkour with components:",source:"@site/docs/samples/components/platformer.mdx",sourceDirName:"samples/components",slug:"/samples/components/platformer",permalink:"/samples/components/platformer",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{},sidebar:"samplesSidebar",previous:{title:"Multi-File",permalink:"/samples/components/multifile"},next:{title:"Resetting The Scene",permalink:"/samples/reset"}},p={},c=[];function i(e){const n={code:"code",h1:"h1",p:"p",pre:"pre",...(0,t.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.h1,{id:"platformer",children:"Platformer"}),"\n",(0,o.jsx)(n.p,{children:"Here's an example of a simple platformer parkour with components:"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-lua",children:'reset(); -- Add `reset` function from the samples so this works\n\n-- Add box for player\n\nlocal player = Scene:add_box({\n name = "player",\n position = vec2(2, -19.5),\n size = vec2(0.5, 0.5),\n is_static = false,\n color = 0xa0a0ff,\n});\n\nprint(player.guid);\n\nlocal hash = Scene:add_component({\n name = "Player Component",\n id = "@amytimed/test/player_component",\n version = "0.2.0",\n code = [[\n local speed = 5;\n local jump_force = 5;\n local parkour_x = 10;\n local parkour_y = -19;\n local parkour_size_x = 0.9;\n local parkour_gap = 5;\n local parkour_aa_e = 0;\n\n function on_start()\n print("start!!");\n spawn_parkour();\n end;\n\n function on_update()\n local current_vel = self:get_linear_velocity();\n\n local vel = vec2(0, current_vel.y);\n\n if Input:key_pressed("D") then\n vel.x = speed;\n end;\n if Input:key_pressed("A") then\n vel.x = -speed;\n end;\n if Input:key_just_pressed("W") then\n vel.y = jump_force;\n end;\n\n if (vel.x < 0 and current_vel.x > vel.x) or (vel.x > 0 and current_vel.x < vel.x) then\n self:set_linear_velocity(vec2(vel.x, vel.y));\n elseif vel.y > 0 then\n self:set_linear_velocity(vec2(current_vel.x, vel.y));\n end;\n\n self:set_angle(0);\n\n if self:get_position().x > parkour_x - 10 then\n spawn_parkour();\n end;\n end;\n\n function spawn_parkour()\n for i=0,2 do\n Scene:add_box({\n position = vec2(parkour_x, parkour_y),\n size = vec2(parkour_size_x, 0.2),\n color = 0xe5d3b9,\n is_static = true,\n --name = "Light"\n });\n\n if math.random(1, 5) == 4 then\n Scene:add_box({\n position = vec2(parkour_x + (parkour_size_x / 2), parkour_y + 1),\n size = vec2(0.1, 1.),\n color = 0xe5d3b9,\n is_static = true,\n });\n end;\n\n if math.random(1, 5) == 4 then\n Scene:add_box({\n position = vec2(parkour_x + (parkour_gap / 2), parkour_y + 6 + parkour_aa_e),\n size = vec2(0.1, 4.),\n color = 0xe5d3b9,\n is_static = true,\n });\n end;\n\n parkour_x += parkour_gap;\n parkour_gap *= 1.001;\n parkour_size_x /= 1.01;\n parkour_aa_e += 0.005;\n parkour_y += math.random(-0.5 - parkour_aa_e, 1.5 - parkour_aa_e);\n end;\n end;\n ]]\n});\n\nplayer:add_component(hash);\n\nprint(hash);\n'})})]})}function u(e={}){const{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(i,{...e})}):i(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>s,x:()=>l});var o=r(6540);const t={},a=o.createContext(t);function s(e){const n=o.useContext(a);return o.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:s(e.components),o.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/2c273a5f.e4879d45.js b/assets/js/2c273a5f.e4879d45.js new file mode 100644 index 0000000..7c4ba1a --- /dev/null +++ b/assets/js/2c273a5f.e4879d45.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunksimulo_docs=self.webpackChunksimulo_docs||[]).push([[306],{692:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>p,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>l,toc:()=>i});var o=r(4848),t=r(8453);const a={title:"Platformer",description:"Sample of a simple platformer parkour in Simulo's Scripting API"},s="Platformer",l={id:"samples/components/platformer",title:"Platformer",description:"Sample of a simple platformer parkour in Simulo's Scripting API",source:"@site/docs/samples/components/platformer.mdx",sourceDirName:"samples/components",slug:"/samples/components/platformer",permalink:"/samples/components/platformer",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{title:"Platformer",description:"Sample of a simple platformer parkour in Simulo's Scripting API"},sidebar:"samplesSidebar",previous:{title:"Multi-File",permalink:"/samples/components/multifile"},next:{title:"Resetting The Scene",permalink:"/samples/reset"}},p={},i=[];function c(e){const n={code:"code",h1:"h1",p:"p",pre:"pre",...(0,t.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.h1,{id:"platformer",children:"Platformer"}),"\n",(0,o.jsx)(n.p,{children:"Here's an example of a simple platformer parkour with components:"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-lua",children:'reset(); -- Add `reset` function from the samples so this works\n\n-- Add box for player\n\nlocal player = Scene:add_box({\n name = "player",\n position = vec2(2, -19.5),\n size = vec2(0.5, 0.5),\n is_static = false,\n color = 0xa0a0ff,\n});\n\nprint(player.guid);\n\nlocal hash = Scene:add_component({\n name = "Player Component",\n id = "@amytimed/test/player_component",\n version = "0.2.0",\n code = [[\n local speed = 5;\n local jump_force = 5;\n local parkour_x = 10;\n local parkour_y = -19;\n local parkour_size_x = 0.9;\n local parkour_gap = 5;\n local parkour_aa_e = 0;\n\n function on_start()\n print("start!!");\n spawn_parkour();\n end;\n\n function on_update()\n local current_vel = self:get_linear_velocity();\n\n local vel = vec2(0, current_vel.y);\n\n if Input:key_pressed("D") then\n vel.x = speed;\n end;\n if Input:key_pressed("A") then\n vel.x = -speed;\n end;\n if Input:key_just_pressed("W") then\n vel.y = jump_force;\n end;\n\n if (vel.x < 0 and current_vel.x > vel.x) or (vel.x > 0 and current_vel.x < vel.x) then\n self:set_linear_velocity(vec2(vel.x, vel.y));\n elseif vel.y > 0 then\n self:set_linear_velocity(vec2(current_vel.x, vel.y));\n end;\n\n self:set_angle(0);\n\n if self:get_position().x > parkour_x - 10 then\n spawn_parkour();\n end;\n end;\n\n function spawn_parkour()\n for i=0,2 do\n Scene:add_box({\n position = vec2(parkour_x, parkour_y),\n size = vec2(parkour_size_x, 0.2),\n color = 0xe5d3b9,\n is_static = true,\n --name = "Light"\n });\n\n if math.random(1, 5) == 4 then\n Scene:add_box({\n position = vec2(parkour_x + (parkour_size_x / 2), parkour_y + 1),\n size = vec2(0.1, 1.),\n color = 0xe5d3b9,\n is_static = true,\n });\n end;\n\n if math.random(1, 5) == 4 then\n Scene:add_box({\n position = vec2(parkour_x + (parkour_gap / 2), parkour_y + 6 + parkour_aa_e),\n size = vec2(0.1, 4.),\n color = 0xe5d3b9,\n is_static = true,\n });\n end;\n\n parkour_x += parkour_gap;\n parkour_gap *= 1.001;\n parkour_size_x /= 1.01;\n parkour_aa_e += 0.005;\n parkour_y += math.random(-0.5 - parkour_aa_e, 1.5 - parkour_aa_e);\n end;\n end;\n ]]\n});\n\nplayer:add_component(hash);\n\nprint(hash);\n'})})]})}function u(e={}){const{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(c,{...e})}):c(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>s,x:()=>l});var o=r(6540);const t={},a=o.createContext(t);function s(e){const n=o.useContext(a);return o.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:s(e.components),o.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/35fb1769.1a3dc886.js b/assets/js/35fb1769.1a3dc886.js deleted file mode 100644 index a6b376e..0000000 --- a/assets/js/35fb1769.1a3dc886.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunksimulo_docs=self.webpackChunksimulo_docs||[]).push([[736],{5742:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>d,frontMatter:()=>r,metadata:()=>i,toc:()=>l});var s=n(4848),o=n(8453);const r={},c="Resetting The Scene",i={id:"samples/reset",title:"Resetting The Scene",description:"The Simulo API currently has no built-in way to reset the scene to its default state. However, by using the following code, we can accomplish it anyway:",source:"@site/docs/samples/reset.md",sourceDirName:"samples",slug:"/samples/reset",permalink:"/samples/reset",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{},sidebar:"samplesSidebar",previous:{title:"Platformer",permalink:"/samples/components/platformer"},next:{title:"Themes",permalink:"/samples/themes"}},a={},l=[];function u(e){const t={code:"code",h1:"h1",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(t.h1,{id:"resetting-the-scene",children:"Resetting The Scene"}),"\n",(0,s.jsx)(t.p,{children:"The Simulo API currently has no built-in way to reset the scene to its default state. However, by using the following code, we can accomplish it anyway:"}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-lua",children:"function reset()\n -- Get all objects in the scene\n local objs = Scene:get_all_objects();\n\n -- Loop from 1 to the number of objects, thus looping over all objects in the scene\n for i=1,#objs do\n objs[i]:destroy(); -- Destroy each object in objs\n end;\n\n Scene:set_gravity(vec2(0, -9.805)); -- Reset gravity\n Scene.background_color = 0x34213d; -- Reset background color\n\n -- Re-add the Simulo ground\n Scene:add_box({\n position = vec2(0, -120),\n size = vec2(1000, 100),\n color = 0xb9a1c4,\n is_static = true,\n });\nend;\n"})}),"\n",(0,s.jsxs)(t.p,{children:["After defining this in the Script Box, we can now run ",(0,s.jsx)(t.code,{children:"reset();"})," to clear the scene. This is very useful when prototyping or iterating on a script, as we can keep rerunning it without restarting the game."]})]})}function d(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(u,{...e})}):u(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>c,x:()=>i});var s=n(6540);const o={},r=s.createContext(o);function c(e){const t=s.useContext(r);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:c(e.components),s.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/35fb1769.dcd41dff.js b/assets/js/35fb1769.dcd41dff.js new file mode 100644 index 0000000..6740185 --- /dev/null +++ b/assets/js/35fb1769.dcd41dff.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunksimulo_docs=self.webpackChunksimulo_docs||[]).push([[736],{5742:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>a,contentTitle:()=>i,default:()=>u,frontMatter:()=>r,metadata:()=>c,toc:()=>l});var s=n(4848),o=n(8453);const r={title:"Resetting The Scene",description:"Sample of how to reset the Simulo scene in scripting"},i="Resetting The Scene",c={id:"samples/reset",title:"Resetting The Scene",description:"Sample of how to reset the Simulo scene in scripting",source:"@site/docs/samples/reset.md",sourceDirName:"samples",slug:"/samples/reset",permalink:"/samples/reset",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{title:"Resetting The Scene",description:"Sample of how to reset the Simulo scene in scripting"},sidebar:"samplesSidebar",previous:{title:"Platformer",permalink:"/samples/components/platformer"},next:{title:"Themes",permalink:"/samples/themes"}},a={},l=[];function p(e){const t={code:"code",h1:"h1",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(t.h1,{id:"resetting-the-scene",children:"Resetting The Scene"}),"\n",(0,s.jsx)(t.p,{children:"The Simulo API currently has no built-in way to reset the scene to its default state. However, by using the following code, we can accomplish it anyway:"}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-lua",children:"function reset()\n -- Get all objects in the scene\n local objs = Scene:get_all_objects();\n\n -- Loop from 1 to the number of objects, thus looping over all objects in the scene\n for i=1,#objs do\n objs[i]:destroy(); -- Destroy each object in objs\n end;\n\n Scene:set_gravity(vec2(0, -9.805)); -- Reset gravity\n Scene.background_color = 0x34213d; -- Reset background color\n\n -- Re-add the Simulo ground\n Scene:add_box({\n position = vec2(0, -120),\n size = vec2(1000, 100),\n color = 0xb9a1c4,\n is_static = true,\n });\nend;\n"})}),"\n",(0,s.jsxs)(t.p,{children:["After defining this in the Script Box, we can now run ",(0,s.jsx)(t.code,{children:"reset();"})," to clear the scene. This is very useful when prototyping or iterating on a script, as we can keep rerunning it without restarting the game."]})]})}function u(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>c});var s=n(6540);const o={},r=s.createContext(o);function i(e){const t=s.useContext(r);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),s.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/5723fde7.32f39b40.js b/assets/js/5723fde7.32f39b40.js new file mode 100644 index 0000000..6fd667f --- /dev/null +++ b/assets/js/5723fde7.32f39b40.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunksimulo_docs=self.webpackChunksimulo_docs||[]).push([[976],{2541:(A,C,e)=>{e.r(C),e.d(C,{assets:()=>r,contentTitle:()=>B,default:()=>t,frontMatter:()=>Q,metadata:()=>o,toc:()=>c});var g=e(4848),n=e(8453);const Q={title:"Themes",description:"Sample of how to apply themes to the Simulo scene using scripting"},B="Themes",o={id:"samples/themes",title:"Themes",description:"Sample of how to apply themes to the Simulo scene using scripting",source:"@site/docs/samples/themes.mdx",sourceDirName:"samples",slug:"/samples/themes",permalink:"/samples/themes",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{title:"Themes",description:"Sample of how to apply themes to the Simulo scene using scripting"},sidebar:"samplesSidebar",previous:{title:"Resetting The Scene",permalink:"/samples/reset"}},r={},c=[{value:"Earth Theme",id:"earth-theme",level:2},{value:"Mars Theme",id:"mars-theme",level:2},{value:"Space Theme",id:"space-theme",level:2}];function s(A){const C={code:"code",h1:"h1",h2:"h2",img:"img",p:"p",pre:"pre",...(0,n.R)(),...A.components};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(C.h1,{id:"themes",children:"Themes"}),"\n",(0,g.jsxs)(C.p,{children:["We can create themes using scripts! Remember to run the ",(0,g.jsx)(C.code,{children:"reset"})," function after defining it, or nothing will happen. We simply provide them without running them for convenience in copy-pasting them."]}),"\n",(0,g.jsx)(C.h2,{id:"earth-theme",children:"Earth Theme"}),"\n",(0,g.jsx)(C.pre,{children:(0,g.jsx)(C.code,{className:"language-lua",children:"function reset()\n local ground_color = 0x4d9c0b;\n local background_color = 0x80bfff;\n\n Scene.background_color = background_color;\n\n local objs = Scene:get_all_objects();\n for i=1,#objs do\n objs[i]:destroy();\n end;\n\n Scene:set_gravity(vec2(0, -9.805))\n\n -- Ground\n Scene:add_box({\n position = vec2(0, -120),\n size = vec2(1000, 100),\n color = ground_color,\n is_static = true,\n });\nend;\n"})}),"\n",(0,g.jsx)(C.p,{children:(0,g.jsx)(C.img,{alt:"Earth Theme",src:e(5927).A+"",width:"933",height:"324"})}),"\n",(0,g.jsx)(C.h2,{id:"mars-theme",children:"Mars Theme"}),"\n",(0,g.jsx)(C.pre,{children:(0,g.jsx)(C.code,{className:"language-lua",children:"function reset()\n local ground_color = 0xab6533;\n local background_color = 0xad9778;\n\n Scene.background_color = background_color;\n\n local objs = Scene:get_all_objects();\n for i=1,#objs do\n objs[i]:destroy();\n end;\n\n Scene:set_gravity(vec2(0, -9.805))\n\n -- Ground\n Scene:add_box({\n position = vec2(0, -120),\n size = vec2(1000, 100),\n color = ground_color,\n is_static = true,\n });\nend;\n"})}),"\n",(0,g.jsx)(C.p,{children:(0,g.jsx)(C.img,{alt:"Mars Theme",src:e(8248).A+"",width:"930",height:"322"})}),"\n",(0,g.jsx)(C.h2,{id:"space-theme",children:"Space Theme"}),"\n",(0,g.jsx)(C.p,{children:"This one also changes gravity"}),"\n",(0,g.jsx)(C.pre,{children:(0,g.jsx)(C.code,{className:"language-lua",children:"function reset()\n local objs = Scene:get_all_objects();\n for i=1,#objs do\n objs[i]:destroy();\n end;\n Scene:set_gravity(vec2(0, 0));\n Scene.background_color = 0x000000;\nend;\n"})}),"\n",(0,g.jsx)(C.p,{children:(0,g.jsx)(C.img,{alt:"Space Theme",src:e(8969).A+"",width:"1013",height:"423"})})]})}function t(A={}){const{wrapper:C}={...(0,n.R)(),...A.components};return C?(0,g.jsx)(C,{...A,children:(0,g.jsx)(s,{...A})}):s(A)}},5927:(A,C,e)=>{e.d(C,{A:()=>g});const g="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA6UAAAFECAIAAABQxA8fAAAAA3NCSVQICAjb4U/gAAAAGXRFWHRTb2Z0d2FyZQBnbm9tZS1zY3JlZW5zaG907wO/PgAABl9JREFUeJzt2rENg0AABEFAFG4R0hSVOHbqiBSqeL20mqngwg1u/VzPAgAAUdvsAQAAMJDeBQCgTO8CAFCmdwEAKNO7AACU6V0AAMr0LgAAZXoXAIAyvQsAQJneBQCgTO8CAFCmdwEAKNO7AACU6V0AAMr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E1byrVAzeR7gHpVEvcBqiLfA/BGMXFfuRaomft7AHYko7ivXAvUTL4HoB/Jxn3lWqBy7nMA6MeWY54mmRfrKtcClZPvAWjHlhfrJhL3AWoj3wMwFO+M+83wX6yrXAtUzv09AAE2z/dbj/vKtUDl5HsA4rUV95VrAdznABCvrUfvK9cCyPcAJKeYN20BdE++ByB1O4/7yrUA7u8ByNvbcd/xPQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJTg/wH+9c1S7cS4rQAAAABJRU5ErkJggg=="},8453:(A,C,e)=>{e.d(C,{R:()=>B,x:()=>o});var g=e(6540);const n={},Q=g.createContext(n);function B(A){const C=g.useContext(Q);return g.useMemo((function(){return"function"==typeof A?A(C):{...C,...A}}),[C,A])}function o(A){let C;return C=A.disableParentContext?"function"==typeof A.components?A.components(n):A.components||n:B(A.components),g.createElement(Q.Provider,{value:C},A.children)}}}]); \ No newline at end of file diff --git a/assets/js/5723fde7.aeedb67a.js b/assets/js/5723fde7.aeedb67a.js deleted file mode 100644 index 3afbb86..0000000 --- a/assets/js/5723fde7.aeedb67a.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunksimulo_docs=self.webpackChunksimulo_docs||[]).push([[976],{2541:(A,C,e)=>{e.r(C),e.d(C,{assets:()=>r,contentTitle:()=>B,default:()=>I,frontMatter:()=>Q,metadata:()=>o,toc:()=>c});var g=e(4848),n=e(8453);const Q={},B="Themes",o={id:"samples/themes",title:"Themes",description:"We can create themes using scripts! Remember to run the reset function after defining it, or nothing will happen. We simply provide them without running them for convenience in copy-pasting them.",source:"@site/docs/samples/themes.mdx",sourceDirName:"samples",slug:"/samples/themes",permalink:"/samples/themes",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{},sidebar:"samplesSidebar",previous:{title:"Resetting The Scene",permalink:"/samples/reset"}},r={},c=[{value:"Earth Theme",id:"earth-theme",level:2},{value:"Mars Theme",id:"mars-theme",level:2},{value:"Space Theme",id:"space-theme",level:2}];function s(A){const C={code:"code",h1:"h1",h2:"h2",img:"img",p:"p",pre:"pre",...(0,n.R)(),...A.components};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(C.h1,{id:"themes",children:"Themes"}),"\n",(0,g.jsxs)(C.p,{children:["We can create themes using scripts! Remember to run the ",(0,g.jsx)(C.code,{children:"reset"})," function after defining it, or nothing will happen. We simply provide them without running them for convenience in copy-pasting them."]}),"\n",(0,g.jsx)(C.h2,{id:"earth-theme",children:"Earth Theme"}),"\n",(0,g.jsx)(C.pre,{children:(0,g.jsx)(C.code,{className:"language-lua",children:"function reset()\n local ground_color = 0x4d9c0b;\n local background_color = 0x80bfff;\n\n Scene.background_color = background_color;\n\n local objs = Scene:get_all_objects();\n for i=1,#objs do\n objs[i]:destroy();\n end;\n\n Scene:set_gravity(vec2(0, -9.805))\n\n -- Ground\n Scene:add_box({\n position = vec2(0, -120),\n size = vec2(1000, 100),\n color = ground_color,\n is_static = true,\n });\nend;\n"})}),"\n",(0,g.jsx)(C.p,{children:(0,g.jsx)(C.img,{alt:"Earth Theme",src:e(5927).A+"",width:"933",height:"324"})}),"\n",(0,g.jsx)(C.h2,{id:"mars-theme",children:"Mars Theme"}),"\n",(0,g.jsx)(C.pre,{children:(0,g.jsx)(C.code,{className:"language-lua",children:"function reset()\n local ground_color = 0xab6533;\n local background_color = 0xad9778;\n\n Scene.background_color = background_color;\n\n local objs = Scene:get_all_objects();\n for i=1,#objs do\n objs[i]:destroy();\n end;\n\n Scene:set_gravity(vec2(0, -9.805))\n\n -- Ground\n Scene:add_box({\n position = vec2(0, -120),\n size = vec2(1000, 100),\n color = ground_color,\n is_static = true,\n });\nend;\n"})}),"\n",(0,g.jsx)(C.p,{children:(0,g.jsx)(C.img,{alt:"Mars Theme",src:e(8248).A+"",width:"930",height:"322"})}),"\n",(0,g.jsx)(C.h2,{id:"space-theme",children:"Space Theme"}),"\n",(0,g.jsx)(C.p,{children:"This one also changes gravity"}),"\n",(0,g.jsx)(C.pre,{children:(0,g.jsx)(C.code,{className:"language-lua",children:"function reset()\n local objs = Scene:get_all_objects();\n for i=1,#objs do\n objs[i]:destroy();\n end;\n Scene:set_gravity(vec2(0, 0));\n Scene.background_color = 0x000000;\nend;\n"})}),"\n",(0,g.jsx)(C.p,{children:(0,g.jsx)(C.img,{alt:"Space Theme",src:e(8969).A+"",width:"1013",height:"423"})})]})}function I(A={}){const{wrapper:C}={...(0,n.R)(),...A.components};return C?(0,g.jsx)(C,{...A,children:(0,g.jsx)(s,{...A})}):s(A)}},5927:(A,C,e)=>{e.d(C,{A:()=>g});const g="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA6UAAAFECAIAAABQxA8fAAAAA3NCSVQICAjb4U/gAAAAGXRFWHRTb2Z0d2FyZQBnbm9tZS1zY3JlZW5zaG907wO/PgAABl9JREFUeJzt2rENg0AABEFAFG4R0hSVOHbqiBSqeL20mqngwg1u/VzPAgAAUdvsAQAAMJDeBQCgTO8CAFCmdwEAKNO7AACU6V0AAMr0LgAAZXoXAIAyvQsAQJneBQCgTO8CAFCmdwEAKNO7AACU6V0AAMr0LgAAZXoXAIAyvQsAQJneBQCgTO8CAFCmdwEAKNO7AACU6V0AAMr0LgAAZXoXAIAyvQsAQJneBQCgTO8CAFCmdwEAKNO7AACU6V0AAMr0LgAAZXoXAIAyvQsAQJneBQCgTO8CAFCmdwEAKNO7AACU6V0AAMr0LgAAZXoXAIAyvQsAQJneBQCgTO8CAFCmdwEAKNO7AACU6V0AAMr0LgAAZXoXAIAyvQsAQJneBQCgTO8CAFCmdwEAKNO7AACU6V0AAMr0LgAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJTg/wH+9c1S7cS4rQAAAABJRU5ErkJggg=="},8453:(A,C,e)=>{e.d(C,{R:()=>B,x:()=>o});var g=e(6540);const n={},Q=g.createContext(n);function B(A){const C=g.useContext(Q);return g.useMemo((function(){return"function"==typeof A?A(C):{...C,...A}}),[C,A])}function o(A){let C;return C=A.disableParentContext?"function"==typeof A.components?A.components(n):A.components||n:B(A.components),g.createElement(Q.Provider,{value:C},A.children)}}}]); \ No newline at end of file diff --git a/assets/js/6a638f41.e2fd09a7.js b/assets/js/6a638f41.e2fd09a7.js deleted file mode 100644 index da0e948..0000000 --- a/assets/js/6a638f41.e2fd09a7.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunksimulo_docs=self.webpackChunksimulo_docs||[]).push([[506],{8741:(e,n,l)=>{l.r(n),l.d(n,{assets:()=>o,contentTitle:()=>a,default:()=>h,frontMatter:()=>i,metadata:()=>c,toc:()=>r});var s=l(4848),t=l(8453);const i={},a="SimuloObject",c={id:"api/simuloobject/simuloobject",title:"SimuloObject",description:"All objects in a Simulo scene, such as boxes, circles, polygons, etc, are known to the API as s.",source:"@site/docs/api/simuloobject/simuloobject.mdx",sourceDirName:"api/simuloobject",slug:"/api/simuloobject/",permalink:"/api/simuloobject/",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{},sidebar:"apiSidebar",previous:{title:"Input",permalink:"/api/input/"}},o={},r=[{value:"Fields",id:"fields",level:2},{value:"Functions",id:"functions",level:2},{value:":destroy()",id:"destroy",level:3},{value:"Example",id:"example",level:4},{value:":get_position()",id:"get_position",level:3},{value:"Example",id:"example-1",level:4},{value:":set_position(...)",id:"set_position",level:3},{value:"Example",id:"example-2",level:4},{value:":get_angle()",id:"get_angle",level:3},{value:"Example",id:"example-3",level:4},{value:":set_angle(...)",id:"set_angle",level:3},{value:"Example",id:"example-4",level:4},{value:":get_linear_velocity()",id:"get_linear_velocity",level:3},{value:"Example",id:"example-5",level:4},{value:":set_linear_velocity(...)",id:"set_linear_velocity",level:3},{value:"Example",id:"example-6",level:4},{value:":get_angular_velocity()",id:"get_angular_velocity",level:3},{value:"Example",id:"example-7",level:4},{value:":set_angular_velocity(...)",id:"set_angular_velocity",level:3},{value:"Example",id:"example-8",level:4},{value:":apply_force_to_center(...)",id:"apply_force_to_center",level:3},{value:"Example",id:"example-9",level:4},{value:":add_component(...)",id:"add_component",level:3},{value:"Example",id:"example-10",level:4}];function d(e){const n={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",h3:"h3",h4:"h4",hr:"hr",li:"li",p:"p",pre:"pre",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,t.R)(),...e.components},{Type:l}=n;return l||function(e,n){throw new Error("Expected "+(n?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}("Type",!0),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h1,{id:"simuloobject",children:"SimuloObject"}),"\n",(0,s.jsxs)(n.p,{children:["All objects in a Simulo scene, such as boxes, circles, polygons, etc, are known to the API as ",(0,s.jsx)(l,{name:"object"}),"s."]}),"\n",(0,s.jsxs)(n.p,{children:["A ",(0,s.jsx)(l,{name:"object"})," reference is typically obtained by:"]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["Getting it with ",(0,s.jsx)(n.code,{children:"Scene:get_object_by_guid"})]}),"\n",(0,s.jsxs)(n.li,{children:["Getting it with ",(0,s.jsx)(n.code,{children:"Scene:get_all_objects"})]}),"\n",(0,s.jsxs)(n.li,{children:["Using ",(0,s.jsx)(n.code,{children:"self"})," in a ",(0,s.jsx)(n.a,{href:"/api/components/",children:"Component"})," script"]}),"\n"]}),"\n",(0,s.jsx)(n.h2,{id:"fields",children:"Fields"}),"\n",(0,s.jsxs)(n.table,{children:[(0,s.jsx)(n.thead,{children:(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.th,{children:"Field"}),(0,s.jsx)(n.th,{children:"Description"}),(0,s.jsx)(n.th,{children:"Note"}),(0,s.jsx)(n.th,{children:"Type"})]})}),(0,s.jsxs)(n.tbody,{children:[(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"guid"})}),(0,s.jsxs)(n.td,{children:["The ",(0,s.jsx)(l,{name:"guid"})," of the object"]}),(0,s.jsx)(n.td,{}),(0,s.jsx)(n.td,{children:(0,s.jsx)(l,{name:"number"})})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"color"})}),(0,s.jsxs)(n.td,{children:["The color of the object, like ",(0,s.jsx)(n.code,{children:"0xff0000"})," for red"]}),(0,s.jsx)(n.td,{}),(0,s.jsx)(n.td,{children:(0,s.jsx)(l,{name:"number"})})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"name"})}),(0,s.jsx)(n.td,{children:"The name of the object"}),(0,s.jsx)(n.td,{}),(0,s.jsx)(n.td,{children:(0,s.jsx)(l,{name:"string"})})]})]})]}),"\n",(0,s.jsx)(n.h2,{id:"functions",children:"Functions"}),"\n",(0,s.jsx)(n.admonition,{type:"note",children:(0,s.jsxs)(n.p,{children:["Make sure to use ",(0,s.jsx)(n.code,{children:"object:function()"})," and not ",(0,s.jsx)(n.code,{children:"object.function()"}),", or you'll get an error"]})}),"\n",(0,s.jsx)(n.hr,{}),"\n",(0,s.jsx)(n.h3,{id:"destroy",children:":destroy()"}),"\n",(0,s.jsxs)(n.p,{children:["Destroys the object. This will call any ",(0,s.jsx)(n.code,{children:"on_destroy"})," functions of components on the object."]}),"\n",(0,s.jsx)(n.h4,{id:"example",children:"Example"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-lua",children:"object:destroy();\n"})}),"\n",(0,s.jsx)(n.hr,{}),"\n",(0,s.jsx)(n.h3,{id:"get_position",children:":get_position()"}),"\n",(0,s.jsxs)(n.p,{children:["Returns the position of the object as a ",(0,s.jsx)(l,{name:"vec2"}),"."]}),"\n",(0,s.jsx)(n.h4,{id:"example-1",children:"Example"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-lua",children:"local pos = object:get_position();\n"})}),"\n",(0,s.jsx)(n.hr,{}),"\n",(0,s.jsx)(n.h3,{id:"set_position",children:":set_position(...)"}),"\n",(0,s.jsxs)(n.p,{children:["Sets the position of the object to a ",(0,s.jsx)(l,{name:"vec2"}),"."]}),"\n",(0,s.jsx)(n.h4,{id:"example-2",children:"Example"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-lua",children:"object:set_position(vec2(1, 1));\n"})}),"\n",(0,s.jsx)(n.hr,{}),"\n",(0,s.jsx)(n.h3,{id:"get_angle",children:":get_angle()"}),"\n",(0,s.jsxs)(n.p,{children:["Gets the angle of the object as a ",(0,s.jsx)(l,{name:"number"}),". Measured in radians."]}),"\n",(0,s.jsx)(n.h4,{id:"example-3",children:"Example"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-lua",children:"local angle = object:get_angle();\n"})}),"\n",(0,s.jsx)(n.hr,{}),"\n",(0,s.jsx)(n.h3,{id:"set_angle",children:":set_angle(...)"}),"\n",(0,s.jsxs)(n.p,{children:["Sets the angle of the object to a ",(0,s.jsx)(l,{name:"number"}),". Measured in radians."]}),"\n",(0,s.jsx)(n.h4,{id:"example-4",children:"Example"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-lua",children:"object:set_angle(math.pi); -- 180 degrees is pi radians\n"})}),"\n",(0,s.jsx)(n.hr,{}),"\n",(0,s.jsx)(n.h3,{id:"get_linear_velocity",children:":get_linear_velocity()"}),"\n",(0,s.jsxs)(n.p,{children:["Returns the linear velocity of the object as a ",(0,s.jsx)(l,{name:"vec2"}),". Measured in meters per second."]}),"\n",(0,s.jsx)(n.h4,{id:"example-5",children:"Example"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-lua",children:"local linvel = object:get_linear_velocity();\n"})}),"\n",(0,s.jsx)(n.hr,{}),"\n",(0,s.jsx)(n.h3,{id:"set_linear_velocity",children:":set_linear_velocity(...)"}),"\n",(0,s.jsxs)(n.p,{children:["Sets the linear velocity of the object to a ",(0,s.jsx)(l,{name:"vec2"}),". Measured in meters per second."]}),"\n",(0,s.jsxs)(n.p,{children:["Note that this will not behave realistically. You may want to use ",(0,s.jsx)(n.a,{href:"#apply_force_to_center",children:(0,s.jsx)(n.code,{children:":apply_force_to_center"})})," instead."]}),"\n",(0,s.jsx)(n.h4,{id:"example-6",children:"Example"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-lua",children:"object:set_linear_velocity(vec2(1, 1));\n"})}),"\n",(0,s.jsx)(n.hr,{}),"\n",(0,s.jsx)(n.h3,{id:"get_angular_velocity",children:":get_angular_velocity()"}),"\n",(0,s.jsxs)(n.p,{children:["Gets the angular velocity of the object as a ",(0,s.jsx)(l,{name:"number"}),". Measured in radians per second."]}),"\n",(0,s.jsx)(n.h4,{id:"example-7",children:"Example"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-lua",children:"local angle = object:get_angle();\n"})}),"\n",(0,s.jsx)(n.hr,{}),"\n",(0,s.jsx)(n.h3,{id:"set_angular_velocity",children:":set_angular_velocity(...)"}),"\n",(0,s.jsxs)(n.p,{children:["Sets the angular velocity of the object to a ",(0,s.jsx)(l,{name:"number"}),". Measured in radians per second."]}),"\n",(0,s.jsx)(n.h4,{id:"example-8",children:"Example"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-lua",children:"object:set_angular_velocity(0.174533); -- 10 degrees per second\n"})}),"\n",(0,s.jsx)(n.hr,{}),"\n",(0,s.jsx)(n.h3,{id:"apply_force_to_center",children:":apply_force_to_center(...)"}),"\n",(0,s.jsxs)(n.p,{children:["Applies a world force ",(0,s.jsx)(l,{name:"vec2"})," to the center of the object. Measured in newtons (N)."]}),"\n",(0,s.jsx)(n.h4,{id:"example-9",children:"Example"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-lua",children:"object:apply_force_to_center(vec2(0, 500));\n"})}),"\n",(0,s.jsx)(n.hr,{}),"\n",(0,s.jsx)(n.h3,{id:"add_component",children:":add_component(...)"}),"\n",(0,s.jsxs)(n.p,{children:["Adds a component of a ",(0,s.jsx)(l,{name:"hash"})," to the object."]}),"\n",(0,s.jsx)(n.h4,{id:"example-10",children:"Example"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-lua",children:"local hash = Scene:add_component(...); -- see component docs\n\nobject:add_component(hash);\n"})})]})}function h(e={}){const{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}},8453:(e,n,l)=>{l.d(n,{R:()=>a,x:()=>c});var s=l(6540);const t={},i=s.createContext(t);function a(e){const n=s.useContext(i);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:a(e.components),s.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/6a638f41.f88bfe75.js b/assets/js/6a638f41.f88bfe75.js new file mode 100644 index 0000000..d2c0a5d --- /dev/null +++ b/assets/js/6a638f41.f88bfe75.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunksimulo_docs=self.webpackChunksimulo_docs||[]).push([[506],{8741:(e,n,l)=>{l.r(n),l.d(n,{assets:()=>a,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>o,toc:()=>r});var t=l(4848),s=l(8453);const i={title:"SimuloObject",description:"API documentation for SimuloObjects"},c="SimuloObject",o={id:"api/simuloobject/simuloobject",title:"SimuloObject",description:"API documentation for SimuloObjects",source:"@site/docs/api/simuloobject/simuloobject.mdx",sourceDirName:"api/simuloobject",slug:"/api/simuloobject/",permalink:"/api/simuloobject/",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{title:"SimuloObject",description:"API documentation for SimuloObjects"},sidebar:"apiSidebar",previous:{title:"Input",permalink:"/api/input/"}},a={},r=[{value:"Fields",id:"fields",level:2},{value:"Functions",id:"functions",level:2},{value:":destroy()",id:"destroy",level:3},{value:"Example",id:"example",level:4},{value:":get_position()",id:"get_position",level:3},{value:"Example",id:"example-1",level:4},{value:":set_position(...)",id:"set_position",level:3},{value:"Example",id:"example-2",level:4},{value:":get_angle()",id:"get_angle",level:3},{value:"Example",id:"example-3",level:4},{value:":set_angle(...)",id:"set_angle",level:3},{value:"Example",id:"example-4",level:4},{value:":get_linear_velocity()",id:"get_linear_velocity",level:3},{value:"Example",id:"example-5",level:4},{value:":set_linear_velocity(...)",id:"set_linear_velocity",level:3},{value:"Example",id:"example-6",level:4},{value:":get_angular_velocity()",id:"get_angular_velocity",level:3},{value:"Example",id:"example-7",level:4},{value:":set_angular_velocity(...)",id:"set_angular_velocity",level:3},{value:"Example",id:"example-8",level:4},{value:":apply_force_to_center(...)",id:"apply_force_to_center",level:3},{value:"Example",id:"example-9",level:4},{value:":add_component(...)",id:"add_component",level:3},{value:"Example",id:"example-10",level:4}];function d(e){const n={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",h3:"h3",h4:"h4",hr:"hr",li:"li",p:"p",pre:"pre",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,s.R)(),...e.components},{Type:l}=n;return l||function(e,n){throw new Error("Expected "+(n?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}("Type",!0),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h1,{id:"simuloobject",children:"SimuloObject"}),"\n",(0,t.jsxs)(n.p,{children:["All objects in a Simulo scene, such as boxes, circles, polygons, etc, are known to the API as ",(0,t.jsx)(l,{name:"object"}),"s."]}),"\n",(0,t.jsxs)(n.p,{children:["A ",(0,t.jsx)(l,{name:"object"})," reference is typically obtained by:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Getting it with ",(0,t.jsx)(n.code,{children:"Scene:get_object_by_guid"})]}),"\n",(0,t.jsxs)(n.li,{children:["Getting it with ",(0,t.jsx)(n.code,{children:"Scene:get_all_objects"})]}),"\n",(0,t.jsxs)(n.li,{children:["Using ",(0,t.jsx)(n.code,{children:"self"})," in a ",(0,t.jsx)(n.a,{href:"/api/components/",children:"Component"})," script"]}),"\n"]}),"\n",(0,t.jsx)(n.h2,{id:"fields",children:"Fields"}),"\n",(0,t.jsxs)(n.table,{children:[(0,t.jsx)(n.thead,{children:(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.th,{children:"Field"}),(0,t.jsx)(n.th,{children:"Description"}),(0,t.jsx)(n.th,{children:"Note"}),(0,t.jsx)(n.th,{children:"Type"})]})}),(0,t.jsxs)(n.tbody,{children:[(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"guid"})}),(0,t.jsxs)(n.td,{children:["The ",(0,t.jsx)(l,{name:"guid"})," of the object"]}),(0,t.jsx)(n.td,{}),(0,t.jsx)(n.td,{children:(0,t.jsx)(l,{name:"number"})})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"color"})}),(0,t.jsxs)(n.td,{children:["The color of the object, like ",(0,t.jsx)(n.code,{children:"0xff0000"})," for red"]}),(0,t.jsx)(n.td,{}),(0,t.jsx)(n.td,{children:(0,t.jsx)(l,{name:"number"})})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"name"})}),(0,t.jsx)(n.td,{children:"The name of the object"}),(0,t.jsx)(n.td,{}),(0,t.jsx)(n.td,{children:(0,t.jsx)(l,{name:"string"})})]})]})]}),"\n",(0,t.jsx)(n.h2,{id:"functions",children:"Functions"}),"\n",(0,t.jsx)(n.admonition,{type:"note",children:(0,t.jsxs)(n.p,{children:["Make sure to use ",(0,t.jsx)(n.code,{children:"object:function()"})," and not ",(0,t.jsx)(n.code,{children:"object.function()"}),", or you'll get an error"]})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"destroy",children:":destroy()"}),"\n",(0,t.jsxs)(n.p,{children:["Destroys the object. This will call any ",(0,t.jsx)(n.code,{children:"on_destroy"})," functions of components on the object."]}),"\n",(0,t.jsx)(n.h4,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"object:destroy();\n"})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"get_position",children:":get_position()"}),"\n",(0,t.jsxs)(n.p,{children:["Returns the position of the object as a ",(0,t.jsx)(l,{name:"vec2"}),"."]}),"\n",(0,t.jsx)(n.h4,{id:"example-1",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"local pos = object:get_position();\n"})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"set_position",children:":set_position(...)"}),"\n",(0,t.jsxs)(n.p,{children:["Sets the position of the object to a ",(0,t.jsx)(l,{name:"vec2"}),"."]}),"\n",(0,t.jsx)(n.h4,{id:"example-2",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"object:set_position(vec2(1, 1));\n"})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"get_angle",children:":get_angle()"}),"\n",(0,t.jsxs)(n.p,{children:["Gets the angle of the object as a ",(0,t.jsx)(l,{name:"number"}),". Measured in radians."]}),"\n",(0,t.jsx)(n.h4,{id:"example-3",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"local angle = object:get_angle();\n"})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"set_angle",children:":set_angle(...)"}),"\n",(0,t.jsxs)(n.p,{children:["Sets the angle of the object to a ",(0,t.jsx)(l,{name:"number"}),". Measured in radians."]}),"\n",(0,t.jsx)(n.h4,{id:"example-4",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"object:set_angle(math.pi); -- 180 degrees is pi radians\n"})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"get_linear_velocity",children:":get_linear_velocity()"}),"\n",(0,t.jsxs)(n.p,{children:["Returns the linear velocity of the object as a ",(0,t.jsx)(l,{name:"vec2"}),". Measured in meters per second."]}),"\n",(0,t.jsx)(n.h4,{id:"example-5",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"local linvel = object:get_linear_velocity();\n"})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"set_linear_velocity",children:":set_linear_velocity(...)"}),"\n",(0,t.jsxs)(n.p,{children:["Sets the linear velocity of the object to a ",(0,t.jsx)(l,{name:"vec2"}),". Measured in meters per second."]}),"\n",(0,t.jsxs)(n.p,{children:["Note that this will not behave realistically. You may want to use ",(0,t.jsx)(n.a,{href:"#apply_force_to_center",children:(0,t.jsx)(n.code,{children:":apply_force_to_center"})})," instead."]}),"\n",(0,t.jsx)(n.h4,{id:"example-6",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"object:set_linear_velocity(vec2(1, 1));\n"})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"get_angular_velocity",children:":get_angular_velocity()"}),"\n",(0,t.jsxs)(n.p,{children:["Gets the angular velocity of the object as a ",(0,t.jsx)(l,{name:"number"}),". Measured in radians per second."]}),"\n",(0,t.jsx)(n.h4,{id:"example-7",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"local angle = object:get_angle();\n"})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"set_angular_velocity",children:":set_angular_velocity(...)"}),"\n",(0,t.jsxs)(n.p,{children:["Sets the angular velocity of the object to a ",(0,t.jsx)(l,{name:"number"}),". Measured in radians per second."]}),"\n",(0,t.jsx)(n.h4,{id:"example-8",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"object:set_angular_velocity(0.174533); -- 10 degrees per second\n"})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"apply_force_to_center",children:":apply_force_to_center(...)"}),"\n",(0,t.jsxs)(n.p,{children:["Applies a world force ",(0,t.jsx)(l,{name:"vec2"})," to the center of the object. Measured in newtons (N)."]}),"\n",(0,t.jsx)(n.h4,{id:"example-9",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"object:apply_force_to_center(vec2(0, 500));\n"})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"add_component",children:":add_component(...)"}),"\n",(0,t.jsxs)(n.p,{children:["Adds a component of a ",(0,t.jsx)(l,{name:"hash"})," to the object."]}),"\n",(0,t.jsx)(n.h4,{id:"example-10",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"local hash = Scene:add_component(...); -- see component docs\n\nobject:add_component(hash);\n"})})]})}function h(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(d,{...e})}):d(e)}},8453:(e,n,l)=>{l.d(n,{R:()=>c,x:()=>o});var t=l(6540);const s={},i=t.createContext(s);function c(e){const n=t.useContext(i);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:c(e.components),t.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/70f34273.60538b94.js b/assets/js/70f34273.60538b94.js new file mode 100644 index 0000000..3476799 --- /dev/null +++ b/assets/js/70f34273.60538b94.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunksimulo_docs=self.webpackChunksimulo_docs||[]).push([[111],{3601:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>r,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>t,toc:()=>o});var l=s(4848),d=s(8453);const i={sidebar_position:2,title:"Scene",description:"The Scene global provides fields and functions relating to the Simulo scene."},c="Scene",t={id:"api/scene/scene",title:"Scene",description:"The Scene global provides fields and functions relating to the Simulo scene.",source:"@site/docs/api/scene/scene.md",sourceDirName:"api/scene",slug:"/api/scene/",permalink:"/api/scene/",draft:!1,unlisted:!1,tags:[],version:"current",sidebarPosition:2,frontMatter:{sidebar_position:2,title:"Scene",description:"The Scene global provides fields and functions relating to the Simulo scene."},sidebar:"apiSidebar",previous:{title:"API Docs Introduction",permalink:"/api/intro"},next:{title:"Vec2",permalink:"/api/vec2"}},r={},o=[{value:"Fields",id:"fields",level:2},{value:"Functions",id:"functions",level:2},{value:"Scene:add_box(...)",id:"sceneadd_box",level:3},{value:"Example",id:"example",level:4},{value:"Table Fields",id:"table-fields",level:4},{value:"Scene:add_circle(...)",id:"sceneadd_circle",level:3},{value:"Example",id:"example-1",level:4},{value:"Table Fields",id:"table-fields-1",level:4},{value:"Scene:add_component(...)",id:"sceneadd_component",level:3},{value:"Example",id:"example-2",level:4},{value:"Table Fields",id:"table-fields-2",level:4},{value:"Scene:add_simulon(...)",id:"sceneadd_simulon",level:3},{value:"Example",id:"example-3",level:4},{value:"Table Fields",id:"table-fields-3",level:4},{value:"Scene:get_object_by_guid(...)",id:"sceneget_object_by_guid",level:3},{value:"Example",id:"example-4",level:4},{value:"Scene:get_all_objects()",id:"sceneget_all_objects",level:3},{value:"Example",id:"example-5",level:4},{value:"Scene:get_gravity()",id:"sceneget_gravity",level:3},{value:"Example",id:"example-6",level:4},{value:"Scene:set_gravity(...)",id:"sceneset_gravity",level:3},{value:"Example",id:"example-7",level:4},{value:"Scene:overlap_circle(...)",id:"sceneoverlap_circle",level:3},{value:"Example",id:"example-8",level:4},{value:"Table Fields",id:"table-fields-4",level:4},{value:"Scene:explode(...)",id:"sceneexplode",level:3},{value:"Example",id:"example-9",level:4},{value:"Table Fields",id:"table-fields-5",level:4}];function a(e){const n={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",h3:"h3",h4:"h4",hr:"hr",p:"p",pre:"pre",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,d.R)(),...e.components},{Type:s}=n;return s||function(e,n){throw new Error("Expected "+(n?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}("Type",!0),(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(n.h1,{id:"scene",children:"Scene"}),"\n",(0,l.jsxs)(n.p,{children:["The ",(0,l.jsx)(n.code,{children:"Scene"})," global provides fields and functions relating to the Simulo scene."]}),"\n",(0,l.jsx)(n.h2,{id:"fields",children:"Fields"}),"\n",(0,l.jsxs)(n.table,{children:[(0,l.jsx)(n.thead,{children:(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.th,{children:"Field"}),(0,l.jsx)(n.th,{children:"Description"}),(0,l.jsx)(n.th,{children:"Note"}),(0,l.jsx)(n.th,{children:"Default"}),(0,l.jsx)(n.th,{children:"Type"})]})}),(0,l.jsxs)(n.tbody,{children:[(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:(0,l.jsx)(n.code,{children:"Scene.title"})}),(0,l.jsx)(n.td,{children:"The name of the scene"}),(0,l.jsx)(n.td,{}),(0,l.jsx)(n.td,{children:(0,l.jsx)(n.code,{children:'"Untitled Scene"'})}),(0,l.jsx)(n.td,{children:(0,l.jsx)(s,{name:"string"})})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:(0,l.jsx)(n.code,{children:"Scene.background_color"})}),(0,l.jsx)(n.td,{children:"The color shown behind the scene"}),(0,l.jsx)(n.td,{}),(0,l.jsx)(n.td,{children:(0,l.jsx)(n.code,{children:"0x34213d"})}),(0,l.jsx)(n.td,{children:(0,l.jsx)(s,{name:"number"})})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:(0,l.jsx)(n.code,{children:"Scene.runtime_version"})}),(0,l.jsx)(n.td,{children:"The version of the Simulo Runtime"}),(0,l.jsx)(n.td,{children:"Read-only"}),(0,l.jsx)(n.td,{}),(0,l.jsx)(n.td,{children:(0,l.jsx)(s,{name:"string"})})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:(0,l.jsx)(n.code,{children:"Scene.box2d_version"})}),(0,l.jsx)(n.td,{children:"The version of Box2D used in the Simulo runtime"}),(0,l.jsx)(n.td,{children:"Read-only"}),(0,l.jsx)(n.td,{children:(0,l.jsx)(n.code,{children:"3.0.0"})}),(0,l.jsx)(n.td,{children:(0,l.jsx)(s,{name:"string"})})]})]})]}),"\n",(0,l.jsx)(n.h2,{id:"functions",children:"Functions"}),"\n",(0,l.jsx)(n.admonition,{type:"note",children:(0,l.jsxs)(n.p,{children:["Make sure to use ",(0,l.jsx)(n.code,{children:"Scene:function()"})," and not ",(0,l.jsx)(n.code,{children:"Scene.function()"}),", or you'll get an error"]})}),"\n",(0,l.jsx)(n.hr,{}),"\n",(0,l.jsx)(n.h3,{id:"sceneadd_box",children:"Scene:add_box(...)"}),"\n",(0,l.jsxs)(n.p,{children:["Adds a new box to the scene. Takes a table as parameter, returns a ",(0,l.jsx)(s,{name:"object"}),"."]}),"\n",(0,l.jsx)(n.h4,{id:"example",children:"Example"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-lua",children:"Scene:add_box({\n position = vec2(0, 0),\n size = vec2(1, 1),\n color = 0xe5d3b9,\n is_static = false,\n});\n"})}),"\n",(0,l.jsx)(n.h4,{id:"table-fields",children:"Table Fields"}),"\n",(0,l.jsxs)(n.table,{children:[(0,l.jsx)(n.thead,{children:(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.th,{children:"Table Field"}),(0,l.jsx)(n.th,{children:"Description"}),(0,l.jsx)(n.th,{children:"Note"})]})}),(0,l.jsxs)(n.tbody,{children:[(0,l.jsxs)(n.tr,{children:[(0,l.jsxs)(n.td,{children:[(0,l.jsx)(n.code,{children:"position"})," ",(0,l.jsx)(s,{name:"vec2"})]}),(0,l.jsx)(n.td,{children:"Where to spawn the box"}),(0,l.jsx)(n.td,{})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsxs)(n.td,{children:[(0,l.jsx)(n.code,{children:"size"})," ",(0,l.jsx)(s,{name:"vec2"})]}),(0,l.jsx)(n.td,{children:"Size of the box in meters"}),(0,l.jsx)(n.td,{})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsxs)(n.td,{children:[(0,l.jsx)(n.code,{children:"color"})," ",(0,l.jsx)(s,{name:"number"})]}),(0,l.jsxs)(n.td,{children:["Color of the box, like ",(0,l.jsx)(n.code,{children:"0xe5d3b9"})]}),(0,l.jsx)(n.td,{})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsxs)(n.td,{children:[(0,l.jsx)(n.code,{children:"is_static"})," ",(0,l.jsx)(s,{name:"boolean"})]}),(0,l.jsx)(n.td,{children:'Should the box be "glued to the background"?'}),(0,l.jsx)(n.td,{})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsxs)(n.td,{children:[(0,l.jsx)(n.code,{children:"name"})," ",(0,l.jsx)(s,{name:"string"})]}),(0,l.jsxs)(n.td,{children:["What should the name of the box be? Defaults to ",(0,l.jsx)(n.code,{children:'"Box"'})]}),(0,l.jsx)(n.td,{children:"Optional"})]})]})]}),"\n",(0,l.jsx)(n.hr,{}),"\n",(0,l.jsx)(n.h3,{id:"sceneadd_circle",children:"Scene:add_circle(...)"}),"\n",(0,l.jsxs)(n.p,{children:["Adds a new circle to the scene. Takes a table as parameter, returns a ",(0,l.jsx)(s,{name:"object"}),"."]}),"\n",(0,l.jsx)(n.h4,{id:"example-1",children:"Example"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-lua",children:"Scene:add_circle({\n position = vec2(0, 0),\n radius = 1,\n color = 0xe5d3b9,\n is_static = false,\n});\n"})}),"\n",(0,l.jsx)(n.h4,{id:"table-fields-1",children:"Table Fields"}),"\n",(0,l.jsxs)(n.table,{children:[(0,l.jsx)(n.thead,{children:(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.th,{children:"Table Field"}),(0,l.jsx)(n.th,{children:"Description"}),(0,l.jsx)(n.th,{children:"Note"})]})}),(0,l.jsxs)(n.tbody,{children:[(0,l.jsxs)(n.tr,{children:[(0,l.jsxs)(n.td,{children:[(0,l.jsx)(n.code,{children:"position"})," ",(0,l.jsx)(s,{name:"vec2"})]}),(0,l.jsx)(n.td,{children:"Where to spawn the circle"}),(0,l.jsx)(n.td,{})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsxs)(n.td,{children:[(0,l.jsx)(n.code,{children:"radius"})," ",(0,l.jsx)(s,{name:"number"})]}),(0,l.jsx)(n.td,{children:"Radius of the circle in meters"}),(0,l.jsx)(n.td,{})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsxs)(n.td,{children:[(0,l.jsx)(n.code,{children:"color"})," ",(0,l.jsx)(s,{name:"number"})]}),(0,l.jsxs)(n.td,{children:["Color of the circle, like ",(0,l.jsx)(n.code,{children:"0xe5d3b9"})]}),(0,l.jsx)(n.td,{})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsxs)(n.td,{children:[(0,l.jsx)(n.code,{children:"is_static"})," ",(0,l.jsx)(s,{name:"boolean"})]}),(0,l.jsx)(n.td,{children:'Should the circle be "glued to the background"?'}),(0,l.jsx)(n.td,{})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsxs)(n.td,{children:[(0,l.jsx)(n.code,{children:"name"})," ",(0,l.jsx)(s,{name:"string"})]}),(0,l.jsxs)(n.td,{children:["What should the name of the circle be? Defaults to ",(0,l.jsx)(n.code,{children:'"Circle"'})]}),(0,l.jsx)(n.td,{children:"Optional"})]})]})]}),"\n",(0,l.jsx)(n.hr,{}),"\n",(0,l.jsx)(n.h3,{id:"sceneadd_component",children:"Scene:add_component(...)"}),"\n",(0,l.jsxs)(n.p,{children:["Adds a new component to the scene. Takes a table as parameter, returns a ",(0,l.jsx)(s,{name:"hash"}),"."]}),"\n",(0,l.jsxs)(n.p,{children:["For a detailed explanation, check out the ",(0,l.jsx)(n.a,{href:"/api/components/",children:"Components section of the API Docs"}),"."]}),"\n",(0,l.jsx)(n.h4,{id:"example-2",children:"Example"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-lua",children:'Scene:add_component({\n name = "My Component",\n version = "0.1.0",\n id = "@john_doe/test/my_component",\n\n -- Lua/Luau code\n code = [[\n function on_start()\n print("Hello, worlds!");\n end;\n ]],\n});\n'})}),"\n",(0,l.jsx)(n.h4,{id:"table-fields-2",children:"Table Fields"}),"\n",(0,l.jsxs)(n.table,{children:[(0,l.jsx)(n.thead,{children:(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.th,{children:"Table Field"}),(0,l.jsx)(n.th,{children:"Description"}),(0,l.jsx)(n.th,{children:"Note"})]})}),(0,l.jsxs)(n.tbody,{children:[(0,l.jsxs)(n.tr,{children:[(0,l.jsxs)(n.td,{children:[(0,l.jsx)(n.code,{children:"name"})," ",(0,l.jsx)(s,{name:"string"})]}),(0,l.jsx)(n.td,{children:"Where to spawn the circle"}),(0,l.jsx)(n.td,{})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsxs)(n.td,{children:[(0,l.jsx)(n.code,{children:"version"})," ",(0,l.jsx)(s,{name:"string"})]}),(0,l.jsxs)(n.td,{children:["Component metadata version, defaults to ",(0,l.jsx)(n.code,{children:'"0.1.0"'})]}),(0,l.jsx)(n.td,{children:"Optional"})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsxs)(n.td,{children:[(0,l.jsx)(n.code,{children:"id"})," ",(0,l.jsx)(s,{name:"string"})]}),(0,l.jsxs)(n.td,{children:["Unique ID for your component, should be something like ",(0,l.jsx)(n.code,{children:'"@yourname/projectname/componentname"'})]}),(0,l.jsx)(n.td,{})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsxs)(n.td,{children:[(0,l.jsx)(n.code,{children:"code"})," ",(0,l.jsx)(s,{name:"string"})]}),(0,l.jsx)(n.td,{children:"Luau script for the component"}),(0,l.jsx)(n.td,{})]})]})]}),"\n",(0,l.jsx)(n.hr,{}),"\n",(0,l.jsx)(n.h3,{id:"sceneadd_simulon",children:"Scene:add_simulon(...)"}),"\n",(0,l.jsx)(n.p,{children:"Adds a simulon to the scene, Simulo's mascot. Returns nothing."}),"\n",(0,l.jsx)(n.p,{children:"This function may be removed by public release, where users will instead be able to spawn simulons just like any other saved object."}),"\n",(0,l.jsx)(n.h4,{id:"example-3",children:"Example"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-lua",children:"Scene:add_simulon({\n position = vec2(0, 0),\n density = 1,\n color = 0xff0000,\n});\n"})}),"\n",(0,l.jsx)(n.h4,{id:"table-fields-3",children:"Table Fields"}),"\n",(0,l.jsxs)(n.table,{children:[(0,l.jsx)(n.thead,{children:(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.th,{children:"Table Field"}),(0,l.jsx)(n.th,{children:"Description"}),(0,l.jsx)(n.th,{children:"Note"})]})}),(0,l.jsxs)(n.tbody,{children:[(0,l.jsxs)(n.tr,{children:[(0,l.jsxs)(n.td,{children:[(0,l.jsx)(n.code,{children:"position"})," ",(0,l.jsx)(s,{name:"vec2"})]}),(0,l.jsx)(n.td,{children:"Where to spawn the simulon"}),(0,l.jsx)(n.td,{})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsxs)(n.td,{children:[(0,l.jsx)(n.code,{children:"density"})," ",(0,l.jsx)(s,{name:"number"})]}),(0,l.jsx)(n.td,{children:"Density for the simulon"}),(0,l.jsx)(n.td,{})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsxs)(n.td,{children:[(0,l.jsx)(n.code,{children:"color"})," ",(0,l.jsx)(s,{name:"number"})]}),(0,l.jsxs)(n.td,{children:["Simulon color, defaults to ",(0,l.jsx)(n.code,{children:"0xa9bc67"})]}),(0,l.jsx)(n.td,{children:"Optional"})]})]})]}),"\n",(0,l.jsx)(n.hr,{}),"\n",(0,l.jsx)(n.h3,{id:"sceneget_object_by_guid",children:"Scene:get_object_by_guid(...)"}),"\n",(0,l.jsxs)(n.p,{children:["Returns the ",(0,l.jsx)(s,{name:"object"})," of the given ",(0,l.jsx)(s,{name:"guid"}),", or ",(0,l.jsx)(s,{name:"nil"})," if it doesn't exist."]}),"\n",(0,l.jsx)(n.h4,{id:"example-4",children:"Example"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-lua",children:"local object = Scene:get_object_by_guid(20);\n"})}),"\n",(0,l.jsx)(n.hr,{}),"\n",(0,l.jsx)(n.h3,{id:"sceneget_all_objects",children:"Scene:get_all_objects()"}),"\n",(0,l.jsxs)(n.p,{children:["Returns a ",(0,l.jsx)(s,{name:"table"})," which is a list of ",(0,l.jsx)(s,{name:"object"}),"s."]}),"\n",(0,l.jsx)(n.h4,{id:"example-5",children:"Example"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-lua",children:"local objects = Scene:get_all_objects();\n\n-- Destroy all objects in scene\nfor i=1,#objects do\n objs[i]:destroy();\nend;\n"})}),"\n",(0,l.jsx)(n.hr,{}),"\n",(0,l.jsx)(n.h3,{id:"sceneget_gravity",children:"Scene:get_gravity()"}),"\n",(0,l.jsxs)(n.p,{children:["Returns a ",(0,l.jsx)(s,{name:"vec2"})," of the scene's gravity."]}),"\n",(0,l.jsx)(n.h4,{id:"example-6",children:"Example"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-lua",children:"local gravity = Scene:get_gravity();\n\nprint(tostring(gravity));\n"})}),"\n",(0,l.jsx)(n.hr,{}),"\n",(0,l.jsx)(n.h3,{id:"sceneset_gravity",children:"Scene:set_gravity(...)"}),"\n",(0,l.jsxs)(n.p,{children:["Sets the scene's gravity to a ",(0,l.jsx)(s,{name:"vec2"}),". Returns nothing."]}),"\n",(0,l.jsx)(n.h4,{id:"example-7",children:"Example"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-lua",children:"Scene:set_gravity(vec2(0, -15));\n"})}),"\n",(0,l.jsx)(n.hr,{}),"\n",(0,l.jsx)(n.h3,{id:"sceneoverlap_circle",children:"Scene:overlap_circle(...)"}),"\n",(0,l.jsxs)(n.p,{children:["Returns a ",(0,l.jsx)(s,{name:"table"})," which is a list of ",(0,l.jsx)(s,{name:"object"}),"s that overlap with a circle. Does not actually create any circle shape."]}),"\n",(0,l.jsx)(n.h4,{id:"example-8",children:"Example"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-lua",children:'local objects_in_circle = Scene:overlap_circle({\n position = vec2(0, 0),\n radius = 10,\n});\n\n-- Print the GUIDs\nfor i=1,#objects do\n print("Object of GUID " .. tostring(objs[i].guid) .. " was in circle");\nend;\n'})}),"\n",(0,l.jsx)(n.h4,{id:"table-fields-4",children:"Table Fields"}),"\n",(0,l.jsxs)(n.table,{children:[(0,l.jsx)(n.thead,{children:(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.th,{children:"Table Field"}),(0,l.jsx)(n.th,{children:"Description"}),(0,l.jsx)(n.th,{children:"Note"})]})}),(0,l.jsxs)(n.tbody,{children:[(0,l.jsxs)(n.tr,{children:[(0,l.jsxs)(n.td,{children:[(0,l.jsx)(n.code,{children:"position"})," ",(0,l.jsx)(s,{name:"vec2"})]}),(0,l.jsx)(n.td,{children:"Center of the circle"}),(0,l.jsx)(n.td,{})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsxs)(n.td,{children:[(0,l.jsx)(n.code,{children:"radius"})," ",(0,l.jsx)(s,{name:"number"})]}),(0,l.jsx)(n.td,{children:"Radius of the circle"}),(0,l.jsx)(n.td,{})]})]})]}),"\n",(0,l.jsx)(n.hr,{}),"\n",(0,l.jsx)(n.h3,{id:"sceneexplode",children:"Scene:explode(...)"}),"\n",(0,l.jsx)(n.p,{children:"Applies an impulse in the scene at a given point to all objects in its radius."}),"\n",(0,l.jsx)(n.admonition,{type:"note",children:(0,l.jsx)(n.p,{children:"The explosion impulse does not depend on distance, all objects in the radius will get the same impulse."})}),"\n",(0,l.jsx)(n.h4,{id:"example-9",children:"Example"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-lua",children:"Scene:explode({\n position = vec2(0, 0),\n radius = 10,\n impulse = 10.\n});\n"})}),"\n",(0,l.jsx)(n.h4,{id:"table-fields-5",children:"Table Fields"}),"\n",(0,l.jsxs)(n.table,{children:[(0,l.jsx)(n.thead,{children:(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.th,{children:"Table Field"}),(0,l.jsx)(n.th,{children:"Description"}),(0,l.jsx)(n.th,{children:"Note"})]})}),(0,l.jsxs)(n.tbody,{children:[(0,l.jsxs)(n.tr,{children:[(0,l.jsxs)(n.td,{children:[(0,l.jsx)(n.code,{children:"position"})," ",(0,l.jsx)(s,{name:"vec2"})]}),(0,l.jsx)(n.td,{children:"Center of the explosion"}),(0,l.jsx)(n.td,{})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsxs)(n.td,{children:[(0,l.jsx)(n.code,{children:"radius"})," ",(0,l.jsx)(s,{name:"number"})]}),(0,l.jsx)(n.td,{children:"Radius of the explosion"}),(0,l.jsx)(n.td,{})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsxs)(n.td,{children:[(0,l.jsx)(n.code,{children:"impulse"})," ",(0,l.jsx)(s,{name:"number"})]}),(0,l.jsx)(n.td,{children:"Impulse of the explosion"}),(0,l.jsx)(n.td,{})]})]})]})]})}function h(e={}){const{wrapper:n}={...(0,d.R)(),...e.components};return n?(0,l.jsx)(n,{...e,children:(0,l.jsx)(a,{...e})}):a(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>c,x:()=>t});var l=s(6540);const d={},i=l.createContext(d);function c(e){const n=l.useContext(i);return l.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function t(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(d):e.components||d:c(e.components),l.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/70f34273.8dbbe154.js b/assets/js/70f34273.8dbbe154.js deleted file mode 100644 index 4b06408..0000000 --- a/assets/js/70f34273.8dbbe154.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunksimulo_docs=self.webpackChunksimulo_docs||[]).push([[111],{3601:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>r,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>t,toc:()=>a});var d=s(4848),l=s(8453);const i={sidebar_position:2},c="Scene",t={id:"api/scene/scene",title:"Scene",description:"The Scene global provides fields and functions relating to the Simulo scene.",source:"@site/docs/api/scene/scene.md",sourceDirName:"api/scene",slug:"/api/scene/",permalink:"/api/scene/",draft:!1,unlisted:!1,tags:[],version:"current",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"apiSidebar",previous:{title:"API Docs Introduction",permalink:"/api/intro"},next:{title:"Vec2",permalink:"/api/vec2"}},r={},a=[{value:"Fields",id:"fields",level:2},{value:"Functions",id:"functions",level:2},{value:"Scene:add_box(...)",id:"sceneadd_box",level:3},{value:"Example",id:"example",level:4},{value:"Table Fields",id:"table-fields",level:4},{value:"Scene:add_circle(...)",id:"sceneadd_circle",level:3},{value:"Example",id:"example-1",level:4},{value:"Table Fields",id:"table-fields-1",level:4},{value:"Scene:add_component(...)",id:"sceneadd_component",level:3},{value:"Example",id:"example-2",level:4},{value:"Table Fields",id:"table-fields-2",level:4},{value:"Scene:add_simulon(...)",id:"sceneadd_simulon",level:3},{value:"Example",id:"example-3",level:4},{value:"Table Fields",id:"table-fields-3",level:4},{value:"Scene:get_object_by_guid(...)",id:"sceneget_object_by_guid",level:3},{value:"Example",id:"example-4",level:4},{value:"Scene:get_all_objects()",id:"sceneget_all_objects",level:3},{value:"Example",id:"example-5",level:4},{value:"Scene:get_gravity()",id:"sceneget_gravity",level:3},{value:"Example",id:"example-6",level:4},{value:"Scene:set_gravity(...)",id:"sceneset_gravity",level:3},{value:"Example",id:"example-7",level:4},{value:"Scene:overlap_circle(...)",id:"sceneoverlap_circle",level:3},{value:"Example",id:"example-8",level:4},{value:"Table Fields",id:"table-fields-4",level:4},{value:"Scene:explode(...)",id:"sceneexplode",level:3},{value:"Example",id:"example-9",level:4},{value:"Table Fields",id:"table-fields-5",level:4}];function o(e){const n={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",h3:"h3",h4:"h4",hr:"hr",p:"p",pre:"pre",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,l.R)(),...e.components},{Type:s}=n;return s||function(e,n){throw new Error("Expected "+(n?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}("Type",!0),(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(n.h1,{id:"scene",children:"Scene"}),"\n",(0,d.jsxs)(n.p,{children:["The ",(0,d.jsx)(n.code,{children:"Scene"})," global provides fields and functions relating to the Simulo scene."]}),"\n",(0,d.jsx)(n.h2,{id:"fields",children:"Fields"}),"\n",(0,d.jsxs)(n.table,{children:[(0,d.jsx)(n.thead,{children:(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.th,{children:"Field"}),(0,d.jsx)(n.th,{children:"Description"}),(0,d.jsx)(n.th,{children:"Note"}),(0,d.jsx)(n.th,{children:"Default"}),(0,d.jsx)(n.th,{children:"Type"})]})}),(0,d.jsxs)(n.tbody,{children:[(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:"Scene.title"})}),(0,d.jsx)(n.td,{children:"The name of the scene"}),(0,d.jsx)(n.td,{}),(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:'"Untitled Scene"'})}),(0,d.jsx)(n.td,{children:(0,d.jsx)(s,{name:"string"})})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:"Scene.background_color"})}),(0,d.jsx)(n.td,{children:"The color shown behind the scene"}),(0,d.jsx)(n.td,{}),(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:"0x34213d"})}),(0,d.jsx)(n.td,{children:(0,d.jsx)(s,{name:"number"})})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:"Scene.runtime_version"})}),(0,d.jsx)(n.td,{children:"The version of the Simulo Runtime"}),(0,d.jsx)(n.td,{children:"Read-only"}),(0,d.jsx)(n.td,{}),(0,d.jsx)(n.td,{children:(0,d.jsx)(s,{name:"string"})})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:"Scene.box2d_version"})}),(0,d.jsx)(n.td,{children:"The version of Box2D used in the Simulo runtime"}),(0,d.jsx)(n.td,{children:"Read-only"}),(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:"3.0.0"})}),(0,d.jsx)(n.td,{children:(0,d.jsx)(s,{name:"string"})})]})]})]}),"\n",(0,d.jsx)(n.h2,{id:"functions",children:"Functions"}),"\n",(0,d.jsx)(n.admonition,{type:"note",children:(0,d.jsxs)(n.p,{children:["Make sure to use ",(0,d.jsx)(n.code,{children:"Scene:function()"})," and not ",(0,d.jsx)(n.code,{children:"Scene.function()"}),", or you'll get an error"]})}),"\n",(0,d.jsx)(n.hr,{}),"\n",(0,d.jsx)(n.h3,{id:"sceneadd_box",children:"Scene:add_box(...)"}),"\n",(0,d.jsxs)(n.p,{children:["Adds a new box to the scene. Takes a table as parameter, returns a ",(0,d.jsx)(s,{name:"object"}),"."]}),"\n",(0,d.jsx)(n.h4,{id:"example",children:"Example"}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-lua",children:"Scene:add_box({\n position = vec2(0, 0),\n size = vec2(1, 1),\n color = 0xe5d3b9,\n is_static = false,\n});\n"})}),"\n",(0,d.jsx)(n.h4,{id:"table-fields",children:"Table Fields"}),"\n",(0,d.jsxs)(n.table,{children:[(0,d.jsx)(n.thead,{children:(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.th,{children:"Table Field"}),(0,d.jsx)(n.th,{children:"Description"}),(0,d.jsx)(n.th,{children:"Note"})]})}),(0,d.jsxs)(n.tbody,{children:[(0,d.jsxs)(n.tr,{children:[(0,d.jsxs)(n.td,{children:[(0,d.jsx)(n.code,{children:"position"})," ",(0,d.jsx)(s,{name:"vec2"})]}),(0,d.jsx)(n.td,{children:"Where to spawn the box"}),(0,d.jsx)(n.td,{})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsxs)(n.td,{children:[(0,d.jsx)(n.code,{children:"size"})," ",(0,d.jsx)(s,{name:"vec2"})]}),(0,d.jsx)(n.td,{children:"Size of the box in meters"}),(0,d.jsx)(n.td,{})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsxs)(n.td,{children:[(0,d.jsx)(n.code,{children:"color"})," ",(0,d.jsx)(s,{name:"number"})]}),(0,d.jsxs)(n.td,{children:["Color of the box, like ",(0,d.jsx)(n.code,{children:"0xe5d3b9"})]}),(0,d.jsx)(n.td,{})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsxs)(n.td,{children:[(0,d.jsx)(n.code,{children:"is_static"})," ",(0,d.jsx)(s,{name:"boolean"})]}),(0,d.jsx)(n.td,{children:'Should the box be "glued to the background"?'}),(0,d.jsx)(n.td,{})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsxs)(n.td,{children:[(0,d.jsx)(n.code,{children:"name"})," ",(0,d.jsx)(s,{name:"string"})]}),(0,d.jsxs)(n.td,{children:["What should the name of the box be? Defaults to ",(0,d.jsx)(n.code,{children:'"Box"'})]}),(0,d.jsx)(n.td,{children:"Optional"})]})]})]}),"\n",(0,d.jsx)(n.hr,{}),"\n",(0,d.jsx)(n.h3,{id:"sceneadd_circle",children:"Scene:add_circle(...)"}),"\n",(0,d.jsxs)(n.p,{children:["Adds a new circle to the scene. Takes a table as parameter, returns a ",(0,d.jsx)(s,{name:"object"}),"."]}),"\n",(0,d.jsx)(n.h4,{id:"example-1",children:"Example"}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-lua",children:"Scene:add_circle({\n position = vec2(0, 0),\n radius = 1,\n color = 0xe5d3b9,\n is_static = false,\n});\n"})}),"\n",(0,d.jsx)(n.h4,{id:"table-fields-1",children:"Table Fields"}),"\n",(0,d.jsxs)(n.table,{children:[(0,d.jsx)(n.thead,{children:(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.th,{children:"Table Field"}),(0,d.jsx)(n.th,{children:"Description"}),(0,d.jsx)(n.th,{children:"Note"})]})}),(0,d.jsxs)(n.tbody,{children:[(0,d.jsxs)(n.tr,{children:[(0,d.jsxs)(n.td,{children:[(0,d.jsx)(n.code,{children:"position"})," ",(0,d.jsx)(s,{name:"vec2"})]}),(0,d.jsx)(n.td,{children:"Where to spawn the circle"}),(0,d.jsx)(n.td,{})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsxs)(n.td,{children:[(0,d.jsx)(n.code,{children:"radius"})," ",(0,d.jsx)(s,{name:"number"})]}),(0,d.jsx)(n.td,{children:"Radius of the circle in meters"}),(0,d.jsx)(n.td,{})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsxs)(n.td,{children:[(0,d.jsx)(n.code,{children:"color"})," ",(0,d.jsx)(s,{name:"number"})]}),(0,d.jsxs)(n.td,{children:["Color of the circle, like ",(0,d.jsx)(n.code,{children:"0xe5d3b9"})]}),(0,d.jsx)(n.td,{})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsxs)(n.td,{children:[(0,d.jsx)(n.code,{children:"is_static"})," ",(0,d.jsx)(s,{name:"boolean"})]}),(0,d.jsx)(n.td,{children:'Should the circle be "glued to the background"?'}),(0,d.jsx)(n.td,{})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsxs)(n.td,{children:[(0,d.jsx)(n.code,{children:"name"})," ",(0,d.jsx)(s,{name:"string"})]}),(0,d.jsxs)(n.td,{children:["What should the name of the circle be? Defaults to ",(0,d.jsx)(n.code,{children:'"Circle"'})]}),(0,d.jsx)(n.td,{children:"Optional"})]})]})]}),"\n",(0,d.jsx)(n.hr,{}),"\n",(0,d.jsx)(n.h3,{id:"sceneadd_component",children:"Scene:add_component(...)"}),"\n",(0,d.jsxs)(n.p,{children:["Adds a new component to the scene. Takes a table as parameter, returns a ",(0,d.jsx)(s,{name:"hash"}),"."]}),"\n",(0,d.jsxs)(n.p,{children:["For a detailed explanation, check out the ",(0,d.jsx)(n.a,{href:"/api/components/",children:"Components section of the API Docs"}),"."]}),"\n",(0,d.jsx)(n.h4,{id:"example-2",children:"Example"}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-lua",children:'Scene:add_component({\n name = "My Component",\n version = "0.1.0",\n id = "@john_doe/test/my_component",\n\n -- Lua/Luau code\n code = [[\n function on_start()\n print("Hello, worlds!");\n end;\n ]],\n});\n'})}),"\n",(0,d.jsx)(n.h4,{id:"table-fields-2",children:"Table Fields"}),"\n",(0,d.jsxs)(n.table,{children:[(0,d.jsx)(n.thead,{children:(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.th,{children:"Table Field"}),(0,d.jsx)(n.th,{children:"Description"}),(0,d.jsx)(n.th,{children:"Note"})]})}),(0,d.jsxs)(n.tbody,{children:[(0,d.jsxs)(n.tr,{children:[(0,d.jsxs)(n.td,{children:[(0,d.jsx)(n.code,{children:"name"})," ",(0,d.jsx)(s,{name:"string"})]}),(0,d.jsx)(n.td,{children:"Where to spawn the circle"}),(0,d.jsx)(n.td,{})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsxs)(n.td,{children:[(0,d.jsx)(n.code,{children:"version"})," ",(0,d.jsx)(s,{name:"string"})]}),(0,d.jsxs)(n.td,{children:["Component metadata version, defaults to ",(0,d.jsx)(n.code,{children:'"0.1.0"'})]}),(0,d.jsx)(n.td,{children:"Optional"})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsxs)(n.td,{children:[(0,d.jsx)(n.code,{children:"id"})," ",(0,d.jsx)(s,{name:"string"})]}),(0,d.jsxs)(n.td,{children:["Unique ID for your component, should be something like ",(0,d.jsx)(n.code,{children:'"@yourname/projectname/componentname"'})]}),(0,d.jsx)(n.td,{})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsxs)(n.td,{children:[(0,d.jsx)(n.code,{children:"code"})," ",(0,d.jsx)(s,{name:"string"})]}),(0,d.jsx)(n.td,{children:"Luau script for the component"}),(0,d.jsx)(n.td,{})]})]})]}),"\n",(0,d.jsx)(n.hr,{}),"\n",(0,d.jsx)(n.h3,{id:"sceneadd_simulon",children:"Scene:add_simulon(...)"}),"\n",(0,d.jsx)(n.p,{children:"Adds a simulon to the scene, Simulo's mascot. Returns nothing."}),"\n",(0,d.jsx)(n.p,{children:"This function may be removed by public release, where users will instead be able to spawn simulons just like any other saved object."}),"\n",(0,d.jsx)(n.h4,{id:"example-3",children:"Example"}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-lua",children:"Scene:add_simulon({\n position = vec2(0, 0),\n density = 1,\n color = 0xff0000,\n});\n"})}),"\n",(0,d.jsx)(n.h4,{id:"table-fields-3",children:"Table Fields"}),"\n",(0,d.jsxs)(n.table,{children:[(0,d.jsx)(n.thead,{children:(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.th,{children:"Table Field"}),(0,d.jsx)(n.th,{children:"Description"}),(0,d.jsx)(n.th,{children:"Note"})]})}),(0,d.jsxs)(n.tbody,{children:[(0,d.jsxs)(n.tr,{children:[(0,d.jsxs)(n.td,{children:[(0,d.jsx)(n.code,{children:"position"})," ",(0,d.jsx)(s,{name:"vec2"})]}),(0,d.jsx)(n.td,{children:"Where to spawn the simulon"}),(0,d.jsx)(n.td,{})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsxs)(n.td,{children:[(0,d.jsx)(n.code,{children:"density"})," ",(0,d.jsx)(s,{name:"number"})]}),(0,d.jsx)(n.td,{children:"Density for the simulon"}),(0,d.jsx)(n.td,{})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsxs)(n.td,{children:[(0,d.jsx)(n.code,{children:"color"})," ",(0,d.jsx)(s,{name:"number"})]}),(0,d.jsxs)(n.td,{children:["Simulon color, defaults to ",(0,d.jsx)(n.code,{children:"0xa9bc67"})]}),(0,d.jsx)(n.td,{children:"Optional"})]})]})]}),"\n",(0,d.jsx)(n.hr,{}),"\n",(0,d.jsx)(n.h3,{id:"sceneget_object_by_guid",children:"Scene:get_object_by_guid(...)"}),"\n",(0,d.jsxs)(n.p,{children:["Returns the ",(0,d.jsx)(s,{name:"object"})," of the given ",(0,d.jsx)(s,{name:"guid"}),", or ",(0,d.jsx)(s,{name:"nil"})," if it doesn't exist."]}),"\n",(0,d.jsx)(n.h4,{id:"example-4",children:"Example"}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-lua",children:"local object = Scene:get_object_by_guid(20);\n"})}),"\n",(0,d.jsx)(n.hr,{}),"\n",(0,d.jsx)(n.h3,{id:"sceneget_all_objects",children:"Scene:get_all_objects()"}),"\n",(0,d.jsxs)(n.p,{children:["Returns a ",(0,d.jsx)(s,{name:"table"})," which is a list of ",(0,d.jsx)(s,{name:"object"}),"s."]}),"\n",(0,d.jsx)(n.h4,{id:"example-5",children:"Example"}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-lua",children:"local objects = Scene:get_all_objects();\n\n-- Destroy all objects in scene\nfor i=1,#objects do\n objs[i]:destroy();\nend;\n"})}),"\n",(0,d.jsx)(n.hr,{}),"\n",(0,d.jsx)(n.h3,{id:"sceneget_gravity",children:"Scene:get_gravity()"}),"\n",(0,d.jsxs)(n.p,{children:["Returns a ",(0,d.jsx)(s,{name:"vec2"})," of the scene's gravity."]}),"\n",(0,d.jsx)(n.h4,{id:"example-6",children:"Example"}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-lua",children:"local gravity = Scene:get_gravity();\n\nprint(tostring(gravity));\n"})}),"\n",(0,d.jsx)(n.hr,{}),"\n",(0,d.jsx)(n.h3,{id:"sceneset_gravity",children:"Scene:set_gravity(...)"}),"\n",(0,d.jsxs)(n.p,{children:["Sets the scene's gravity to a ",(0,d.jsx)(s,{name:"vec2"}),". Returns nothing."]}),"\n",(0,d.jsx)(n.h4,{id:"example-7",children:"Example"}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-lua",children:"Scene:set_gravity(vec2(0, -15));\n"})}),"\n",(0,d.jsx)(n.hr,{}),"\n",(0,d.jsx)(n.h3,{id:"sceneoverlap_circle",children:"Scene:overlap_circle(...)"}),"\n",(0,d.jsxs)(n.p,{children:["Returns a ",(0,d.jsx)(s,{name:"table"})," which is a list of ",(0,d.jsx)(s,{name:"object"}),"s that overlap with a circle. Does not actually create any circle shape."]}),"\n",(0,d.jsx)(n.h4,{id:"example-8",children:"Example"}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-lua",children:'local objects_in_circle = Scene:overlap_circle({\n position = vec2(0, 0),\n radius = 10,\n});\n\n-- Print the GUIDs\nfor i=1,#objects do\n print("Object of GUID " .. tostring(objs[i].guid) .. " was in circle");\nend;\n'})}),"\n",(0,d.jsx)(n.h4,{id:"table-fields-4",children:"Table Fields"}),"\n",(0,d.jsxs)(n.table,{children:[(0,d.jsx)(n.thead,{children:(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.th,{children:"Table Field"}),(0,d.jsx)(n.th,{children:"Description"}),(0,d.jsx)(n.th,{children:"Note"})]})}),(0,d.jsxs)(n.tbody,{children:[(0,d.jsxs)(n.tr,{children:[(0,d.jsxs)(n.td,{children:[(0,d.jsx)(n.code,{children:"position"})," ",(0,d.jsx)(s,{name:"vec2"})]}),(0,d.jsx)(n.td,{children:"Center of the circle"}),(0,d.jsx)(n.td,{})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsxs)(n.td,{children:[(0,d.jsx)(n.code,{children:"radius"})," ",(0,d.jsx)(s,{name:"number"})]}),(0,d.jsx)(n.td,{children:"Radius of the circle"}),(0,d.jsx)(n.td,{})]})]})]}),"\n",(0,d.jsx)(n.hr,{}),"\n",(0,d.jsx)(n.h3,{id:"sceneexplode",children:"Scene:explode(...)"}),"\n",(0,d.jsx)(n.p,{children:"Applies an impulse in the scene at a given point to all objects in its radius."}),"\n",(0,d.jsx)(n.admonition,{type:"note",children:(0,d.jsx)(n.p,{children:"The explosion impulse does not depend on distance, all objects in the radius will get the same impulse."})}),"\n",(0,d.jsx)(n.h4,{id:"example-9",children:"Example"}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-lua",children:"Scene:explode({\n position = vec2(0, 0),\n radius = 10,\n impulse = 10.\n});\n"})}),"\n",(0,d.jsx)(n.h4,{id:"table-fields-5",children:"Table Fields"}),"\n",(0,d.jsxs)(n.table,{children:[(0,d.jsx)(n.thead,{children:(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.th,{children:"Table Field"}),(0,d.jsx)(n.th,{children:"Description"}),(0,d.jsx)(n.th,{children:"Note"})]})}),(0,d.jsxs)(n.tbody,{children:[(0,d.jsxs)(n.tr,{children:[(0,d.jsxs)(n.td,{children:[(0,d.jsx)(n.code,{children:"position"})," ",(0,d.jsx)(s,{name:"vec2"})]}),(0,d.jsx)(n.td,{children:"Center of the explosion"}),(0,d.jsx)(n.td,{})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsxs)(n.td,{children:[(0,d.jsx)(n.code,{children:"radius"})," ",(0,d.jsx)(s,{name:"number"})]}),(0,d.jsx)(n.td,{children:"Radius of the explosion"}),(0,d.jsx)(n.td,{})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsxs)(n.td,{children:[(0,d.jsx)(n.code,{children:"impulse"})," ",(0,d.jsx)(s,{name:"number"})]}),(0,d.jsx)(n.td,{children:"Impulse of the explosion"}),(0,d.jsx)(n.td,{})]})]})]})]})}function h(e={}){const{wrapper:n}={...(0,l.R)(),...e.components};return n?(0,d.jsx)(n,{...e,children:(0,d.jsx)(o,{...e})}):o(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>c,x:()=>t});var d=s(6540);const l={},i=d.createContext(l);function c(e){const n=d.useContext(i);return d.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function t(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(l):e.components||l:c(e.components),d.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/d4f3c2d4.96e47e9f.js b/assets/js/d4f3c2d4.96e47e9f.js new file mode 100644 index 0000000..4fd700b --- /dev/null +++ b/assets/js/d4f3c2d4.96e47e9f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunksimulo_docs=self.webpackChunksimulo_docs||[]).push([[317],{9927:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>p,contentTitle:()=>r,default:()=>m,frontMatter:()=>i,metadata:()=>c,toc:()=>a});var n=s(4848),o=s(8453);const i={sidebar_position:1,title:"Samples",description:"Various samples of scripts with the Simulo Scripting API"},r="Samples",c={id:"samples/intro",title:"Samples",description:"Various samples of scripts with the Simulo Scripting API",source:"@site/docs/samples/intro.md",sourceDirName:"samples",slug:"/samples/intro",permalink:"/samples/intro",draft:!1,unlisted:!1,tags:[],version:"current",sidebarPosition:1,frontMatter:{sidebar_position:1,title:"Samples",description:"Various samples of scripts with the Simulo Scripting API"},sidebar:"samplesSidebar",next:{title:"Components",permalink:"/category/components"}},p={},a=[];function l(e){const t={h1:"h1",p:"p",...(0,o.R)(),...e.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(t.h1,{id:"samples",children:"Samples"}),"\n",(0,n.jsx)(t.p,{children:"Welcome to the Simulo samples, here we have some examples of Script Box scripts and Component scripts, etc."})]})}function m(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(l,{...e})}):l(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>r,x:()=>c});var n=s(6540);const o={},i=n.createContext(o);function r(e){const t=n.useContext(i);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:r(e.components),n.createElement(i.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/d4f3c2d4.a5995dc8.js b/assets/js/d4f3c2d4.a5995dc8.js deleted file mode 100644 index 66e8969..0000000 --- a/assets/js/d4f3c2d4.a5995dc8.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunksimulo_docs=self.webpackChunksimulo_docs||[]).push([[317],{9927:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>i,default:()=>l,frontMatter:()=>r,metadata:()=>c,toc:()=>p});var n=s(4848),o=s(8453);const r={sidebar_position:1},i="Samples",c={id:"samples/intro",title:"Samples",description:"Welcome to the Simulo samples, here we have some examples of Script Box scripts and Component scripts, etc.",source:"@site/docs/samples/intro.md",sourceDirName:"samples",slug:"/samples/intro",permalink:"/samples/intro",draft:!1,unlisted:!1,tags:[],version:"current",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"samplesSidebar",next:{title:"Components",permalink:"/category/components"}},a={},p=[];function m(e){const t={h1:"h1",p:"p",...(0,o.R)(),...e.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(t.h1,{id:"samples",children:"Samples"}),"\n",(0,n.jsx)(t.p,{children:"Welcome to the Simulo samples, here we have some examples of Script Box scripts and Component scripts, etc."})]})}function l(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(m,{...e})}):m(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>c});var n=s(6540);const o={},r=n.createContext(o);function i(e){const t=n.useContext(r);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),n.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/d70d3333.4b047533.js b/assets/js/d70d3333.4b047533.js deleted file mode 100644 index 127d7c4..0000000 --- a/assets/js/d70d3333.4b047533.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunksimulo_docs=self.webpackChunksimulo_docs||[]).push([[524],{1876:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>o,contentTitle:()=>r,default:()=>x,frontMatter:()=>i,metadata:()=>d,toc:()=>l});var s=t(4848),c=t(8453);const i={sidebar_position:4},r="Vec2",d={id:"api/vec2",title:"Vec2",description:"is Simulo's built-in type for 2D vectors.",source:"@site/docs/api/vec2.mdx",sourceDirName:"api",slug:"/api/vec2",permalink:"/api/vec2",draft:!1,unlisted:!1,tags:[],version:"current",sidebarPosition:4,frontMatter:{sidebar_position:4},sidebar:"apiSidebar",previous:{title:"Scene",permalink:"/api/scene/"},next:{title:"Components",permalink:"/api/components/"}},o={},l=[{value:"Constructor",id:"constructor",level:2},{value:"Fields",id:"fields",level:2},{value:"Arithmetic",id:"arithmetic",level:2},{value:"Functions",id:"functions",level:2}];function h(e){const n={admonition:"admonition",code:"code",h1:"h1",h2:"h2",p:"p",pre:"pre",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,c.R)(),...e.components},{Type:t}=n;return t||function(e,n){throw new Error("Expected "+(n?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}("Type",!0),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h1,{id:"vec2",children:"Vec2"}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(t,{name:"vec2"})," is Simulo's built-in type for 2D vectors."]}),"\n",(0,s.jsx)(n.h2,{id:"constructor",children:"Constructor"}),"\n",(0,s.jsxs)(n.p,{children:["To create a ",(0,s.jsx)(t,{name:"vec2"}),", use the global ",(0,s.jsx)(n.code,{children:"vec2(x, y)"})," function:"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-lua",children:"local vec = vec2(5, 5);\n"})}),"\n",(0,s.jsx)(n.h2,{id:"fields",children:"Fields"}),"\n",(0,s.jsxs)(n.table,{children:[(0,s.jsx)(n.thead,{children:(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.th,{children:"Field"}),(0,s.jsx)(n.th,{children:"Description"}),(0,s.jsx)(n.th,{children:"Type"})]})}),(0,s.jsxs)(n.tbody,{children:[(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"x"})}),(0,s.jsxs)(n.td,{children:["The ",(0,s.jsx)(n.code,{children:"x"})," component of the ",(0,s.jsx)(t,{name:"vec2"})]}),(0,s.jsx)(n.td,{children:(0,s.jsx)(t,{name:"number"})})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"y"})}),(0,s.jsxs)(n.td,{children:["The ",(0,s.jsx)(n.code,{children:"y"})," component of the ",(0,s.jsx)(t,{name:"vec2"})]}),(0,s.jsx)(n.td,{children:(0,s.jsx)(t,{name:"number"})})]})]})]}),"\n",(0,s.jsx)(n.h2,{id:"arithmetic",children:"Arithmetic"}),"\n",(0,s.jsxs)(n.table,{children:[(0,s.jsx)(n.thead,{children:(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.th,{children:"Operator"}),(0,s.jsx)(n.th,{children:"Description"}),(0,s.jsx)(n.th,{children:"Return"})]})}),(0,s.jsxs)(n.tbody,{children:[(0,s.jsxs)(n.tr,{children:[(0,s.jsxs)(n.td,{children:[(0,s.jsx)(t,{name:"vec2"})," + ",(0,s.jsx)(t,{name:"vec2"})]}),(0,s.jsxs)(n.td,{children:["Returns a new ",(0,s.jsx)(t,{name:"vec2"})," that is the sum of both"]}),(0,s.jsx)(n.td,{children:(0,s.jsx)(t,{name:"vec2"})})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsxs)(n.td,{children:[(0,s.jsx)(t,{name:"vec2"})," \u2212 ",(0,s.jsx)(t,{name:"vec2"})]}),(0,s.jsx)(n.td,{children:"Returns the difference between both"}),(0,s.jsx)(n.td,{children:(0,s.jsx)(t,{name:"vec2"})})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsxs)(n.td,{children:[(0,s.jsx)(t,{name:"vec2"})," * ",(0,s.jsx)(t,{name:"number"})]}),(0,s.jsxs)(n.td,{children:["Returns the ",(0,s.jsx)(t,{name:"vec2"})," with each component multiplied by the ",(0,s.jsx)(t,{name:"number"})]}),(0,s.jsx)(n.td,{children:(0,s.jsx)(t,{name:"vec2"})})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsxs)(n.td,{children:[(0,s.jsx)(t,{name:"vec2"})," / ",(0,s.jsx)(t,{name:"number"})]}),(0,s.jsxs)(n.td,{children:["Returns the ",(0,s.jsx)(t,{name:"vec2"})," with each component divided by the ",(0,s.jsx)(t,{name:"number"})]}),(0,s.jsx)(n.td,{children:(0,s.jsx)(t,{name:"vec2"})})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsxs)(n.td,{children:["\u2212",(0,s.jsx)(t,{name:"vec2"})]}),(0,s.jsxs)(n.td,{children:["Returns the negation of the ",(0,s.jsx)(t,{name:"vec2"})]}),(0,s.jsx)(n.td,{children:(0,s.jsx)(t,{name:"vec2"})})]})]})]}),"\n",(0,s.jsx)(n.h2,{id:"functions",children:"Functions"}),"\n",(0,s.jsx)(n.admonition,{type:"note",children:(0,s.jsxs)(n.p,{children:["Make sure to use ",(0,s.jsx)(n.code,{children:"vec:function()"})," and not ",(0,s.jsx)(n.code,{children:"vec.function()"}),", or you'll get an error"]})}),"\n",(0,s.jsxs)(n.table,{children:[(0,s.jsx)(n.thead,{children:(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.th,{children:"Function"}),(0,s.jsx)(n.th,{children:"Description"}),(0,s.jsx)(n.th,{children:"Return"})]})}),(0,s.jsx)(n.tbody,{children:(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:":magnitude()"})}),(0,s.jsxs)(n.td,{children:["Returns the length of the ",(0,s.jsx)(t,{name:"vec2"})]}),(0,s.jsx)(n.td,{children:(0,s.jsx)(t,{name:"number"})})]})})]})]})}function x(e={}){const{wrapper:n}={...(0,c.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(h,{...e})}):h(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>r,x:()=>d});var s=t(6540);const c={},i=s.createContext(c);function r(e){const n=s.useContext(i);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function d(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(c):e.components||c:r(e.components),s.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/d70d3333.c91612dc.js b/assets/js/d70d3333.c91612dc.js new file mode 100644 index 0000000..d7e8082 --- /dev/null +++ b/assets/js/d70d3333.c91612dc.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunksimulo_docs=self.webpackChunksimulo_docs||[]).push([[524],{1876:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>o,contentTitle:()=>r,default:()=>x,frontMatter:()=>i,metadata:()=>d,toc:()=>l});var s=t(4848),c=t(8453);const i={sidebar_position:4,title:"Vec2",description:"Vec2 is Simulo's built-in type for 2D vectors."},r="Vec2",d={id:"api/vec2",title:"Vec2",description:"Vec2 is Simulo's built-in type for 2D vectors.",source:"@site/docs/api/vec2.mdx",sourceDirName:"api",slug:"/api/vec2",permalink:"/api/vec2",draft:!1,unlisted:!1,tags:[],version:"current",sidebarPosition:4,frontMatter:{sidebar_position:4,title:"Vec2",description:"Vec2 is Simulo's built-in type for 2D vectors."},sidebar:"apiSidebar",previous:{title:"Scene",permalink:"/api/scene/"},next:{title:"Components",permalink:"/api/components/"}},o={},l=[{value:"Constructor",id:"constructor",level:2},{value:"Fields",id:"fields",level:2},{value:"Arithmetic",id:"arithmetic",level:2},{value:"Functions",id:"functions",level:2}];function h(e){const n={admonition:"admonition",code:"code",h1:"h1",h2:"h2",p:"p",pre:"pre",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,c.R)(),...e.components},{Type:t}=n;return t||function(e,n){throw new Error("Expected "+(n?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}("Type",!0),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h1,{id:"vec2",children:"Vec2"}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(t,{name:"vec2"})," is Simulo's built-in type for 2D vectors."]}),"\n",(0,s.jsx)(n.h2,{id:"constructor",children:"Constructor"}),"\n",(0,s.jsxs)(n.p,{children:["To create a ",(0,s.jsx)(t,{name:"vec2"}),", use the global ",(0,s.jsx)(n.code,{children:"vec2(x, y)"})," function:"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-lua",children:"local vec = vec2(5, 5);\n"})}),"\n",(0,s.jsx)(n.h2,{id:"fields",children:"Fields"}),"\n",(0,s.jsxs)(n.table,{children:[(0,s.jsx)(n.thead,{children:(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.th,{children:"Field"}),(0,s.jsx)(n.th,{children:"Description"}),(0,s.jsx)(n.th,{children:"Type"})]})}),(0,s.jsxs)(n.tbody,{children:[(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"x"})}),(0,s.jsxs)(n.td,{children:["The ",(0,s.jsx)(n.code,{children:"x"})," component of the ",(0,s.jsx)(t,{name:"vec2"})]}),(0,s.jsx)(n.td,{children:(0,s.jsx)(t,{name:"number"})})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"y"})}),(0,s.jsxs)(n.td,{children:["The ",(0,s.jsx)(n.code,{children:"y"})," component of the ",(0,s.jsx)(t,{name:"vec2"})]}),(0,s.jsx)(n.td,{children:(0,s.jsx)(t,{name:"number"})})]})]})]}),"\n",(0,s.jsx)(n.h2,{id:"arithmetic",children:"Arithmetic"}),"\n",(0,s.jsxs)(n.table,{children:[(0,s.jsx)(n.thead,{children:(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.th,{children:"Operator"}),(0,s.jsx)(n.th,{children:"Description"}),(0,s.jsx)(n.th,{children:"Return"})]})}),(0,s.jsxs)(n.tbody,{children:[(0,s.jsxs)(n.tr,{children:[(0,s.jsxs)(n.td,{children:[(0,s.jsx)(t,{name:"vec2"})," + ",(0,s.jsx)(t,{name:"vec2"})]}),(0,s.jsxs)(n.td,{children:["Returns a new ",(0,s.jsx)(t,{name:"vec2"})," that is the sum of both"]}),(0,s.jsx)(n.td,{children:(0,s.jsx)(t,{name:"vec2"})})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsxs)(n.td,{children:[(0,s.jsx)(t,{name:"vec2"})," \u2212 ",(0,s.jsx)(t,{name:"vec2"})]}),(0,s.jsx)(n.td,{children:"Returns the difference between both"}),(0,s.jsx)(n.td,{children:(0,s.jsx)(t,{name:"vec2"})})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsxs)(n.td,{children:[(0,s.jsx)(t,{name:"vec2"})," * ",(0,s.jsx)(t,{name:"number"})]}),(0,s.jsxs)(n.td,{children:["Returns the ",(0,s.jsx)(t,{name:"vec2"})," with each component multiplied by the ",(0,s.jsx)(t,{name:"number"})]}),(0,s.jsx)(n.td,{children:(0,s.jsx)(t,{name:"vec2"})})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsxs)(n.td,{children:[(0,s.jsx)(t,{name:"vec2"})," / ",(0,s.jsx)(t,{name:"number"})]}),(0,s.jsxs)(n.td,{children:["Returns the ",(0,s.jsx)(t,{name:"vec2"})," with each component divided by the ",(0,s.jsx)(t,{name:"number"})]}),(0,s.jsx)(n.td,{children:(0,s.jsx)(t,{name:"vec2"})})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsxs)(n.td,{children:["\u2212",(0,s.jsx)(t,{name:"vec2"})]}),(0,s.jsxs)(n.td,{children:["Returns the negation of the ",(0,s.jsx)(t,{name:"vec2"})]}),(0,s.jsx)(n.td,{children:(0,s.jsx)(t,{name:"vec2"})})]})]})]}),"\n",(0,s.jsx)(n.h2,{id:"functions",children:"Functions"}),"\n",(0,s.jsx)(n.admonition,{type:"note",children:(0,s.jsxs)(n.p,{children:["Make sure to use ",(0,s.jsx)(n.code,{children:"vec:function()"})," and not ",(0,s.jsx)(n.code,{children:"vec.function()"}),", or you'll get an error"]})}),"\n",(0,s.jsxs)(n.table,{children:[(0,s.jsx)(n.thead,{children:(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.th,{children:"Function"}),(0,s.jsx)(n.th,{children:"Description"}),(0,s.jsx)(n.th,{children:"Return"})]})}),(0,s.jsx)(n.tbody,{children:(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:":magnitude()"})}),(0,s.jsxs)(n.td,{children:["Returns the length of the ",(0,s.jsx)(t,{name:"vec2"})]}),(0,s.jsx)(n.td,{children:(0,s.jsx)(t,{name:"number"})})]})})]})]})}function x(e={}){const{wrapper:n}={...(0,c.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(h,{...e})}):h(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>r,x:()=>d});var s=t(6540);const c={},i=s.createContext(c);function r(e){const n=s.useContext(i);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function d(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(c):e.components||c:r(e.components),s.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/de828477.0759da02.js b/assets/js/de828477.0759da02.js deleted file mode 100644 index 8ba22e4..0000000 --- a/assets/js/de828477.0759da02.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunksimulo_docs=self.webpackChunksimulo_docs||[]).push([[386],{4275:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>l,default:()=>p,frontMatter:()=>i,metadata:()=>r,toc:()=>a});var o=t(4848),s=t(8453);const i={},l="Multi-File",r={id:"samples/components/multifile",title:"Multi-File",description:"Instead of writing the component code inline in our Script Box script, we can use the temploadstring global:",source:"@site/docs/samples/components/multifile.mdx",sourceDirName:"samples/components",slug:"/samples/components/multifile",permalink:"/samples/components/multifile",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{},sidebar:"samplesSidebar",previous:{title:"Components",permalink:"/category/components"},next:{title:"Platformer",permalink:"/samples/components/platformer"}},c={},a=[];function m(e){const n={code:"code",h1:"h1",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.h1,{id:"multi-file",children:"Multi-File"}),"\n",(0,o.jsxs)(n.p,{children:["Instead of writing the component code inline in our Script Box script, we can use the ",(0,o.jsx)(n.code,{children:"temp_load_string"})," global:"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-lua",metastring:'title="Script Box script"',children:'reset(); -- Add `reset` function from the samples so this works\n\nlocal box = Scene:add_box({\n position = vec2(2, -19.5),\n size = vec2(0.5, 0.5),\n is_static = false,\n color = 0xa0a0ff,\n});\n\nprint(box.guid);\n\nlocal hash = Scene:add_component({\n name = "Multi-File Example",\n id = "@amytimed/test/multifile_example",\n version = "0.2.0",\n code = temp_load_string(\'/some/path/to/component.lua\')\n});\n\nbox:add_component(hash);\n'})}),"\n",(0,o.jsxs)(n.p,{children:["And then, in ",(0,o.jsx)(n.code,{children:"component.lua"})," (which we defined a path to earlier):"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-lua",metastring:'title="component.lua"',children:"function on_start()\n -- random rgb color\n local r = math.random(0x40, 0xff);\n local g = math.random(0x40, 0xff);\n local b = math.random(0x40, 0xff);\n\n -- put it together to form single color value, like 0xRRGGBB\n self.color = r * 0x10000 + g * 0x100 + b;\nend;\n"})}),"\n",(0,o.jsx)(n.p,{children:"Now, if we paste the first script into the Script Box and run it, it'll load the script defined in component.lua. Each time we press run, it'll reset the scene and create a box which sets its color to a random one."})]})}function p(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(m,{...e})}):m(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>l,x:()=>r});var o=t(6540);const s={},i=o.createContext(s);function l(e){const n=o.useContext(i);return o.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function r(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:l(e.components),o.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/de828477.96011759.js b/assets/js/de828477.96011759.js new file mode 100644 index 0000000..1fb184a --- /dev/null +++ b/assets/js/de828477.96011759.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunksimulo_docs=self.webpackChunksimulo_docs||[]).push([[386],{4275:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>s,default:()=>p,frontMatter:()=>l,metadata:()=>r,toc:()=>a});var o=t(4848),i=t(8453);const l={title:"Multi-File",description:"Sample of how to work with Simulo Components in multiple files"},s="Multi-File",r={id:"samples/components/multifile",title:"Multi-File",description:"Sample of how to work with Simulo Components in multiple files",source:"@site/docs/samples/components/multifile.mdx",sourceDirName:"samples/components",slug:"/samples/components/multifile",permalink:"/samples/components/multifile",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{title:"Multi-File",description:"Sample of how to work with Simulo Components in multiple files"},sidebar:"samplesSidebar",previous:{title:"Components",permalink:"/category/components"},next:{title:"Platformer",permalink:"/samples/components/platformer"}},c={},a=[];function m(e){const n={code:"code",h1:"h1",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.h1,{id:"multi-file",children:"Multi-File"}),"\n",(0,o.jsxs)(n.p,{children:["Instead of writing the component code inline in our Script Box script, we can use the ",(0,o.jsx)(n.code,{children:"temp_load_string"})," global:"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-lua",metastring:'title="Script Box script"',children:'reset(); -- Add `reset` function from the samples so this works\n\nlocal box = Scene:add_box({\n position = vec2(2, -19.5),\n size = vec2(0.5, 0.5),\n is_static = false,\n color = 0xa0a0ff,\n});\n\nprint(box.guid);\n\nlocal hash = Scene:add_component({\n name = "Multi-File Example",\n id = "@amytimed/test/multifile_example",\n version = "0.2.0",\n code = temp_load_string(\'/some/path/to/component.lua\')\n});\n\nbox:add_component(hash);\n'})}),"\n",(0,o.jsxs)(n.p,{children:["And then, in ",(0,o.jsx)(n.code,{children:"component.lua"})," (which we defined a path to earlier):"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-lua",metastring:'title="component.lua"',children:"function on_start()\n -- random rgb color\n local r = math.random(0x40, 0xff);\n local g = math.random(0x40, 0xff);\n local b = math.random(0x40, 0xff);\n\n -- put it together to form single color value, like 0xRRGGBB\n self.color = r * 0x10000 + g * 0x100 + b;\nend;\n"})}),"\n",(0,o.jsx)(n.p,{children:"Now, if we paste the first script into the Script Box and run it, it'll load the script defined in component.lua. Each time we press run, it'll reset the scene and create a box which sets its color to a random one."})]})}function p(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(m,{...e})}):m(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>r});var o=t(6540);const i={},l=o.createContext(i);function s(e){const n=o.useContext(l);return o.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function r(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:s(e.components),o.createElement(l.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/f959785f.14a880bb.js b/assets/js/f959785f.14a880bb.js deleted file mode 100644 index f9e66e0..0000000 --- a/assets/js/f959785f.14a880bb.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunksimulo_docs=self.webpackChunksimulo_docs||[]).push([[382],{6199:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>a,toc:()=>r});var o=t(4848),s=t(8453);const i={},c="Components",a={id:"api/components/components",title:"Components",description:"Components are scripts you place on objects in Simulo. They're very powerful and allow doing almost anything with scripting, even creating a platformer game in Simulo.",source:"@site/docs/api/components/components.md",sourceDirName:"api/components",slug:"/api/components/",permalink:"/api/components/",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{},sidebar:"apiSidebar",previous:{title:"Vec2",permalink:"/api/vec2"},next:{title:"Input",permalink:"/api/input/"}},l={},r=[{value:"Events",id:"events",level:2},{value:"on_start",id:"on_start",level:3},{value:"on_update",id:"on_update",level:3},{value:"on_event",id:"on_event",level:3},{value:"on_destroy",id:"on_destroy",level:3},{value:"Examples",id:"examples",level:2}];function d(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",p:"p",pre:"pre",strong:"strong",...(0,s.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.h1,{id:"components",children:"Components"}),"\n",(0,o.jsx)(n.p,{children:"Components are scripts you place on objects in Simulo. They're very powerful and allow doing almost anything with scripting, even creating a platformer game in Simulo."}),"\n",(0,o.jsx)(n.p,{children:"At the moment, no UI exists for creating components (though this will be changed before public release), but we can still create them using scripting."}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-lua",children:'local box = Scene:add_box({\n position = vec2(0, 0),\n size = vec2(0.5, 0.5),\n color = 0xe5d3b9,\n is_static = false,\n});\n\nlocal hash = Scene:add_component({\n name = "Player Component",\n id = "@amytimed/test/player_component",\n version = "0.2.0",\n\n -- Lua/Luau code to make box "jump" when we press W key\n code = [[\n function on_update()\n if Input:key_just_pressed("W") then\n self:apply_force_to_center(vec2(0, 500));\n end;\n end;\n ]],\n});\n\nbox:add_component(hash); -- We can reuse the hash on other objects\n'})}),"\n",(0,o.jsxs)(n.p,{children:["You simply add a new component to the scene with ",(0,o.jsx)(n.code,{children:"Scene:add_component"}),", which returns a hash. You can then use ",(0,o.jsx)(n.code,{children:":add_component(hash)"})," on objects to apply the script on them."]}),"\n",(0,o.jsx)(n.h2,{id:"events",children:"Events"}),"\n",(0,o.jsxs)(n.p,{children:["Components have ",(0,o.jsx)(n.strong,{children:"event handler"})," functions which are called at certain times, such as ",(0,o.jsx)(n.code,{children:"on_update"}),", which is called each time the physics is updated."]}),"\n",(0,o.jsx)(n.h3,{id:"on_start",children:"on_start"}),"\n",(0,o.jsx)(n.p,{children:"This is called immediately when the component is added on an object."}),"\n",(0,o.jsxs)(n.p,{children:["At the moment, it is thus not particularly useful, since code ran outside of ",(0,o.jsx)(n.code,{children:"on_start"})," will run at the same time, but by the full release of Simulo, this function will get a table parameter called ",(0,o.jsx)(n.code,{children:"data"}),". An additional event named ",(0,o.jsx)(n.code,{children:"on_save"})," will be available, where the object can return a table to be passed to its ",(0,o.jsx)(n.code,{children:"on_start"})," when it is loaded."]}),"\n",(0,o.jsx)(n.h3,{id:"on_update",children:"on_update"}),"\n",(0,o.jsxs)(n.p,{children:["This is called each time the physics is updated. At the moment, that means ",(0,o.jsx)(n.code,{children:"64"})," times per second, though this will be changed to ",(0,o.jsx)(n.code,{children:"60"})," soon."]}),"\n",(0,o.jsx)(n.h3,{id:"on_event",children:"on_event"}),"\n",(0,o.jsx)(n.p,{children:"This function is not currently ever called, but it is coming in The Future"}),"\n",(0,o.jsx)(n.h3,{id:"on_destroy",children:"on_destroy"}),"\n",(0,o.jsx)(n.p,{children:"This function is called when the object is about to be destroyed. When it is called, the object is still completely intact."}),"\n",(0,o.jsx)(n.h2,{id:"examples",children:"Examples"}),"\n",(0,o.jsxs)(n.p,{children:["For some examples, check out the ",(0,o.jsx)(n.a,{href:"/category/components",children:"Components section of the Samples"}),"."]})]})}function h(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>c,x:()=>a});var o=t(6540);const s={},i=o.createContext(s);function c(e){const n=o.useContext(i);return o.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:c(e.components),o.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/f959785f.9441d3ba.js b/assets/js/f959785f.9441d3ba.js new file mode 100644 index 0000000..d255df7 --- /dev/null +++ b/assets/js/f959785f.9441d3ba.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunksimulo_docs=self.webpackChunksimulo_docs||[]).push([[382],{6199:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>i,metadata:()=>c,toc:()=>r});var o=t(4848),s=t(8453);const i={title:"Components",description:"Components are scripts you place on objects in Simulo. They're very powerful and allow doing almost anything with scripting, even creating a platformer game in Simulo."},a="Components",c={id:"api/components/components",title:"Components",description:"Components are scripts you place on objects in Simulo. They're very powerful and allow doing almost anything with scripting, even creating a platformer game in Simulo.",source:"@site/docs/api/components/components.md",sourceDirName:"api/components",slug:"/api/components/",permalink:"/api/components/",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{title:"Components",description:"Components are scripts you place on objects in Simulo. They're very powerful and allow doing almost anything with scripting, even creating a platformer game in Simulo."},sidebar:"apiSidebar",previous:{title:"Vec2",permalink:"/api/vec2"},next:{title:"Input",permalink:"/api/input/"}},l={},r=[{value:"Events",id:"events",level:2},{value:"on_start",id:"on_start",level:3},{value:"on_update",id:"on_update",level:3},{value:"on_event",id:"on_event",level:3},{value:"on_destroy",id:"on_destroy",level:3},{value:"Examples",id:"examples",level:2}];function d(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",p:"p",pre:"pre",strong:"strong",...(0,s.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.h1,{id:"components",children:"Components"}),"\n",(0,o.jsx)(n.p,{children:"Components are scripts you place on objects in Simulo. They're very powerful and allow doing almost anything with scripting, even creating a platformer game in Simulo."}),"\n",(0,o.jsx)(n.p,{children:"At the moment, no UI exists for creating components (though this will be changed before public release), but we can still create them using scripting."}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-lua",children:'local box = Scene:add_box({\n position = vec2(0, 0),\n size = vec2(0.5, 0.5),\n color = 0xe5d3b9,\n is_static = false,\n});\n\nlocal hash = Scene:add_component({\n name = "Player Component",\n id = "@amytimed/test/player_component",\n version = "0.2.0",\n\n -- Lua/Luau code to make box "jump" when we press W key\n code = [[\n function on_update()\n if Input:key_just_pressed("W") then\n self:apply_force_to_center(vec2(0, 500));\n end;\n end;\n ]],\n});\n\nbox:add_component(hash); -- We can reuse the hash on other objects\n'})}),"\n",(0,o.jsxs)(n.p,{children:["You simply add a new component to the scene with ",(0,o.jsx)(n.code,{children:"Scene:add_component"}),", which returns a hash. You can then use ",(0,o.jsx)(n.code,{children:":add_component(hash)"})," on objects to apply the script on them."]}),"\n",(0,o.jsx)(n.h2,{id:"events",children:"Events"}),"\n",(0,o.jsxs)(n.p,{children:["Components have ",(0,o.jsx)(n.strong,{children:"event handler"})," functions which are called at certain times, such as ",(0,o.jsx)(n.code,{children:"on_update"}),", which is called each time the physics is updated."]}),"\n",(0,o.jsx)(n.h3,{id:"on_start",children:"on_start"}),"\n",(0,o.jsx)(n.p,{children:"This is called immediately when the component is added on an object."}),"\n",(0,o.jsxs)(n.p,{children:["At the moment, it is thus not particularly useful, since code ran outside of ",(0,o.jsx)(n.code,{children:"on_start"})," will run at the same time, but by the full release of Simulo, this function will get a table parameter called ",(0,o.jsx)(n.code,{children:"data"}),". An additional event named ",(0,o.jsx)(n.code,{children:"on_save"})," will be available, where the object can return a table to be passed to its ",(0,o.jsx)(n.code,{children:"on_start"})," when it is loaded."]}),"\n",(0,o.jsx)(n.h3,{id:"on_update",children:"on_update"}),"\n",(0,o.jsxs)(n.p,{children:["This is called each time the physics is updated. At the moment, that means ",(0,o.jsx)(n.code,{children:"64"})," times per second, though this will be changed to ",(0,o.jsx)(n.code,{children:"60"})," soon."]}),"\n",(0,o.jsx)(n.h3,{id:"on_event",children:"on_event"}),"\n",(0,o.jsx)(n.p,{children:"This function is not currently ever called, but it is coming in The Future"}),"\n",(0,o.jsx)(n.h3,{id:"on_destroy",children:"on_destroy"}),"\n",(0,o.jsx)(n.p,{children:"This function is called when the object is about to be destroyed. When it is called, the object is still completely intact."}),"\n",(0,o.jsx)(n.h2,{id:"examples",children:"Examples"}),"\n",(0,o.jsxs)(n.p,{children:["For some examples, check out the ",(0,o.jsx)(n.a,{href:"/category/components",children:"Components section of the Samples"}),"."]})]})}function h(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>a,x:()=>c});var o=t(6540);const s={},i=o.createContext(s);function a(e){const n=o.useContext(i);return o.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),o.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/main.b997f003.js b/assets/js/main.670b4723.js similarity index 99% rename from assets/js/main.b997f003.js rename to assets/js/main.670b4723.js index c46928c..d608079 100644 --- a/assets/js/main.b997f003.js +++ b/assets/js/main.670b4723.js @@ -1,2 +1,2 @@ -/*! For license information please see main.b997f003.js.LICENSE.txt */ -(self.webpackChunksimulo_docs=self.webpackChunksimulo_docs||[]).push([[792],{1205:(e,t,n)=>{"use strict";n.d(t,{mg:()=>J,vd:()=>W});var r=n(6540),a=n(5556),o=n.n(a),i=n(115),l=n.n(i),s=n(311),u=n.n(s),c=n(2833),d=n.n(c);function f(){return f=Object.assign||function(e){for(var t=1;tYour Docusaurus site did not load properly.
\nA very common reason is a wrong site baseUrl configuration.
\nCurrent configured baseUrl = ${e} ${"/"===e?" (default value)":""}
\nWe suggest trying baseUrl =
\nYour Docusaurus site did not load properly.
\nA very common reason is a wrong site baseUrl configuration.
\nCurrent configured baseUrl = ${e} ${"/"===e?" (default value)":""}
\nWe suggest trying baseUrl =
\n