Skip to content

Commit 53724bb

Browse files
committed
makeLuaCamera
1 parent 6cd93d7 commit 53724bb

File tree

5 files changed

+51
-19
lines changed

5 files changed

+51
-19
lines changed

js/selector.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ function createSidebarContent(prefix) {
3030
'setTimeBarColors': 'playstate.html',
3131
'startDialogue': 'playstate.html',
3232
'startVideo': 'playstate.html',
33+
'setCameraScroll': 'playstate.html',
34+
'setCameraFollowPoint': 'playstate.html',
35+
'addCameraScroll': 'playstate.html',
36+
'addCameraFollowPoint': 'playstate.html',
37+
'getCameraScrollX': 'playstate.html',
38+
'getCameraScrollY': 'playstate.html',
39+
'getCameraFollowX': 'playstate.html',
40+
'getCameraFollowY': 'playstate.html',
41+
'cameraSetTarget': 'playstate.html',
42+
'cameraShake': 'playstate.html',
3343

3444
// Reflection
3545
'getProperty': 'reflection.html',
@@ -124,16 +134,7 @@ function createSidebarContent(prefix) {
124134
'luaSoundExists': 'sound.html',
125135

126136
// Camera
127-
'setCameraScroll': 'camera.html',
128-
'setCameraFollowPoint': 'camera.html',
129-
'addCameraScroll': 'camera.html',
130-
'addCameraFollowPoint': 'camera.html',
131-
'getCameraScrollX': 'camera.html',
132-
'getCameraScrollY': 'camera.html',
133-
'getCameraFollowX': 'camera.html',
134-
'getCameraFollowY': 'camera.html',
135-
'cameraSetTarget': 'camera.html',
136-
'cameraShake': 'camera.html',
137+
'makeLuaCamera': 'camera.html',
137138
'cameraFlash': 'camera.html',
138139
'cameraFade': 'camera.html',
139140

pages/camera.html

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,42 @@ <h1>Camera Functions</h1>
4141
<p><b>Functions to change camera points and apply effects.</b></p>
4242
<hr>
4343

44+
<h2 id="makeLuaCamera">makeLuaCamera</h2>
45+
<p class="methodbox">
46+
makeLuaCamera(<span class="variablemarkup">tag</span>:String, <span class="isoptional">?</span><span class="variablemarkup">defaultDrawTarget</span>:Bool = false):Void
47+
</p>
48+
<p>Creates a new Lua-accessible camera and registers it for later use.</p>
49+
<ul>
50+
<li>
51+
<b><span class="variablemarkup">tag</span></b> – Name used to reference the camera in other camera functions.
52+
</li>
53+
<li>
54+
<b><span class="variablemarkup">defaultDrawTarget</span> (Optional)</b>
55+
If true, game objects render to this camera by default.
56+
If false, only objects explicitly assigned to it will render.
57+
</li>
58+
</ul>
59+
<p>
60+
The camera is created with a fully transparent background and stored internally,
61+
allowing it to be referenced by name in functions such as
62+
<code>cameraShake</code>, <code>cameraFlash</code>, and <code>cameraFade</code>.
63+
</p>
64+
<h4>Examples:</h4>
65+
<ul class="methoddiv">
66+
<li class="exampleitem">
67+
<span class="methodexample">makeLuaCamera('cinematic')</span> – Creates a new transparent camera.
68+
</li>
69+
<li class="exampleitem">
70+
<span class="methodexample">makeLuaCamera('overlay', true)</span> – Creates a camera as a default draw target.
71+
</li>
72+
</ul>
73+
<hr>
74+
4475
<h2 id="cameraShake">cameraShake</h2>
4576
<p class="methodbox">cameraShake(<span class="variablemarkup">camera</span>:String, <span class="variablemarkup">intensity</span>:Float, <span class="variablemarkup">duration</span>:Float):Void</p>
4677
<p>Shakes an identified camera.</p>
4778
<ul>
48-
<li><b><span class="variablemarkup">camera</span></b> - Can be "game", "hud" or "other".</li>
79+
<li><b><span class="variablemarkup">camera</span></b> - Can be "game", "hud", "other" or your created camera.</li>
4980
<li><b><span class="variablemarkup">intensity</span></b> - Shake intensity.</li>
5081
<li><b><span class="variablemarkup">duration</span></b> - How much time the shake lasts for (in seconds).</li>
5182
</ul>
@@ -59,7 +90,7 @@ <h2 id="cameraFlash">cameraFlash</h2>
5990
<p class="methodbox">cameraFlash(<span class="variablemarkup">camera</span>:String, <span class="variablemarkup">color</span>:String, <span class="variablemarkup">duration</span>:Float, <span class="variablemarkup">forceReset</span>:Bool):Void</p>
6091
<p>Flashes an identified camera.</p>
6192
<ul>
62-
<li><b><span class="variablemarkup">camera</span></b> - Can be "game", "hud" or "other".</li>
93+
<li><b><span class="variablemarkup">camera</span></b> - Can be "game", "hud", "other" or your created camera.</li>
6394
<li><b><span class="variablemarkup">color</span></b> - Color hexadecimal string or <a href="https://api.haxeflixel.com/flixel/util/FlxColor.html">color name</a>.</li>
6495
<li><b><span class="variablemarkup">duration</span></b> - How much time the shake lasts for (in seconds).</li>
6596
<li><b><span class="variablemarkup">forceReset</span></b> - If false, won't flash if there's still a previous flash active.</li>
@@ -75,7 +106,7 @@ <h2 id="cameraFlash">cameraFade</h2>
75106
<p class="methodbox">cameraFade(<span class="variablemarkup">camera</span>:String, <span class="variablemarkup">color</span>:String, <span class="variablemarkup">duration</span>:Float, <span class="variablemarkup">forceReset</span>:Bool, <span class="isoptional">?</span><span class="variablemarkup">fadeOut</span>:Bool = false):Void</p>
76107
<p>Flashes an identified camera.</p>
77108
<ul>
78-
<li><b><span class="variablemarkup">camera</span></b> - Can be "game", "hud" or "other".</li>
109+
<li><b><span class="variablemarkup">camera</span></b> - Can be "game", "hud", "other" or your created camera.</li>
79110
<li><b><span class="variablemarkup">color</span></b> - Color hexadecimal string or <a href="https://api.haxeflixel.com/flixel/util/FlxColor.html">color name</a>.</li>
80111
<li><b><span class="variablemarkup">duration</span></b> - How much time the shake lasts for (in seconds).</li>
81112
<li><b><span class="variablemarkup">forceReset</span></b> - If false, won't flash if there's still a previous flash active.</li>

pages/input.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ <h2 id="getMouseX">getMouseX</h2>
7373
<p class="methodbox">getMouseX(<span class="isoptional"?></span><span class="variablemarkup">camera</span>:String = 'game'):Float</p>
7474
<p>Returns Mouse's Screen X from a Camera.</p>
7575
<ul>
76-
<li><b><span class="variablemarkup">camera</span></b> - Can be "game", "hud" or "other".</li>
76+
<li><b><span class="variablemarkup">camera</span></b> - Can be "game", "hud", "other" or your created camera.</li>
7777
</ul>
7878
<h4>Examples:</h4>
7979
<ul class="methoddiv">
@@ -86,7 +86,7 @@ <h2 id="getMouseY">getMouseY</h2>
8686
<p class="methodbox">getMouseY(<span class="isoptional"?></span><span class="variablemarkup">camera</span>:String = 'game'):Float</p>
8787
<p>Returns Mouse's Screen Y from a Camera.</p>
8888
<ul>
89-
<li><b><span class="variablemarkup">camera</span></b> - Can be "game", "hud" or "other".</li>
89+
<li><b><span class="variablemarkup">camera</span></b> - Can be "game", "hud", "other" or your created camera.</li>
9090
</ul>
9191
<hr>
9292

pages/reflection.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ <h2 id="setObjectCamera">setObjectCamera</h2>
297297
<br>Returns whether the operation was successful.<p>
298298
<ul>
299299
<li><b><span class="variablemarkup">tag</span></b> - Variable name of the instance or Lua Object nametag.</li>
300-
<li><b><span class="variablemarkup">camera</span> (Optional)</b> - Can be "game", "hud" or "other", defaults to "game".</li>
300+
<li><b><span class="variablemarkup">camera</span> (Optional)</b> - Can be "game", "hud", "other" or your created camera, defaults to "game".</li>
301301
</ul>
302302
<h4>Examples:</h4>
303303
<ul class="methoddiv">
@@ -435,7 +435,7 @@ <h2 id="getScreenPositionX">getScreenPositionX</h2>
435435
<p>Returns the Object's On-Camera X Position.<p>
436436
<ul>
437437
<li><b><span class="variablemarkup">tag</span></b> - Variable name of the instance or Lua Object nametag.</li>
438-
<li><b><span class="variablemarkup">camera</span> (Optional)</b> - Can be "game", "hud" or "other", defaults to "game".</li>
438+
<li><b><span class="variablemarkup">camera</span> (Optional)</b> - Can be "game", "hud", "other" or your created camera, defaults to "game".</li>
439439
</ul>
440440
<h4>Examples:</h4>
441441
<ul class="methoddiv">
@@ -449,7 +449,7 @@ <h2 id="getScreenPositionY">getScreenPositionY</h2>
449449
<p>Returns the Object's On-Camera Y Position.<p>
450450
<ul>
451451
<li><b><span class="variablemarkup">tag</span></b> - Variable name of the instance or Lua Object nametag.</li>
452-
<li><b><span class="variablemarkup">camera</span> (Optional)</b> - Can be "game", "hud" or "other", defaults to "game".</li>
452+
<li><b><span class="variablemarkup">camera</span> (Optional)</b> - Can be "game", "hud", "other" or your created camera, defaults to "game".</li>
453453
</ul>
454454
<h4>Examples:</h4>
455455
<ul class="methoddiv">

pages/tween.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ <h2 id="doTweenZoom">doTweenZoom</h2>
151151
<br>Returns the formatted Tween tag.</p>
152152
<ul>
153153
<li><b><span class="variablemarkup">twnTag</span></b> - Tween tag for the "onTweenCompleted" function, it should be unique or it will overwrite the previous one with the same name.</li>
154-
<li><b><span class="variablemarkup">camera</span></b> - Can be "game", "hud" or "other".</li>
154+
<li><b><span class="variablemarkup">camera</span></b> - Can be "game", "hud", "other" or your created camera.</li>
155155
<li><b><span class="variablemarkup">value</span></b> - Target value at the end of the tween.</li>
156156
<li><b><span class="variablemarkup">duration</span></b> - Tween duration.</li>
157157
<li><b><span class="variablemarkup">ease</span> (Optional)</b> - <a href="https://api.haxeflixel.com/flixel/tweens/FlxEase.html">Tween ease</a>, defaults to "linear".</li>

0 commit comments

Comments
 (0)