{"id":175,"date":"2023-02-23T14:36:31","date_gmt":"2023-02-23T06:36:31","guid":{"rendered":"https:\/\/www.tom4kg.life\/?p=175"},"modified":"2023-02-23T15:04:04","modified_gmt":"2023-02-23T07:04:04","slug":"luastg%e5%8f%82%e8%80%83%e6%89%8b%e5%86%8c%e5%85%a8-%e8%bd%ac","status":"publish","type":"post","link":"https:\/\/www.tom4kg.life\/?p=175","title":{"rendered":"LuaSTG\u53c2\u8003\u624b\u518c(\u5168)"},"content":{"rendered":"\n<p><strong>\u4e00\uff0e\u7efc\u8ff0<\/strong><\/p>\n\n\n\n<p>LuaSTG\u662f\u57fa\u4e8e<a href=\"http:\/\/hge.relishgames.com\/\">hge<\/a>\u4ee5<a href=\"http:\/\/www.lua.org\/\">Lua<\/a>\u4f5c\u4e3a\u6269\u5c55\u811a\u672c\u7684\u5f39\u5e55\u5c04\u51fb\u6e38\u620f\u5f15\u64ce\u3002<\/p>\n\n\n\n<p>\u65b0\u5efa\u5e76\u8fd0\u884c\u7b2c\u4e00\u4e2a\u5de5\u7a0b\u3002<\/p>\n\n\n\n<p>\u9996\u5148\u5728mod\u6587\u4ef6\u5939\u4e0b\u65b0\u5efa\u4e00\u4e2a\u6587\u4ef6\u5939\uff0c\u6587\u4ef6\u5939\u540d\u5373\u4e3a\u5de5\u7a0b\u540d\u3002\u6bd4\u5982\u5728\u8fd9\u91cc\u6211\u4eec\u65b0\u5efa\u4e00\u4e2a\u53eb\u505ahello\u7684\u6587\u4ef6\u5939\u3002\u4e4b\u540e\u5728hello\u6587\u4ef6\u5939\u4e0b\u65b0\u5efa\u4e00\u4e2aroot.lua\u6587\u4ef6\uff0c\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">hello_stage=stage.New('hello',true)<br>function hello_stage:init()<br>    Print('Hello, LuaSTG.')<br>end<\/pre>\n\n\n\n<p>\u4e4b\u540e\u6253\u5f00\u6839\u76ee\u5f55\u4e0b\u7684setting.lua\uff0c\u5c06mod\u8bbe\u7f6e\u4e3a\u5de5\u7a0b\u540d\u2019hello\u2019\uff0c\u5e76\u4e14\u5c06debug\u8bbe\u7f6e\u4e3atrue\u3002\u6b64\u65f6\u8fd0\u884clstg.exe\uff0c\u5c06\u4f1a\u51fa\u73b0\u4e00\u4e2a\u9ed1\u7a97\u53e3\uff0c\u540c\u65f6\u547d\u4ee4\u884c\u91cc\u5c06\u4f1a\u51fa\u73b0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n\n\n\n<p>zip warning: ..\/hello.zip not found or empty<\/p>\n\n\n\n<p>adding: root.lua (104 bytes security) (deflated 16%)<\/p>\n\n\n\n<p>Hello, LuaSTG.<\/p>\n\n\n\n<p>\u8fd9\u6837\u6211\u4eec\u5c31\u65b0\u5efa\u5e76\u8fd0\u884c\u4e86\u4e00\u4e2a\u6700\u7b80\u5355\u7684LuaSTG\u5de5\u7a0b\u3002<\/p>\n\n\n\n<p><strong>\u4e8c\uff0e\u5173\u5361\u3001\u7c7b\u548c\u5355\u4f4d<\/strong><\/p>\n\n\n\n<p><strong>1.\u5173\u5361<\/strong><\/p>\n\n\n\n<p><strong>stage.New(stage_name,as_entrance,is_menu)<\/strong><\/p>\n\n\n\n<p>\u58f0\u660e\u5e76\u8fd4\u56de\u4e00\u4e2a\u5173\u5361\u3002stage_name\u662f\u5173\u5361\u7684\u540d\u79f0\uff0c\u4e3a\u5b57\u7b26\u4e32\u7c7b\u578b\uff0c\u4e0d\u80fd\u91cd\u590d\u3002as_entrance\u53c2\u6570\u8868\u793a\u662f\u5426\u5c06\u8be5\u5173\u5361\u4f5c\u4e3a\u6574\u4e2a\u5de5\u7a0b\u7684\u5165\u53e3\u5173\u5361\uff0c\u9ed8\u8ba4\u4e3afalse\u3002is_menu\u53c2\u6570\u8868\u793a\u8be5\u5173\u5361\u662f\u5426\u4e3a\u4e00\u4e2a\u83dc\u5355\u5173\u5361\uff0c\u9ed8\u8ba4\u4e3afalse\u3002\uff08\u83dc\u5355\u5173\u5361\u548c\u6e38\u620f\u5173\u5361\u7684\u552f\u4e00\u533a\u522b\u5728\u4e8e\u6309\u4e0bESC\u952e\u65f6\u662f\u5426\u5f39\u51fa\u6682\u505c\u83dc\u5355\u3002\uff09\u51fd\u6570\u5c06\u8fd4\u56de\u8fd9\u4e2a\u5173\u5361\u3002\u58f0\u660e\u5173\u5361\u4e4b\u540e\uff0c\u8fd8\u9700\u8981\u4e3a\u5176\u5b9a\u4e49\u56de\u8c03\u51fd\u6570\uff0c\u5426\u5219\u4ed6\u5c06\u4ec0\u4e48\u90fd\u4e0d\u4f1a\u505a\uff0c\u8fd9\u4e9b\u56de\u8c03\u51fd\u6570\u5728\u5404\u81ea\u7279\u5b9a\u7684\u65f6\u673a\u4f1a\u88ab\u7cfb\u7edf\u8c03\u7528\u3002\u5b9a\u4e49\u7684\u683c\u5f0f\u662f\uff1afunction&nbsp;your_stage:function_name()<br>&nbsp; &nbsp; &#8212;&nbsp;do something<br>end<\/p>\n\n\n\n<p>your_stage\u662f\u7531stage.New\u51fd\u6570\u8fd4\u56de\u7684\u5173\u5361\uff0cfunction_name\u4e3ainit\u3001del\u3001frame\u3001render\u4e4b\u4e00\uff0c\u4ed6\u4eec\u90fd\u6709\u5404\u81ea\u7684\u4f5c\u7528\u3002init\u548cdel\u51fd\u6570\u5206\u522b\u5728\u8fdb\u5165\u548c\u79bb\u5f00\u8fd9\u4e2a\u5173\u5361\u65f6\u88ab\u8c03\u7528\uff0c\u5f53\u8fd9\u4e2a\u5173\u5361\u4e3a\u5f53\u524d\u5173\u5361\u65f6\uff0c\u4ed6\u7684frame\u548crender\u51fd\u6570\u5206\u522b\u5728\u6bcf\u5e27\u8fdb\u884c\u5e27\u903b\u8f91\u8fd0\u7b97\u548c\u5e27\u6e32\u67d3\u7684\u65f6\u5019\u88ab\u8c03\u7528\u3002\u6240\u6709\u8fd9\u4e9b\u51fd\u6570\u90fd\u628a\u5173\u5361\u672c\u8eab\u4f5c\u4e3a\u7b2c\u4e00\u4e2a\u53c2\u6570self\u9690\u5f0f\u4f20\u5165\uff0c\u6b64\u5916\u4e0d\u518d\u63a5\u53d7\u4efb\u4f55\u53c2\u6570\u3002<\/p>\n\n\n\n<p><strong>stage.Set(stage_name)<\/strong><\/p>\n\n\n\n<p>\u79bb\u5f00\u5f53\u524d\u5173\u5361\u5e76\u8fdb\u5165\u65b0\u7684\u5173\u5361\u3002<\/p>\n\n\n\n<p><strong>stage.SetTimer(timer)<\/strong><\/p>\n\n\n\n<p>\u5173\u5361\u7684\u8ba1\u6570\u5668\u4e3a\u5176timer\u57df\uff08\u5373your_stage.timer\uff09\uff0c\u8fd9\u4e2a\u8ba1\u6570\u5668\u5728\u6bcf\u6b21\u8fdb\u5165\u6216\u8005\u91cd\u65b0\u8fdb\u5165\u5173\u5361\u65f6\u88ab\u8bbe\u7f6e\u4e3a0\u96f6\uff0c\u4e4b\u540e\u6bcf\u5e27\u81ea\u52a8+1\u3002\u8be5\u51fd\u6570\u53ef\u4ee5\u5f3a\u5236\u8bbe\u7f6e\u5f53\u524d\u5173\u5361\u7684\u8ba1\u6570\u5668\u3002<\/p>\n\n\n\n<p><strong>stage.QuitGame()<\/strong><\/p>\n\n\n\n<p>\u9000\u51fa\u7a0b\u5e8f\u3002<\/p>\n\n\n\n<p><strong>\u53c2\u8003\uff1atut01<\/strong><\/p>\n\n\n\n<p>2.<strong>\u7c7b\u548c\u5355\u4f4d<\/strong><\/p>\n\n\n\n<p>LuaSTG\u7684\u7c7b\u548c\u5355\u4f4d\u7c7b\u4f3c\u9762\u5411\u5bf9\u8c61\u4e2d\u7c7b\u548c\u5bf9\u8c61\u7684\u6982\u5ff5\u3002LuaSTG\u5b9e\u73b0\u7684\u662f\u4e00\u79cd\u8f83\u4e3a\u7b80\u6613\u7684\u9762\u5411\u5bf9\u8c61\u7f16\u7a0b\u3002<\/p>\n\n\n\n<p><strong>Class(base)<\/strong><\/p>\n\n\n\n<p>\u58f0\u660e\u4e00\u4e2a\u7c7b\uff0cbase\u4e3a\u65b0\u58f0\u660e\u7c7b\u7684\u57fa\u7c7b\u3002\u548c\u5173\u5361\u7c7b\u4f3c\uff0c\u7c7b\u4e5f\u9700\u8981\u5b9a\u4e49\u4e00\u7cfb\u5217\u56de\u8c03\u51fd\u6570\uff0c\u4ed6\u4eec\u662finit\u3001del\u3001kill\u3001frame\u3001render\u3001colli\u3002\u65b0\u5b9a\u4e49\u7684\u7c7b\u4f1a\u7ee7\u627f\u57fa\u7c7b\u6240\u6709\u7684\u56de\u8c03\u51fd\u6570\uff0c\u5e76\u4e14\u53ef\u4ee5\u5bf9\u5176\u8fdb\u884c\u8986\u76d6\u5f0f\u7684\u91cd\u5b9a\u4e49\uff0c\u9664\u6b64\u4e4b\u5916\u4e0d\u7ee7\u627f\u57fa\u7c7b\u7684\u4efb\u4f55\u5176\u4ed6\u5185\u5bb9\u3002\u6240\u6709\u56de\u8c03\u51fd\u6570\u90fd\u628a\u5355\u4f4d\u4f5c\u4e3a\u7b2c\u4e00\u4e2a\u53c2\u6570self\u9690\u5f0f\u4f20\u5165\uff0c\u6b64\u5916\u8fd8\u53ef\u80fd\u4f1a\u6709\u989d\u5916\u7684\u53c2\u6570\u3002<\/p>\n\n\n\n<p>\u56de\u8c03\u51fd\u6570\uff1a<\/p>\n\n\n\n<p><strong>init<\/strong><\/p>\n\n\n\n<p>\u5728\u5355\u4f4d\u88ab\u521b\u5efa\u65f6\u88ab\u8c03\u7528\uff0c\u521b\u5efa\u65f6\u7684\u521d\u59cb\u5316\u53c2\u6570\u5217\u8868\u5c06\u4f1a\u88ab\u4f5c\u4e3a\u989d\u5916\u7684\u53c2\u6570\u4f20\u5165\u3002<\/p>\n\n\n\n<p><strong>del<\/strong><\/p>\n\n\n\n<p>\u5728\u5355\u4f4d\u88ab\u6e05\u9664\u65f6\u88ab\u8c03\u7528\u3002<\/p>\n\n\n\n<p><strong>kill<\/strong><\/p>\n\n\n\n<p>\u5728\u5355\u4f4d\u88ab\u51fb\u6740\u65f6\u88ab\u8c03\u7528\u3002<\/p>\n\n\n\n<p><strong>frame<\/strong><\/p>\n\n\n\n<p>\u5728\u8fdb\u884c\u5e27\u903b\u8f91\u8fd0\u7b97\u7684\u65f6\u5019\u88ab\u8c03\u7528\u3002<\/p>\n\n\n\n<p><strong>render<\/strong><\/p>\n\n\n\n<p>\u5728\u8fdb\u884c\u5e27\u6e32\u67d3\u7684\u65f6\u5019\u88ab\u8c03\u7528\u3002<\/p>\n\n\n\n<p><strong>colli<\/strong><\/p>\n\n\n\n<p>\u5728\u5355\u4f4d\u88ab\u5176\u4ed6\u5355\u4f4d\u78b0\u649e\u7684\u65f6\u5019\u88ab\u8c03\u7528\u3002\u5c06\u78b0\u649e\u4ed6\u7684\u5355\u4f4d\u4f5c\u4e3a\u7b2c\u4e8c\u4e2a\u53c2\u6570\u4f20\u5165\u3002<\/p>\n\n\n\n<p><strong>New(class,\u2026)<\/strong><\/p>\n\n\n\n<p>\u521b\u5efa\u5e76\u8fd4\u56de\u4e00\u4e2a\u7c7b\u4e3aclass\u7684\u5355\u4f4d\uff0c\u2026\u662f\u521d\u59cb\u5316\u53c2\u6570\u5217\u8868\uff0c\u6570\u91cf\u53ef\u4ee5\u662f\u4efb\u610f\u4e2a\uff0c\u4f1a\u88ab\u4f5c\u4e3a\u53c2\u6570\u4f20\u8fdbclass\u7684init\u51fd\u6570\u3002<\/p>\n\n\n\n<p><strong>Del(unit)<\/strong><\/p>\n\n\n\n<p>\u6e05\u9664\u4e00\u4e2a\u5355\u4f4d\u3002\u8be5\u5355\u4f4d\u7684\u7c7b\u7684del\u51fd\u6570\u4f1a\u88ab\u89e6\u53d1\u3002<\/p>\n\n\n\n<p><strong>RawDel(unit)<\/strong><\/p>\n\n\n\n<p>\u6e05\u9664\u4e00\u4e2a\u5355\u4f4d\u3002\u8be5\u5355\u4f4d\u7684\u7c7b\u7684del\u51fd\u6570\u4e0d\u4f1a\u88ab\u89e6\u53d1\u3002<\/p>\n\n\n\n<p><strong>Kill(unit)<\/strong><\/p>\n\n\n\n<p>\u51fb\u6740\u4e00\u4e2a\u5355\u4f4d\u3002\u8be5\u5355\u4f4d\u7684\u7c7b\u7684kill\u51fd\u6570\u4f1a\u88ab\u89e6\u53d1\u3002<\/p>\n\n\n\n<p><strong>RawKill(unit)<\/strong><\/p>\n\n\n\n<p>\u51fb\u6740\u4e00\u4e2a\u5355\u4f4d\u3002\u8be5\u5355\u4f4d\u7684\u7c7b\u7684kill\u51fd\u6570\u4e0d\u4f1a\u88ab\u89e6\u53d1\u3002<\/p>\n\n\n\n<p><strong>PreserveUnit(unit)<\/strong><\/p>\n\n\n\n<p>\u4fdd\u5b58\u4e00\u4e2a\u5355\u4f4d\uff0c\u5373\u53d6\u6d88\u5f53\u524d\u5e27\u91cc\u4e4b\u524d\u5bf9\u5176\u8fdb\u884c\u7684Del\u3001RawDel\u3001Kill\u3001RawKill\u64cd\u4f5c\u3002<\/p>\n\n\n\n<p><strong>IsValid(unit)<\/strong><\/p>\n\n\n\n<p>\u5224\u65ad\u8be5\u5355\u4f4d\u662f\u5426\u4e3a\u4e00\u4e2a\u6709\u6548\u7684\u800c\u4e14\u5b58\u6d3b\u7684\u5355\u4f4d\u3002\u4e00\u4e2a\u5355\u4f4d\u5728\u5176\u88ab\u6e05\u9664\u6216\u8005\u51fb\u6740\u4e4b\u540e\u7684\u4e00\u5e27\u5f00\u59cb\uff0c\u5c06\u4f1a\u53d8\u6210\u65e0\u6548\u7684\u3002<\/p>\n\n\n\n<p><strong>UnitList(group)<\/strong><\/p>\n\n\n\n<p>\u8fd4\u56de\u4e00\u4e2a\u8fed\u4ee3\u5668\uff0c\u80fd\u591f\u904d\u5386\u78b0\u649e\u7ec4\u4e3agroup\u7684\u6240\u6709\u5355\u4f4d\uff0c\u5982\u679cgroup\u4e3aGROUP_ALL=16\uff0c\u5219\u904d\u5386\u6240\u6709\u5355\u4f4d\u3002\u7528\u6cd5\u662f\uff1afor&nbsp;i,unit&nbsp;in&nbsp;UnitList(group)&nbsp;do<br>&nbsp; &nbsp; &#8211;do something<br>end<\/p>\n\n\n\n<p><strong>GetnUnit()<\/strong><\/p>\n\n\n\n<p>\u8fd4\u56de\u5355\u4f4d\u7684\u603b\u6570\u3002<\/p>\n\n\n\n<p><strong>SetV(unit,v,angle,set_rot)<\/strong><\/p>\n\n\n\n<p>\u8bbe\u7f6e\u5355\u4f4d\u7684\u901f\u5ea6\u548c\u89d2\u5ea6\u3002\u7b49\u4ef7\u4e8e\u4e0b\u9762\u51fd\u6570\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">function SetV(unit,v,angle,set_rot)<br>    unit.vx=v*cos(angle)<br>    unit.vy=v*sin(angle)<br>    if set_rot then unit.rot=angle end<br>end<\/pre>\n\n\n\n<p><strong>BoxCheck(unit,x1,x2,y1,y2)<\/strong><\/p>\n\n\n\n<p>\u68c0\u67e5\u5355\u4f4d\u7684\u5750\u6807\u662f\u5426\u5904\u5728\u6307\u5b9a\u7684\u77e9\u5f62\u8303\u56f4\u5185\u3002\u7b49\u4ef7\u4e8e\u4e0b\u9762\u51fd\u6570\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">function BoxCheck(unit,x1,x2,y1,y2)<br>    return unit.x&gt;x1 and unit.x&lt;x2 and unit.y&gt;y1 and unit.y&lt;y2<br>end<\/pre>\n\n\n\n<p><strong>Dist(unit1,unit2)<\/strong><\/p>\n\n\n\n<p><strong>Dist(x1,y1,x2,y2)<\/strong><\/p>\n\n\n\n<p>\u8fd4\u56de\u4e24\u4e2a\u5355\u4f4d\u4e4b\u95f4\u7684\u8ddd\u79bb\u3002<\/p>\n\n\n\n<p><strong>Angle(unit1,unit2)<\/strong><\/p>\n\n\n\n<p><strong>Angle(x1,y1,x2,y2)<\/strong><\/p>\n\n\n\n<p>\u8fd4\u56de\u5355\u4f4d1\u6307\u5411\u5355\u4f4d2\u7684\u89d2\u5ea6\uff0c\u53d6\u503c-pi~+pi\u4e4b\u95f4\u3002<\/p>\n\n\n\n<p>3.<strong>\u5355\u4f4d\u7684\u5c5e\u6027<\/strong><\/p>\n\n\n\n<p>\u5355\u4f4d\u7684\u5c5e\u6027\u53ef\u4ee5\u901a\u8fc7\u201c\u5355\u4f4d.\u5c5e\u6027\u201d\u7684\u683c\u5f0f\u6765\u8bbf\u95ee\u3002<\/p>\n\n\n\n<p>\u5355\u4f4d\u7684\u5c5e\u6027\u5206\u4e3a\u5185\u5efa\u5c5e\u6027\u548c\u81ea\u5b9a\u4e49\u5c5e\u6027\u3002\u4ed6\u4eec\u7684\u8bbf\u95ee\u65b9\u5f0f\u5b8c\u5168\u76f8\u540c\u3002\u5185\u5efa\u5c5e\u6027\u662f\u88ab\u8d4b\u4e88\u4e86\u4e00\u5b9a\u610f\u4e49\u7684\u5c5e\u6027\uff0c\u81ea\u5b9a\u4e49\u5c5e\u6027\u53ea\u662f\u4e3a\u4e86\u65b9\u4fbf\u7684\u4e3a\u6bcf\u4e2a\u5355\u4f4d\u5b58\u50a8\u548c\u4ed6\u76f8\u5173\u7684\u4e00\u4e9b\u53d8\u91cf\u3002<\/p>\n\n\n\n<p>\u5185\u5efa\u5c5e\u6027\uff1a<\/p>\n\n\n\n<p><strong>class<\/strong><\/p>\n\n\n\n<p>\u5355\u4f4d\u7684\u7c7b\u3002<\/p>\n\n\n\n<p><strong>x<\/strong><\/p>\n\n\n\n<p>\u5355\u4f4d\u7684x\u5750\u6807\u3002\u9ed8\u8ba4\u4e3a0\u3002<\/p>\n\n\n\n<p><strong>y<\/strong><\/p>\n\n\n\n<p>\u5355\u4f4d\u7684y\u5750\u6807\u3002\u9ed8\u8ba4\u4e3a0\u3002<\/p>\n\n\n\n<p><strong>rot<\/strong><\/p>\n\n\n\n<p>\u5355\u4f4d\u7684\u671d\u5411\u3002\u9ed8\u8ba4\u4e3a0\u3002<\/p>\n\n\n\n<p><strong>vx<\/strong><\/p>\n\n\n\n<p>\u5355\u4f4d\u7684x\u5750\u6807\u7684\u6bcf\u5e27\u7684\u81ea\u589e\u91cf\u3002\u9ed8\u8ba4\u4e3a0\u3002<\/p>\n\n\n\n<p><strong>vy<\/strong><\/p>\n\n\n\n<p>\u5355\u4f4d\u7684y\u5750\u6807\u7684\u6bcf\u5e27\u7684\u81ea\u589e\u91cf\u3002\u9ed8\u8ba4\u4e3a0\u3002<\/p>\n\n\n\n<p><strong>omiga<\/strong><\/p>\n\n\n\n<p>\u5355\u4f4d\u7684\u671d\u5411\u7684\u6bcf\u5e27\u7684\u81ea\u589e\u91cf\u3002\u9ed8\u8ba4\u4e3a0\u3002<\/p>\n\n\n\n<p>\uff08\u6ce8\uff1ax\/y\/rot\u7684\u81ea\u589e\u8fd0\u7b97\u5728\u5e27\u903b\u8f91\u51fd\u6570\u4e4b\u540e\u8fdb\u884c\u3002\uff09<\/p>\n\n\n\n<p><strong>timer<\/strong><\/p>\n\n\n\n<p>\u8ba1\u6570\u5668\uff0c\u5728\u5355\u4f4d\u88ab\u521b\u5efa\u65f6\u4e3a0\uff0c\u4ee5\u540e\u6bcf\u5e27+1\u3002<\/p>\n\n\n\n<p><strong>img<\/strong><\/p>\n\n\n\n<p>\u5355\u4f4d\u7684\u663e\u793a\u56fe\u50cf\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b\uff0c\u9ed8\u8ba4\u4e3a\u7a7a\u3002\u53ef\u4ee5\u662fimage\u3001animation\u6216\u8005particle system\u7684name\uff08\u89c1\u56fe\u50cf\u5904\u7406\u90e8\u5206\uff09\u3002\u5982\u679c\u5355\u4f4d\u8bbe\u7f6e\u4e86img\u5c5e\u6027\u800c\u4e14\u9ed8\u8ba4\u7684render\u51fd\u6570\u6ca1\u6709\u88ab\u91cd\u5b9a\u4e49\u8986\u76d6\uff0c\u90a3\u4e48\u5c06\u4f1a\u628aimg\u7684\u56fe\u50cf\u6839\u636ex\u3001y\u3001rot\u3001hscale\u3001vscale\u5c5e\u6027\u8fdb\u884c\u6e32\u67d3\u3002\u5bf9\u5355\u4f4d\u7684img\u5c5e\u6027\u8fdb\u884c\u8d4b\u503c\u65f6\uff0c\u4f1a\u81ea\u52a8\u6539\u53d8\u8be5\u5355\u4f4d\u7684\u78b0\u649e\u5c3a\u5bf8a\u548cb(\u89c1\u4e0b\u6587)\u4e3a\u8be5\u56fe\u50cf\u7684a\u548cb\u3002<\/p>\n\n\n\n<p><strong>layer<\/strong><\/p>\n\n\n\n<p>\u5355\u4f4d\u7684\u56fe\u5c42\uff0c\u51b3\u5b9a\u5355\u4f4d\u4e4b\u95f4\u6e32\u67d3\u7684\u5148\u540e\u987a\u5e8f\uff0c\u8d8a\u5927\u6e32\u67d3\u7684\u987a\u5e8f\u8d8a\u9760\u540e\uff0c\u5373\u8d8a\u662f\u5728\u9876\u5c42\u3002\u53d6\u503c\u53ef\u4ee5\u662f\u4efb\u610f\u6d6e\u70b9\u6570\u3002\u5355\u4f4d\u7684layer\u9ed8\u8ba4\u4e3a0\u3002LuaSTG\u9884\u5b9a\u4e49\u7684\u56fe\u5c42\uff1a<\/p>\n\n\n\n<p>LAYER_BG=-700<\/p>\n\n\n\n<p>LAYER_ENEMY=-600<\/p>\n\n\n\n<p>LAYER_PLAYER_BULLET=-500<\/p>\n\n\n\n<p>LAYER_PLAYER=-400<\/p>\n\n\n\n<p>LAYER_ITEM=-300<\/p>\n\n\n\n<p>LAYER_ENEMY_BULLET=-200<\/p>\n\n\n\n<p>LAYER_ENEMY_BULLET_EF=-100<\/p>\n\n\n\n<p>LAYER_TOP=0<\/p>\n\n\n\n<p><strong>a<\/strong><\/p>\n\n\n\n<p>\u5355\u4f4d\u7684\u7eb5\u5411\u78b0\u649e\u5927\u5c0f\u7684\u4e00\u534a\u3002\u9ed8\u8ba4\u4e3a0\u3002<\/p>\n\n\n\n<p><strong>b<\/strong><\/p>\n\n\n\n<p>\u5355\u4f4d\u7684\u6a2a\u5411\u78b0\u649e\u5927\u5c0f\u7684\u4e00\u534a\u3002\u9ed8\u8ba4\u4e3a0\u3002<\/p>\n\n\n\n<p><strong>rect<\/strong><\/p>\n\n\n\n<p>\u5355\u4f4d\u7684\u78b0\u649e\u5224\u5b9a\u662f\u5426\u4e3a\u77e9\u5f62\u3002\u5982\u679c\u4e3atrue\uff0c\u5219\u5355\u4f4d\u7684\u78b0\u649e\u5224\u5b9a\u4e3a\u957f\u548c\u5bbd\u5206\u522b\u4e3a2a\u548c2b\u7684\u77e9\u5f62\uff0c\u5426\u5219\u4e3a\u957f\u8f74\u548c\u77ed\u8f74\u5206\u522b\u4e3aa\u548cb\u7684\u692d\u5706\u3002\u9ed8\u8ba4\u4e3afalse\u3002<\/p>\n\n\n\n<p><strong>colli<\/strong><\/p>\n\n\n\n<p>\u5355\u4f4d\u662f\u5426\u53c2\u4e0e\u78b0\u649e\u68c0\u6d4b\u3002\u9ed8\u8ba4\u4e3atrue<\/p>\n\n\n\n<p><strong>group<\/strong><\/p>\n\n\n\n<p>\u5355\u4f4d\u6240\u5728\u7684\u78b0\u649e\u7ec4\u3002LuaSTG\u4e00\u5171\u652f\u630116\u4e2a\u78b0\u649e\u7ec4\u3002LuaSTG\u9884\u5b9a\u4e49\u7684\u78b0\u649e\u7ec4\uff1a<\/p>\n\n\n\n<p>GROUP_GHOST=0<\/p>\n\n\n\n<p>GROUP_ENEMY_BULLET=1<\/p>\n\n\n\n<p>GROUP_ENEMY=2<\/p>\n\n\n\n<p>GROUP_PLAYER_BULLET=3<\/p>\n\n\n\n<p>GROUP_PLAYER=4<\/p>\n\n\n\n<p>GROUP_INDES=5<\/p>\n\n\n\n<p>GROUP_ITEM=6<\/p>\n\n\n\n<p>\u5728\u6bcf\u5e27\uff0cLuaSTG\u4f1a\u505a\u5982\u4e0b\u7684\u78b0\u649e\u68c0\u67e5\uff1a<\/p>\n\n\n\n<p>CollisionCheck(GROUP_PLAYER,GROUP_ENEMY_BULLET)<\/p>\n\n\n\n<p>CollisionCheck(GROUP_PLAYER,GROUP_ENEMY)<\/p>\n\n\n\n<p>CollisionCheck(GROUP_PLAYER,GROUP_INDES)<\/p>\n\n\n\n<p>CollisionCheck(GROUP_ENEMY,GROUP_PLAYER_BULLET)<\/p>\n\n\n\n<p>CollisionCheck(GROUP_ITEM,GROUP_PLAYER)<\/p>\n\n\n\n<p>\u9010\u4e2a\u68c0\u6d4b\u524d\u4e00\u7ec4\u4e2d\u7684\u6bcf\u4e2a\u5bf9\u8c61\u662f\u5426\u4e0e\u540e\u4e00\u7ec4\u4e2d\u7684\u4efb\u4f55\u5bf9\u8c61\u53d1\u751f\u78b0\u649e\uff0c\u5982\u679c\u662f\uff0c\u5219\u8c03\u7528\u524d\u4e00\u4e2a\u8c61\u7684colli\u51fd\u6570\uff0c\u5c06\u540e\u4e00\u4e2a\u5bf9\u8c61\u4f5c\u4e3a\u53c2\u6570\u4f20\u5165\u3002\u5355\u4f4d\u7684\u78b0\u649e\u7ec4\u9ed8\u8ba4\u4e3aGROUP_GHOST\u3002<\/p>\n\n\n\n<p><strong>dx<\/strong><\/p>\n\n\n\n<p>\u5355\u4f4d\u7684x\u5750\u6807\u548c\u524d\u4e00\u5e27\u76f8\u6bd4\u7684\u53d8\u5316\u503c\u3002<\/p>\n\n\n\n<p><strong>dy<\/strong><\/p>\n\n\n\n<p>\u5355\u4f4d\u7684y\u5750\u6807\u548c\u524d\u4e00\u5e27\u76f8\u6bd4\u7684\u53d8\u5316\u503c\u3002<\/p>\n\n\n\n<p><strong>status<\/strong><\/p>\n\n\n\n<p>\u5355\u4f4d\u7684\u72b6\u6001\uff0c\u53ef\u4ee5\u662f&#8217;normal&#8217;\u3001&#8217;del&#8217;\u3001&#8217;kill&#8217;\u4e4b\u4e00\uff0c\u5206\u522b\u8868\u793a\u6b63\u5e38\u3001\u88ab\u6e05\u9664\u3001\u88ab\u51fb\u6740\u3002\u88ab\u6e05\u9664\u6216\u8005\u51fb\u6740\u7684\u5355\u4f4d\u5728\u5f53\u524d\u5e27\u4ecd\u7136\u662f\u6709\u6548\u7684\uff0c\u4f46\u662fstatus\u5c5e\u6027\u4f1a\u88ab\u8bbe\u7f6e\u4e3aSTATUS_DEL\u6216STATUS_KILL\uff1bstatus\u5c5e\u6027\u4e3aSTATUS_DEL\u6216STATUS_KILL\u7684\u5355\u4f4d\u5728\u5f53\u524d\u5e27\u7ed3\u675f\u4e4b\u540e\u53d8\u4e3a\u65e0\u6548\u7684\u5355\u4f4d\u3002\u6240\u4ee5\uff0cDel\u51fd\u6570\u7b49\u6548\u4e8e\uff1afunction&nbsp;Del(unit)<br>&nbsp; &nbsp; unit.status=&#8217;del&#8217;<br>&nbsp; &nbsp; unit.class.del(unit)<br>end<\/p>\n\n\n\n<p>Kill\u540c\u6837\u3002<\/p>\n\n\n\n<p><strong>hide<\/strong><\/p>\n\n\n\n<p>\u662f\u5426\u9690\u85cf\u5355\u4f4d\uff0c\u5982\u679c\u4e3atrue\uff0c\u5219\u6bcf\u5e27\u8df3\u8fc7\u8be5\u5355\u4f4d\u7684render\u51fd\u6570\u7684\u6267\u884c\u3002\u9ed8\u8ba4\u4e3afalse\u3002<\/p>\n\n\n\n<p><strong>bound<\/strong><\/p>\n\n\n\n<p>\u5355\u4f4d\u79bb\u5f00\u663e\u793a\u8303\u56f4\u4e4b\u540e\u662f\u5426\u88ab\u81ea\u52a8\u6e05\u9664\u3002\u9ed8\u8ba4\u4e3atrue\u3002<\/p>\n\n\n\n<p><strong>navi<\/strong><\/p>\n\n\n\n<p>\u662f\u5426\u6839\u636e\u5355\u4f4d\u7684\u8fd0\u52a8\u65b9\u5411\u81ea\u52a8\u8ba1\u7b97\u5e76\u8c03\u6574\u5176\u671d\u5411\u3002\u5373\u7528dx\u548cdy\u8ba1\u7b97rot\u3002\u9ed8\u8ba4\u4e3afalse\u3002<\/p>\n\n\n\n<p><strong>hscale<\/strong><\/p>\n\n\n\n<p>\u5355\u4f4d\u7684\u7eb5\u5411\u62c9\u4f38\u7387\u3002\u53ea\u6539\u53d8\u56fe\u50cf\u5927\u5c0f\uff0c\u4e0d\u5bf9\u78b0\u649e\u5224\u5b9a\u5927\u5c0f\u9020\u6210\u5f71\u54cd\u3002\u9ed8\u8ba4\u4e3a1\u3002<\/p>\n\n\n\n<p><strong>vscale<\/strong><\/p>\n\n\n\n<p>\u5355\u4f4d\u7684\u6a2a\u5411\u62c9\u4f38\u7387\u3002\u53ea\u6539\u53d8\u56fe\u50cf\u5927\u5c0f\uff0c\u4e0d\u5bf9\u78b0\u649e\u5224\u5b9a\u5927\u5c0f\u9020\u6210\u5f71\u54cd\u3002\u9ed8\u8ba4\u4e3a1\u3002<\/p>\n\n\n\n<p><strong>ani<\/strong><\/p>\n\n\n\n<p>\u5355\u4f4d\u7684\u52a8\u753b\u8ba1\u6570\u5668\u3002\u548ctimer\u7c7b\u4f3c\uff0c\u4f46\u662f\u4e13\u95e8\u7528\u4e8e\u52a8\u753b\u7684\u6e32\u67d3\u3002\u5f15\u5165\u5176\u7684\u76ee\u7684\u662f\u4e3a\u4e86\u907f\u514d\u5728timer\u7684\u503c\u53d1\u751f\u8df3\u53d8\u7684\u65f6\u5019\u5355\u4f4d\u7684\u52a8\u753b\u4f1a\u8df3\u53d8\u7684\u60c5\u51b5\u3002\u4e00\u822c\u60c5\u51b5\u4e0b\u4e0d\u4f1a\u5bf9\u5176\u8fdb\u884c\u624b\u52a8\u4fee\u6539\u3002<\/p>\n\n\n\n<p><strong>\u4e09\uff0e\u8d44\u6e90<\/strong><\/p>\n\n\n\n<p>LuaSTG\u7684\u8d44\u6e90\u6587\u4ef6\u6709\u811a\u672c(.lua)\u3001\u56fe\u50cf(.png .bmp)\u3001\u7c92\u5b50\u6548\u679c(.psi)\u3001\u5b57\u4f53\u7d22\u5f15(.fnt)\u3001\u58f0\u97f3(.wav .mp3)\u51e0\u79cd\uff0c\u5b58\u50a8\u5728data\u6587\u4ef6\u5939\u548cmod\u6587\u4ef6\u5939\u4e0b\u7684\u5de5\u7a0b\u6587\u4ef6\u5939\u5185\u3002LuaSTG\u4ee5debug\u6a21\u5f0f\u8fd0\u884c\u65f6\uff0c\u4f1a\u5206\u522b\u5148\u5c06\u4ed6\u4eec\u6253\u5305\u6210data.zip\u548cproject_name.zip\uff0c\u7136\u540e\u5728\u52a0\u8f7d\u8fd9\u4e24\u4e2azip\u5305\uff0c\u975edebug\u6a21\u5f0f\u4f1a\u7701\u7565\u6253\u5305\u7684\u8fc7\u7a0b\uff0c\u76f4\u63a5\u52a0\u8f7dzip\u5305\u3002\u52a0\u8f7d\u8d44\u6e90\u65f6\uff0cLuaSTG\u4f1a\u4f18\u5148\u4eceproject_name.zip\u91cc\u641c\u7d22\uff0c\u6ca1\u6709\u627e\u5230\u5219\u5728data.zip\u91cc\u7ee7\u7eed\u641c\u7d22\u3002<\/p>\n\n\n\n<p><strong>Include(scriptfilename)<\/strong><\/p>\n\n\n\n<p>\u52a0\u8f7d\u811a\u672c\u3002\u56e0\u4e3a\u52a0\u5165\u4e86\u5bf9\u5df2\u52a0\u8f7d\u811a\u672c\u7684\u5224\u65ad\uff0c\u6240\u4ee5\u53ef\u4ee5\u91cd\u590d\u52a0\u8f7d\u751a\u81f3\u5faa\u73af\u52a0\u8f7d\u3002<\/p>\n\n\n\n<p>\u9664\u811a\u672c\u8d44\u6e90\u4e4b\u5916\u7684\u5176\u4ed6\u8d44\u6e90\u7684\u52a0\u8f7d\u51fd\u6570\u90fd\u4ee5Load\u5f00\u5934\uff0c\u8fd9\u4e9b\u51fd\u6570\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\u90fd\u4e3a\u4e00\u4e2a\u5b57\u7b26\u4e32\u578b\uff0c\u53eb\u505a\u8d44\u6e90\u7684name\uff0c\u540c\u79cd\u8d44\u6e90\u7684name\u4e0d\u80fd\u91cd\u590d\u3002<\/p>\n\n\n\n<p>LuaSTG\u7684\u8d44\u6e90\u5171\u6709\u4e0b\u5217\u51e0\u79cd\uff1a<\/p>\n\n\n\n<p>1.\u7eb9\u7406\uff08tex\uff09<\/p>\n\n\n\n<p>\u901a\u8fc7\u51fd\u6570<strong>LoadTexture<\/strong>\u3001<strong>LoadImageFromFile<\/strong>\u4ecepng\u7b49\u56fe\u50cf\u683c\u5f0f\u6587\u4ef6\u4e2d\u52a0\u8f7d\u3002<\/p>\n\n\n\n<p>2.\u56fe\u50cf\uff08img\uff09<\/p>\n\n\n\n<p>\u901a\u8fc7\u51fd\u6570<strong>LoadImage<\/strong>\u3001<strong>LoadImageFromFile<\/strong>\u3001<strong>LoadImageGroup<\/strong>\u4ece\u7eb9\u7406\u4e2d\u52a0\u8f7d\u3002<\/p>\n\n\n\n<p>3.\u52a8\u753b\uff08ani\uff09<\/p>\n\n\n\n<p>\u901a\u8fc7\u51fd\u6570<strong>LoadAnimation<\/strong>\u4ece\u7eb9\u7406\u4e2d\u52a0\u8f7d\u3002<\/p>\n\n\n\n<p>4.\u80cc\u666f\u97f3\u4e50\uff08bgm\uff09<\/p>\n\n\n\n<p>\u901a\u8fc7\u51fd\u6570<strong>LoadMusic<\/strong>\u4ece.mp3\u7b49\u97f3\u9891\u683c\u5f0f\u6587\u4ef6\u4e2d\u52a0\u8f7d\u3002<\/p>\n\n\n\n<p>5.\u97f3\u6548\uff08snd\uff09<\/p>\n\n\n\n<p>\u901a\u8fc7\u51fd\u6570<strong>LoadSound<\/strong>\u4ece.wav\u7b49\u97f3\u9891\u683c\u5f0f\u6587\u4ef6\u4e2d\u52a0\u8f7d\u3002<\/p>\n\n\n\n<p>6.\u7c92\u5b50\u6548\u679c\uff08psi\uff09<\/p>\n\n\n\n<p>\u901a\u8fc7\u51fd\u6570<strong>LoadPS<\/strong>\u4ecepsi\u6587\u4ef6\u4e2d\u52a0\u8f7d\u3002<\/p>\n\n\n\n<p>7.\u4f4d\u56fe\u5b57\u4f53\uff08fnt\uff09<\/p>\n\n\n\n<p>\u901a\u8fc7\u51fd\u6570<strong>LoadFont<\/strong>\u4ecefnt\u6587\u4ef6\u4e2d\u52a0\u8f7d\u3002<\/p>\n\n\n\n<p>8.true type\u5b57\u4f53\uff08ttf\uff09<\/p>\n\n\n\n<p>\u901a\u8fc7\u51fd\u6570<strong>LoadTTF<\/strong>\u4ecettf\u7b49\u5b57\u4f53\u683c\u5f0f\u6587\u4ef6\u4e2d\u52a0\u8f7d\u3002<\/p>\n\n\n\n<p>\u9664\u811a\u672c\u8d44\u6e90\u4e4b\u5916\u7684\u5176\u4ed6\u8d44\u6e90\uff0c\u5982\u679c\u662f\u5728\u811a\u672c\u7684\u9876\u7ea7\u4ee3\u7801\u91cc\u52a0\u8f7d\uff0c\u90a3\u4e48\u6b64\u65f6\u52a0\u8f7d\u7684\u8d44\u6e90\u88ab\u8ba4\u4e3a\u662f\u5168\u5c40\u7684\uff0c\u4f1a\u4e00\u76f4\u5b58\u5728\uff1b\u5426\u5219\u8fd9\u4e9b\u8d44\u6e90\u5728\u79bb\u5f00\u5f53\u524d\u5173\u5361\u4e4b\u540e\u5c06\u4f1a\u88ab\u81ea\u52a8\u6e05\u9664\u3002<\/p>\n\n\n\n<p><strong>CheckRes(restype,resname)<\/strong><\/p>\n\n\n\n<p>\u68c0\u67e5\u6307\u5b9a\u8d44\u6e90\u662f\u5426\u5b58\u5728\uff0c\u5982\u679c\u662f\u5168\u5c40\u8d44\u6e90\u8d44\u6e90\uff0c\u5219\u8fd4\u56de&#8217;global&#8217;\uff1b\u5982\u679c\u662f\u5173\u5361\u8d44\u6e90\uff0c\u5219\u8fd4\u56de&#8217;stage&#8217;\uff1b\u5982\u679c\u8d44\u6e90\u4e0d\u5b58\u5728\uff0c\u5219\u8fd4\u56denil\u3002<\/p>\n\n\n\n<p>restype\u53ef\u4ee5\u4e3a&#8217;tex&#8217;\u3001&#8217;img&#8217;\u3001&#8217;ani&#8217;\u3001&#8217;bgm&#8217;\u3001&#8217;snd&#8217;\u3001&#8217;psi&#8217;\u3001&#8217;fnt&#8217;\u3001&#8217;ttf&#8217;\u4e4b\u4e00\u3002<\/p>\n\n\n\n<p><strong>EnumRes(restype)<\/strong><\/p>\n\n\n\n<p>\u8fd4\u56de\u4e24\u4e2atable\uff0c\u5185\u5bb9\u5206\u522b\u662f\u6307\u5b9a\u7c7b\u578b\u7684\u6240\u6709\u5168\u5c40\u8d44\u6e90\u548c\u5173\u5361\u8d44\u6e90\u7684\u540d\u5b57\u3002<\/p>\n\n\n\n<p>restype\u53ef\u4ee5\u4e3a&#8217;tex&#8217;\u3001&#8217;img&#8217;\u3001&#8217;ani&#8217;\u3001&#8217;bgm&#8217;\u3001&#8217;snd&#8217;\u3001&#8217;psi&#8217;\u3001&#8217;fnt&#8217;\u3001&#8217;ttf&#8217;\u4e4b\u4e00\u3002<\/p>\n\n\n\n<p><strong>\u56db\uff0e\u56fe\u50cf\u5904\u7406<\/strong><\/p>\n\n\n\n<p><strong>1. \u989c\u8272<\/strong><\/p>\n\n\n\n<p><strong>Color(hexcode)<\/strong><\/p>\n\n\n\n<p><strong>Color(A,R,G,B)<\/strong><\/p>\n\n\n\n<p>\u8fd4\u56de\u4e00\u4e2a\u989c\u8272\u5bf9\u8c61\uff0c\u8fd9\u4e2a\u5bf9\u8c61\u652f\u6301\u52a0\u6cd5\u3001\u6570\u4e58\u3001tostring\u3001==\u548c~=\u3002LuaSTG\u91cc\u9762\u6240\u6709\u7684\u989c\u8272\u53c2\u6570\u90fd\u5e94\u4f7f\u7528\u8fd9\u4e2a\u5bf9\u8c61\u3002<\/p>\n\n\n\n<p>\u989c\u8272\u5bf9\u8c61\u7684\u6210\u5458\u51fd\u6570\uff1a<\/p>\n\n\n\n<p><strong>:ARGB()<\/strong><\/p>\n\n\n\n<p>\u8fd4\u56de\u8be5\u989c\u8272\u7684A\u3001R\u3001G\u3001B\u5206\u91cf\u3002<\/p>\n\n\n\n<p><strong>2. \u5750\u6807\u7cfb\u7edf<\/strong><\/p>\n\n\n\n<p>LuaSTG\u7684\u5750\u6807\u4e60\u60ef\u662f\uff0cx\u8f74\u6b63\u65b9\u5411\u4e3a\u6c34\u5e73\u5411\u53f3\uff0cy\u8f74\u6b63\u65b9\u5411\u7ad6\u76f4\u5411\u4e0a\uff1b\u75284\u4e2a\u6570\u8868\u793a\u4e00\u4e2a\u77e9\u5f62\u8303\u56f4\u7684\u4e60\u60ef\u662f\u5de6\u3001\u53f3\u3001\u4e0b\u3001\u4e0a\u3002\uff08\u7eb9\u7406\u5750\u6807\u9664\u5916\uff09<\/p>\n\n\n\n<p>LuaSTG\u5728\u6e32\u67d3\u65f6\u67093\u5957\u5750\u6807\uff0c\u5206\u522b\u662f\u4e16\u754c\u5750\u6807\u3001UI\u5750\u6807\u548c3D\u5750\u6807\u3002\u901a\u8fc7\u51fd\u6570SetViewMode\u6765\u5207\u6362\u3002<\/p>\n\n\n\n<p>\u4e16\u754c\u5750\u6807\uff1a\u8fdb\u884c\u5355\u4f4d\u6e32\u67d3\u65f6\u7684\u5750\u6807\uff0c\u5355\u4f4d\u662f\u50cf\u7d20\uff08\u5982\u679c\u5206\u8fa8\u7387\u662f640\u00d7480\u7684\u8bdd\uff0c\u5426\u5219\u8981\u4e58\u4ee5\u4e00\u4e2a\u7f29\u653e\u56e0\u5b50\uff09\u3002\u4e16\u754c\u533a\u57df\u7684\u5de6\u4e0b\u89d2\u662f(-192,-224)\uff0c\u53f3\u4e0a\u89d2\u662f(192,224)\u3002\u5355\u4f4d\u7684x\u548cy\u5c5e\u6027\u6307\u5f97\u5c31\u662f\u5728\u4e16\u754c\u5750\u6807\u4e2d\u7684\u503c\u3002<\/p>\n\n\n\n<p>UI\u5750\u6807\uff1a\u8fdb\u884cUI\u6e32\u67d3\u65f6\u7684\u5750\u6807\u3002\u5de6\u4e0b\u89d2\u4e3a(0,0)\uff0c\u53f3\u4e0a\u89d2\u4e3a(640,480)\u3002<\/p>\n\n\n\n<p>3D\u5750\u6807\uff1a\u8fdb\u884c3D\u6e32\u67d3\u65f6\u7684\u5750\u6807\u3002\u53ef\u901a\u8fc7Set3D\u51fd\u6570\u5bf9\u76f8\u673a\u548c\u96fe\u6548\u679c\u8fdb\u884c\u5177\u4f53\u8bbe\u7f6e\u3002<\/p>\n\n\n\n<p><strong>SetViewMode(mode)<\/strong><\/p>\n\n\n\n<p>mode\u53ef\u4ee5\u662f&#8217;world&#8217;\u3001&#8217;ui&#8217;\u3001&#8217;3d&#8217;\u4e4b\u4e00\u3002<\/p>\n\n\n\n<p><strong>Set3D(key,a,b,c)<\/strong><\/p>\n\n\n\n<p>key\u4e3a\u4e0d\u540c\u7684\u5b57\u7b26\u4e32\u65f6\u51fd\u6570\u5c06\u5bf9\u4e0d\u540c\u7684\u53c2\u6570\u8fdb\u884c\u8bbe\u7f6e\u3002<\/p>\n\n\n\n<p>Set3D(&#8216;eye&#8217;,x,y,z)<\/p>\n\n\n\n<p>Set3D(&#8216;at&#8217;,x,y,z)<\/p>\n\n\n\n<p>Set3D(&#8216;up&#8217;,x,y,z)<\/p>\n\n\n\n<p>Set3D(&#8216;z&#8217;,znear,zfar)<\/p>\n\n\n\n<p>Set3D(&#8216;fovy&#8217;,fovy)<\/p>\n\n\n\n<p>\u4e0a\u8ff0\u53c2\u6570\u7684\u610f\u4e49\u89c1\uff1a<\/p>\n\n\n\n<p><a href=\"http:\/\/www.opengl.org\/sdk\/docs\/man\/xhtml\/gluLookAt.xml\">http:\/\/www.opengl.org\/sdk\/docs\/man\/xhtml\/gluLookAt.xml<\/a><\/p>\n\n\n\n<p><a href=\"http:\/\/www.opengl.org\/sdk\/docs\/man\/xhtml\/gluPerspective.xml\">http:\/\/www.opengl.org\/sdk\/docs\/man\/xhtml\/gluPerspective.xml<\/a><\/p>\n\n\n\n<p>Set3D(&#8216;fog&#8217;,start,end[,color=Color(0x00FFFFFF)])<\/p>\n\n\n\n<p>\u8bbe\u7f6e\u96fe\u6548\u679c\u3002\u5982\u679cstart&gt;0\uff0c\u5219\u8bbe\u7f6e\u7ebf\u6027\u96fe\uff1b\u82e5start==-1\uff0c\u5219\u8bbe\u7f6e\u6307\u6570\u96fe\uff1b\u82e5start==-2\uff0c\u5219\u8bbe\u7f6e\u4e8c\u6b21\u6307\u6570\u96fe\u3002\u5728\u540e\u9762\u4e24\u79cd\u60c5\u5f62\u4e0b\uff0cend\u53c2\u6570\u8868\u793a\u96fe\u7684\u5f3a\u5ea6\u3002\u5982\u679cstart\u7b49\u4e8eend\uff0c\u5219\u5173\u95ed\u96fe\u6548\u679c\u3002color\u662f\u96fe\u7684\u989c\u8272\u3002<\/p>\n\n\n\n<p>Set3D\u53ea\u662f\u4fee\u65393D\u6a21\u5f0f\u7684\u8bbe\u7f6e\uff0c\u5e76\u4e0d\u4f1a\u7acb\u5373\u5c06\u5750\u6807\u7cfb\u7edf\u5207\u6362\u81f33D\u6a21\u5f0f\u3002<\/p>\n\n\n\n<p><strong>3. \u6df7\u5408\u6a21\u5f0f<\/strong><\/p>\n\n\n\n<p>\u6df7\u5408\u6a21\u5f0fblendmode\u53ef\u7528\u4e0b\u9762\u5b57\u7b26\u4e32\u4e4b\u4e00\uff1a<\/p>\n\n\n\n<p>&#8216;mul+add&#8217; \u9876\u70b9\u989c\u8272\u548c\u7eb9\u7406\u989c\u8272\u76f8\u4e58\uff0c\u65b0\u7684\u7ed8\u5236\u4e0e\u80cc\u666f\u76f8\u52a0\u3002<\/p>\n\n\n\n<p>&#8216;mul+alpha&#8217; \u9876\u70b9\u989c\u8272\u548c\u7eb9\u7406\u989c\u8272\u76f8\u4e58\uff0c\u65b0\u7684\u7ed8\u5236\u4e0e\u80cc\u666falpha\u6df7\u5408\u3002<\/p>\n\n\n\n<p>&#8216;add+add&#8217; \u9876\u70b9\u989c\u8272\u548c\u7eb9\u7406\u989c\u8272\u76f8\u52a0\uff0c\u65b0\u7684\u7ed8\u5236\u4e0e\u80cc\u666f\u76f8\u52a0\u3002<\/p>\n\n\n\n<p>&#8216;add+alpha&#8217; \u9876\u70b9\u989c\u8272\u548c\u7eb9\u7406\u989c\u8272\u76f8\u52a0\uff0c\u65b0\u7684\u7ed8\u5236\u4e0e\u80cc\u666falpha\u6df7\u5408\u3002<\/p>\n\n\n\n<p>&#8221; \uff08\u7a7a\u5b57\u7b26\u4e32\uff09\u9ed8\u8ba4\u7684\u6df7\u5408\u6a21\u5f0f\uff0c\u4e0e&#8217;mul+alpha&#8217;\u7b49\u4ef7\u3002<\/p>\n\n\n\n<p><strong>4. \u56fe\u50cf\u7ed8\u5236<\/strong><\/p>\n\n\n\n<p><strong>LoadTexture(texturename,filename[,mipmap=false])<\/strong><\/p>\n\n\n\n<p>&nbsp;\u4ece\u8d44\u6e90\u6587\u4ef6\u4e2d\u52a0\u8f7d\u7eb9\u7406\u3002\u652f\u6301BMP\u3001DDS\u3001DIB\u3001JPG\u3001PNG\u548cTGA\u683c\u5f0f\u3002\u5efa\u8bae\u4f7f\u7528PNG\u683c\u5f0f\u3002<\/p>\n\n\n\n<p><strong>LoadImage(imagename,texturename,x,y,w,h[,a=0[,b=0[,rect=false]]])<\/strong><\/p>\n\n\n\n<p>\u4ece\u7eb9\u7406\u4e2d\u65b0\u5efa\u56fe\u50cf\u3002x\u3001y\u662f\u56fe\u50cf\u5de6\u4e0a\u89d2\u5728\u7eb9\u7406\u4e2d\u7684\u5750\u6807\uff08\u5de6\u4e0a\u89d2\u662f(0,0)\uff09\uff1bw\u3001h\u662f\u56fe\u50cf\u7684\u5bbd\u548c\u9ad8\uff1ba\u3001b\u3001rect\u662f\u56fe\u50cf\u7684\u7eb5\u5411\u3001\u6a2a\u5411\u78b0\u649e\u5224\u5b9a\u548c\u5224\u5b9a\u5f62\u72b6\uff0c\u610f\u4e49\u540c\u5bf9\u8c61\u7684a\u3001b\u3001rect\u5c5e\u6027\uff0c\u5f53\u628a\u4e00\u4e2a\u56fe\u50cf\u7684\u540d\u5b57(imagename)\u8d4b\u503c\u7ed9\u4e00\u4e2a\u5bf9\u8c61\u7684img\u5c5e\u6027\u65f6\uff0c\u90a3\u4e48\u5bf9\u8c61\u7684a\u3001b\u3001rect\u5c5e\u6027\u5c06\u4f1a\u81ea\u52a8\u88ab\u8d4b\u503c\u4e3a\u56fe\u50cf\u7684a\u3001b\u3001rect\u3002<\/p>\n\n\n\n<p><strong>LoadImageFromFile(teximgname,filename[,mipmap=false])<\/strong><\/p>\n\n\n\n<p>\u4ece\u8d44\u6e90\u6587\u4ef6\u4e2d\u52a0\u8f7d\u7eb9\u7406\u540c\u65f6\u5c06\u6574\u5e45\u7eb9\u7406\u52a0\u8f7d\u4e3a\u540c\u540d\u7684\u56fe\u50cf\u3002<\/p>\n\n\n\n<p><strong>LoadImageGroup(imagenameprefix,texturename,x,y,w,h,n,m[,a=0[,b=0[,rect=false]]])<\/strong><\/p>\n\n\n\n<p>\u4ece\u7eb9\u7406\u4e2d\u65b0\u5efa\u4e00\u7ec4\u56fe\u50cf\u3002n\u3001m\u4e3a\u5217\u6570\u548c\u884c\u6570\u3002\u8fd9\u7ec4\u56fe\u50cf\u5c06\u88ab\u547d\u540d\u4e3aimagenameprefix1\u3001imagenameprefix2\u3001imagenameprefix3\u2026\u2026<\/p>\n\n\n\n<p><strong>LoadImageGroupFromFile(teximgname,filename,mipmap,n,m[,a=0[,b=0[,rect=false]]])<\/strong><\/p>\n\n\n\n<p>\u4ece\u8d44\u6e90\u6587\u4ef6\u4e2d\u52a0\u8f7d\u7eb9\u7406\u540c\u65f6\u5c06\u6574\u5e45\u7eb9\u7406\u52a0\u8f7d\u4e3a\u4e00\u7ec4\u540c\u524d\u7f00\u7684\u56fe\u50cf\u3002<\/p>\n\n\n\n<p><strong>LoadAnimation(animationname,texturename,x,y,w,h,n,m,intv[,a=0[,b=0[,rect=false]]])<\/strong><\/p>\n\n\n\n<p>\u4ece\u7eb9\u7406\u4e2d\u65b0\u5efa\u52a8\u753b\u3002intv\u662f\u52a8\u753b\u4e2d\u76f8\u90bb\u4e24\u5e45\u56fe\u50cf\u95f4\u9694\u7684\u5e27\u6570\uff0c\u5373\u6bcf\u591a\u5c11\u5e27\u5207\u6362\u4e3a\u4e0b\u4e00\u5e45\u3002<\/p>\n\n\n\n<p><strong>LoadAniFromFile(texaniname,filename,mipmap,n,m,intv[,a=0[,b=0[,rect=false]]])<\/strong><\/p>\n\n\n\n<p>\u4ece\u8d44\u6e90\u6587\u4ef6\u4e2d\u52a0\u8f7d\u7eb9\u7406\u540c\u65f6\u5c06\u6574\u5e45\u7eb9\u7406\u52a0\u8f7d\u4e3a\u52a8\u753b\u3002<\/p>\n\n\n\n<p><strong>LoadPS(particlesystemname,filename,imagename[,a=0[,b=0[,rect=false]]])<\/strong><\/p>\n\n\n\n<p>\u4ece\u8d44\u6e90\u6587\u4ef6\u4e2d\u52a0\u8f7d\u7c92\u5b50\u6548\u679c\uff0c\u6240\u9700\u8981\u7684psi\u6587\u4ef6\u53ef\u7531\u5de5\u5177Particle Editor\u751f\u6210\u3002<\/p>\n\n\n\n<p><strong>LoadFont(fontname,filename)<\/strong><\/p>\n\n\n\n<p>\u4ece\u8d44\u6e90\u6587\u4ef6\u4e2d\u52a0\u8f7d\u4f4d\u56fe\u5b57\u4f53\u3002filename\u4e3afnt\u683c\u5f0f\uff0c\u53ef\u7531\u5de5\u5177Font Editor\u751f\u6210\uff0c\u751f\u6210\u7684fnt\u6587\u4ef6\u548cpng\u6587\u4ef6\u8981\u5728\u540c\u4e00\u76ee\u5f55\u4e0b\u3002<\/p>\n\n\n\n<p><strong>LoadTTF(ttfname,filename,facename,size,weight,&#8230;)<\/strong><\/p>\n\n\n\n<p>\u4ece\u8d44\u6e90\u6587\u4ef6\u4e2d\u52a0\u8f7d\u5b57\u4f53\uff0c\u652f\u6301fon\/fnt\/ttf\/ttc\/fot\/otf\/mmm\/pfb\/pfm\u683c\u5f0f\u3002facename\u662f\u5b57\u4f53\u7684\u540d\u79f0\uff1bsize\u4e3a\u5b57\u4f53\u7684\u9ad8\u5ea6\uff0c\u5355\u4f4d\u662f\u50cf\u7d20\uff1bweight\u662f\u5b57\u4f53\u7684\u7c97\u7ec6\uff0c400\u4e3a\u666e\u901a\u7c97\u7ec6\uff0c700\u4e3a\u7c97\u4f53\uff1b\u53ef\u9009\u53c2\u6570\u662f\u5b57\u4f53\u7684\u53d8\u5f62\uff0c\u53ef\u4ee5\u53d6\u4ee5\u4e0b\u4e00\u4e2a\u6216\u591a\u4e2a\u5b57\u7b26\u4e32\uff1a<\/p>\n\n\n\n<p>&#8216;italic&#8217; \u659c\u4f53<\/p>\n\n\n\n<p>&#8216;underline&#8217; \u4e0b\u5212\u7ebf<\/p>\n\n\n\n<p>&#8216;strikeout&#8217; \u5220\u9664\u7ebf<\/p>\n\n\n\n<p><strong>RenderClear(color)<\/strong><\/p>\n\n\n\n<p>\u7528\u4e00\u79cd\u989c\u8272\u586b\u6ee1\u6574\u4e2a\u7ed8\u56fe\u533a\u57df\u3002<\/p>\n\n\n\n<p><strong>Render(imagename,x,y[,rot=0[,hscale=1[,vscale=hscale[,z=0.5]]]])<\/strong><\/p>\n\n\n\n<p>\u7ed8\u5236\u4e00\u4e2a\u56fe\u50cf\u3002<\/p>\n\n\n\n<p><strong>RenderRect(imagename,x1,x2,y1,y2)<\/strong><\/p>\n\n\n\n<p>\u5c06\u56fe\u50cf\u7ed8\u5236\u5230\u4e00\u4e2a\u77e9\u5f62\u4e0a\u3002<\/p>\n\n\n\n<p><strong>Render4V(imagename,x0,y0,z0,x1,y1,z1,x2,y2,z2,x3,y3,z3)<\/strong><\/p>\n\n\n\n<p>\u5c06\u56fe\u50cf\u7ed8\u5236\u5230\u4e00\u4e2a3\u7ef4\u7684\u56db\u8fb9\u5f62\u4e0a\u3002\u56fe\u50cf\u5de6\u4e0a\u89d2\u7684\u9876\u70b9\u7f16\u53f7\u4e3a0\uff0c\u987a\u65f6\u9488\u65cb\u8f6c\u7f16\u53f7\u589e\u52a0\u3002\u5982\u679c\u4e0d\u662f\u57283D\u6a21\u5f0f\u4e0b\uff0c\u90a3\u4e48\u6240\u6709\u7684z\u5750\u6807\u8981\u53d60.5\u3002<\/p>\n\n\n\n<p><strong>RenderTexture(texturename,blendmode,vertex0,vertex1,vertex2,vertex3)<\/strong><\/p>\n\n\n\n<p>\u5c06\u7eb9\u7406\u7684\u4e00\u4e2a\u56db\u8fb9\u5f62\u533a\u57df\u7ed8\u5236\u5230\u4e00\u4e2a3\u7ef4\u56db\u8fb9\u5f62\u4e0a\u3002vertext\u662f\u4e00\u4e2a\u6570\u7ec4\uff0c\u683c\u5f0f\u4e3a{x,y,z,u,v,color}\uff0c\u5176\u4e2du\u3001v\u662f\u7eb9\u7406\u5750\u6807\uff08\u5de6\u4e0a\u89d2\u662f(0,0)\uff09\u3002\u5982\u679c\u4e0d\u662f\u57283D\u6a21\u5f0f\u4e0b\uff0c\u90a3\u4e48\u6240\u6709\u7684z\u5750\u6807\u8981\u53d60.5\u3002<\/p>\n\n\n\n<p><strong>RenderText(fontname,text,x,y,size,&#8230;)<\/strong><\/p>\n\n\n\n<p>\u7ed8\u5236\u6587\u5b57\u3002\u53ef\u9009\u53c2\u6570\u8868\u793a\u6587\u5b57\u6392\u5217\u548c\u5bf9\u9f50\u7684\u6a21\u5f0f\uff0c\u53ef\u4ee5\u53d6\u4ee5\u4e0b\u4e00\u4e2a\u6216\u591a\u4e2a\u5b57\u7b26\u4e32\uff08\u6bcf\u884c\u96501\u4e2a\uff09\uff1a<\/p>\n\n\n\n<p>&#8216;left&#8217; &#8216;center&#8217; &#8216;right&#8217;<\/p>\n\n\n\n<p>&#8216;top&#8217; &#8216;vcenter&#8217; &#8216;bottom&#8217;<\/p>\n\n\n\n<p>\u6216\u8005\uff1a<\/p>\n\n\n\n<p>&#8216;centerpoint&#8217; \u7b49\u6548\u4e8e\u540c\u65f6\u53d6&#8217;center&#8217;\u548c&#8217;vcenter&#8217;<\/p>\n\n\n\n<p><strong>RenderTTF(ttfname,text,left,right,bottom,top,color,&#8230;)<\/strong><\/p>\n\n\n\n<p>\u5728\u4e00\u4e2a\u77e9\u5f62\u533a\u57df\u4e2d\u7ed8\u5236\u6587\u5b57\u3002\u53ef\u9009\u53c2\u6570\u8868\u793a\u6587\u5b57\u6392\u5217\u548c\u5bf9\u9f50\u7684\u6a21\u5f0f\uff0c\u53ef\u4ee5\u53d6\u4ee5\u4e0b\u4e00\u4e2a\u6216\u591a\u4e2a\u5b57\u7b26\u4e32\uff08\u6bcf\u884c\u96501\u4e2a\uff09\uff1a<\/p>\n\n\n\n<p>&#8216;left&#8217; &#8216;center&#8217; &#8216;right&#8217;<\/p>\n\n\n\n<p>&#8216;top&#8217; &#8216;vcenter&#8217; &#8216;bottom&#8217;<\/p>\n\n\n\n<p>&#8216;wordbreak&#8217;&nbsp;&#8216;singleline&#8217;&nbsp;&#8216;expantextabs&nbsp;&#8216;noclip&#8217;&nbsp;&#8216;calcrect&#8217;&nbsp;&#8216;rtlreading&#8217;<\/p>\n\n\n\n<p>\u6216\u8005\uff1a<\/p>\n\n\n\n<p>&#8216;paragraph&#8217;\u7b49\u6548\u4e8e\u540c\u65f6\u53d6&#8217;left&#8217;\u3001&#8217;top&#8217;\u548c&#8217;wordbreak&#8217;<\/p>\n\n\n\n<p>&#8216;centerpoint&#8217; \u7b49\u6548\u4e8e\u540c\u65f6\u53d6&#8217;center&#8217;\u3001&#8217;vcenter&#8217;\u548c&#8217;noclip&#8217;<\/p>\n\n\n\n<p><strong>GetTextureSize(texturename)<\/strong><\/p>\n\n\n\n<p>\u8fd4\u56de\u7eb9\u7406\u7684\u5bbd\u548c\u9ad8\u3002<\/p>\n\n\n\n<p><strong>SetImageState(imagename,blendmode)<\/strong><\/p>\n\n\n\n<p><strong>SetImageState(imagename,blendmode,color0)<\/strong><\/p>\n\n\n\n<p><strong>SetImageState(imagename,blendmode,color0,color1,color2<\/strong><strong>,color3<\/strong><strong>)<\/strong><\/p>\n\n\n\n<p>\u8bbe\u7f6e\u56fe\u50cf\u7684\u6df7\u5408\u6a21\u5f0f\u548c\u9876\u70b9\u989c\u8272\u3002\u56fe\u50cf\u5de6\u4e0a\u89d2\u7684\u9876\u70b9\u7f16\u53f7\u4e3a0\uff0c\u987a\u65f6\u9488\u65cb\u8f6c\u7f16\u53f7\u589e\u52a0\u3002\u82e5\u7701\u7565color0\uff0c\u5219\u7ef4\u6301\u539f\u9876\u70b9\u989c\u8272\uff1b\u82e5\u7701\u7565color1\u3001color2\u3001color3\uff0c\u5219\u5c06\u6240\u6709\u9876\u70b9\u7684\u989c\u8272\u90fd\u8bbe\u7f6e\u4e3acolor0\u3002<\/p>\n\n\n\n<p><strong>SetImageCenter(imagename,x,y)<\/strong><\/p>\n\n\n\n<p>\u8bbe\u7f6e\u56fe\u50cf\u7684\u4e2d\u5fc3\u70b9\u3002\u9ed8\u8ba4\u7684\u4e2d\u5fc3\u70b9\u4e3a\u77e9\u5f62\u7684\u4e2d\u5fc3\u3002<\/p>\n\n\n\n<p><strong>SetAnimationState(animationname,blendmode<\/strong><strong>)<\/strong><\/p>\n\n\n\n<p><strong>SetAnimationState(animationname,blendmode,color0)<\/strong><\/p>\n\n\n\n<p><strong>SetAnimationState(animationname,blendmode,color0,color1,color2,color3)<\/strong><\/p>\n\n\n\n<p>\u8bbe\u7f6e\u52a8\u753b\u7684\u6df7\u5408\u6a21\u5f0f\u548c\u9876\u70b9\u989c\u8272\u3002\u56fe\u50cf\u5de6\u4e0a\u89d2\u7684\u9876\u70b9\u7f16\u53f7\u4e3a0\uff0c\u987a\u65f6\u9488\u65cb\u8f6c\u7f16\u53f7\u589e\u52a0\u3002\u82e5\u7701\u7565color0\uff0c\u5219\u7ef4\u6301\u539f\u9876\u70b9\u989c\u8272\uff1b\u82e5\u7701\u7565color1\u3001color2\u3001color3\uff0c\u5219\u5c06\u6240\u6709\u5b9a\u70b9\u7684\u989c\u8272\u90fd\u8bbe\u7f6e\u4e3acolor0\u3002<\/p>\n\n\n\n<p><strong>SetAnimationCenter(animationname,x,y)<\/strong><\/p>\n\n\n\n<p>\u8bbe\u7f6e\u52a8\u753b\u7684\u4e2d\u5fc3\u70b9\u3002\u9ed8\u8ba4\u7684\u4e2d\u5fc3\u70b9\u4e3a\u77e9\u5f62\u7684\u4e2d\u5fc3\u3002<\/p>\n\n\n\n<p><strong>SetImgState(object,blendmode,alpha,red,green,blue)<\/strong><\/p>\n\n\n\n<p>\u8bbe\u7f6e\u5355\u4f4d\u7684img\u7684\u6df7\u5408\u6a21\u5f0f\u548c\u989c\u8272\u3002\u5bf9particle system\u65e0\u6548\u3002<\/p>\n\n\n\n<p><strong>SetFontState(fontname,blendmode)<\/strong><\/p>\n\n\n\n<p><strong>SetFontState(fontname,blendmode,color)<\/strong><\/p>\n\n\n\n<p>\u8bbe\u7f6e\u5b57\u4f53\u7684\u6df7\u5408\u6a21\u5f0f\u548c\u989c\u8272\u3002\u82e5\u7701\u7565color\uff0c\u5219\u7ef4\u6301\u539f\u989c\u8272\u3002<\/p>\n\n\n\n<p><strong>SetFontState2(proportion,rotation,spacing,tracking)<\/strong><\/p>\n\n\n\n<p>\u8bbe\u7f6e\u5b57\u4f53\u7684\u51e0\u4f55\u53c2\u6570\u3002\u6bcf\u4e2a\u53c2\u6570\u5747\u53ef\u4ee5\u4e3anil\uff0c\u8fd9\u6837\u5c06\u88ab\u89c6\u4e3a\u9ed8\u8ba4\u503c\u3002<\/p>\n\n\n\n<p><strong>ParticleStop(unit)<\/strong><\/p>\n\n\n\n<p>\u505c\u6b62\u5355\u4f4d\u7684\u7c92\u5b50\u7279\u6548\u7684\u53d1\u5c04\uff0c\u4e0d\u4f1a\u7acb\u5373\u6e05\u9664\u5df2\u53d1\u5c04\u7c92\u5b50\u3002<\/p>\n\n\n\n<p><strong>ParticleFire(unit)<\/strong><\/p>\n\n\n\n<p>\u6062\u590d\u5355\u4f4d\u7684\u7c92\u5b50\u7279\u6548\u7684\u53d1\u5c04\u3002<\/p>\n\n\n\n<p><strong>ParticleGetn(unit)<\/strong><\/p>\n\n\n\n<p>\u8fd4\u56de\u5355\u4f4d\u7c92\u5b50\u7279\u6548\u7684\u5f53\u524d\u5b58\u6d3b\u7684\u7c92\u5b50\u6570\u3002<\/p>\n\n\n\n<p><strong>ParticleGetEmission(unit)<\/strong><\/p>\n\n\n\n<p>\u8fd4\u56de\u5355\u4f4d\u7c92\u5b50\u7279\u6548\u6bcf\u79d2\u949f\u53d1\u5c04\u7684\u7c92\u5b50\u6570\u3002<\/p>\n\n\n\n<p><strong>ParticleSetEmission(unit,n)<\/strong><\/p>\n\n\n\n<p>\u8bbe\u7f6e\u5355\u4f4d\u7c92\u5b50\u7279\u6548\u6bcf\u79d2\u949f\u53d1\u5c04\u7684\u7c92\u5b50\u6570\u3002<\/p>\n\n\n\n<p>\u6ce8\uff1a\u52a8\u753b\u548c\u7c92\u5b50\u7279\u6548\u4e0d\u80fd\u5355\u72ec\u7ed8\u5236\uff0c\u5fc5\u987b\u901a\u8fc7\u8bbe\u7f6eimg\u5c5e\u6027\u7684\u65b9\u5f0f\u548c\u5355\u4f4d\u7ed1\u5b9a\uff0c\u5e76\u4e14\u7531\u5355\u4f4d\u9ed8\u8ba4\u7684render\u51fd\u6570\u7ed8\u5236\u3002<\/p>\n\n\n\n<p><strong>\u4e94. \u58f0\u97f3\u5904\u7406<\/strong><\/p>\n\n\n\n<p><strong>LoadSound(soundname,filename)<\/strong><\/p>\n\n\n\n<p>\u4ece\u8d44\u6e90\u6587\u4ef6\u4e2d\u52a0\u8f7d\u97f3\u6548\u3002<\/p>\n\n\n\n<p><strong>LoadMusic(musicname,filename,loopend,looplength)<\/strong><\/p>\n\n\n\n<p>\u4ece\u8d44\u6e90\u6587\u4ef6\u4e2d\u52a0\u8f7d\u97f3\u4e50\u3002loopend\u662f\u5faa\u73af\u7684\u7ed3\u675f\u70b9\uff0clooplength\u662f\u5faa\u73af\u957f\u5ea6\uff0c\u5355\u4f4d\u5747\u4e3a\u79d2\u3002<\/p>\n\n\n\n<p><strong>PlaySound(soundname,volume[,pan=0])<\/strong><\/p>\n\n\n\n<p>\u64ad\u653e\u97f3\u6548\u3002pan\u53d6\u503c\u8303\u56f4-1~+1\uff0c-1\u8868\u793a\u6700\u5de6\u8fb9\uff0c+1\u8868\u793a\u6700\u53f3\u8fb9\uff0c0\u8868\u793a\u4e2d\u95f4\u3002<\/p>\n\n\n\n<p><strong>PlayMusic(musicname[,volume=1[,start=0]])<\/strong><\/p>\n\n\n\n<p>\u64ad\u653e\u97f3\u4e50\u3002start\u4e3a\u64ad\u653e\u7684\u8d77\u59cb\u70b9\uff0c\u5355\u4f4d\u79d2\u3002<\/p>\n\n\n\n<p><strong>PauseMusic(musicname)<\/strong><\/p>\n\n\n\n<p>\u6682\u505c\u97f3\u4e50\u3002<\/p>\n\n\n\n<p><strong>ResumeMusic(musicname)<\/strong><\/p>\n\n\n\n<p>\u6062\u590d\u64ad\u653e\u97f3\u4e50\u3002<\/p>\n\n\n\n<p><strong>StopMusic(musicname)<\/strong><\/p>\n\n\n\n<p>\u505c\u6b62\u64ad\u653e\u97f3\u4e50\u3002<\/p>\n\n\n\n<p><strong>GetMusicState(musicname)<\/strong><\/p>\n\n\n\n<p>\u8fd4\u56de\u97f3\u4e50\u7684\u72b6\u6001\u3002\u5982\u679c\u97f3\u4e50\u5df2\u7ecf\u505c\u6b62\uff0c\u5219\u8fd4\u56de&#8217;stopped&#8217;\uff1b\u5982\u679c\u97f3\u4e50\u5904\u4e8e\u64ad\u653e\u72b6\u6001\uff0c\u5219\u8fd4\u56de&#8217;playing&#8217;\u548c\u5f53\u524d\u64ad\u653e\u5230\u7684\u4f4d\u7f6e\uff1b\u5982\u679c\u97f3\u4e50\u5904\u4e8e\u6682\u505c\u72b6\u6001\uff0c\u5219\u8fd4\u56de&#8217;paused&#8217;\u548c\u5f53\u524d\u64ad\u653e\u5230\u7684\u4f4d\u7f6e\uff1b<\/p>\n\n\n\n<p><strong>\u516d. \u952e\u76d8\u8f93\u5165<\/strong><\/p>\n\n\n\n<p><strong>KeyIsDown(keyname)<\/strong><\/p>\n\n\n\n<p>\u5224\u65ad\u67d0\u4e2a\u952e\u662f\u5426\u5904\u4e8e\u6309\u4e0b\u7684\u72b6\u6001\u3002keyname\u662f\u952e\u540d\uff0c\u53ef\u4ee5\u53d6&#8217;up&#8217;\u3001&#8217;down&#8217;\u3001&#8217;left&#8217;\u3001&#8217;right&#8217;\u3001&#8217;slow&#8217;\u3001&#8217;shoot&#8217;\u3001&#8217;spell&#8217;\u3001&#8217;special&#8217;\u4e4b\u4e00\u3002\u6bcf\u4e2a\u952e\u540d\u5177\u4f53\u5bf9\u5e94\u7684\u952e\u7531setting.lua\u51b3\u5b9a\u3002<\/p>\n\n\n\n<p><strong>KeyIsPressed(keyname)<\/strong><\/p>\n\n\n\n<p>\u5224\u65ad\u67d0\u4e2a\u952e\u662f\u5426\u5728\u5f53\u524d\u5e27\u88ab\u6309\u4e0b\u3002\u5373\u4e0a\u4e00\u5e27\u5904\u4e8e\u62ac\u8d77\u7684\u72b6\u6001\uff0c\u5f53\u524d\u5e27\u5904\u4e8e\u6309\u4e0b\u7684\u72b6\u6001\u3002keyname\u662f\u952e\u540d\uff0c\u53ef\u4ee5\u53d6&#8217;up&#8217;\u3001&#8217;down&#8217;\u3001&#8217;left&#8217;\u3001&#8217;right&#8217;\u3001&#8217;slow&#8217;\u3001&#8217;shoot&#8217;\u3001&#8217;spell&#8217;\u3001&#8217;special&#8217;\u4e4b\u4e00\u3002\u6bcf\u4e2a\u952e\u540d\u5177\u4f53\u5bf9\u5e94\u7684\u952e\u7531setting.lua\u51b3\u5b9a\u3002<\/p>\n\n\n\n<p><strong>GetLastKey()<\/strong><\/p>\n\n\n\n<p>\u8fd4\u56de\u6700\u8fd1\u4e00\u6b21\u6309\u952e\u7684key code\u3002<\/p>\n\n\n\n<p><strong>GetLastChar()<\/strong><\/p>\n\n\n\n<p>\u8fd4\u56de\u6700\u8fd1\u4e00\u6b21\u6309\u952e\u7684character code\u3002<\/p>\n\n\n\n<p><strong>GetKeyState(keycode)<\/strong><\/p>\n\n\n\n<p>\u5224\u65ad\u67d0\u4e2a\u952e\u662f\u5426\u5904\u4e8e\u6309\u4e0b\u7684\u72b6\u6001\u3002<\/p>\n\n\n\n<p><strong>\u4e03.\u4efb\u52a1\u7cfb\u7edf<\/strong><\/p>\n\n\n\n<p><strong>task.New(self,f)<\/strong><\/p>\n\n\n\n<p>\u4e3a\u76ee\u6807\u6dfb\u52a0\u4e00\u4e2a\u65b0\u7684\u4efb\u52a1\u3002\u76ee\u6807self\u53ef\u4ee5\u662f\u4efb\u610f\u7684Lua table\u3002f\u662f\u4efb\u52a1\u6d41\u7a0b\u51fd\u6570\u3002<\/p>\n\n\n\n<p>\u6ce8\u610f\uff1atask\u7cfb\u7edf\u4f1a\u5360\u7528\u76ee\u6807table\u7684&#8217;task&#8217;\u57df\uff0c\u6ce8\u610f\u4e0d\u8981\u51b2\u7a81\u3002<\/p>\n\n\n\n<p><strong>task.Do(self)<\/strong><\/p>\n\n\n\n<p>\u4f7f\u76ee\u6807\u7684\u6240\u6709\u4efb\u52a1\u6267\u884c\u4e00\u5e27\u3002<\/p>\n\n\n\n<p><strong>task.Clear(self)<\/strong><\/p>\n\n\n\n<p>\u6e05\u9664\u76ee\u6807\u7684\u6240\u6709\u4efb\u52a1\u3002<\/p>\n\n\n\n<p>\u4e0b\u5217\u51fd\u6570\u53ea\u53ef\u5728\u4efb\u52a1\u6d41\u7a0b\u51fd\u6570\u4e2d\u88ab\u8c03\u7528\uff1a<\/p>\n\n\n\n<p><strong>task.Wait([t=1])<\/strong><\/p>\n\n\n\n<p>\u7b49\u5f85t\u5e27\u3002<\/p>\n\n\n\n<p><strong>task.Until(t)<\/strong><\/p>\n\n\n\n<p>\u53ea\u80fd\u5e94\u7528\u4e8e\u5173\u5361\u548c\u5355\u4f4d\u3002\u7b49\u5f85\u76f4\u5230\u76ee\u6807\u7684timer\u7b49\u4e8et\u3002<\/p>\n\n\n\n<p><strong>task.MoveTo(x,y,t[,mode=0])<\/strong><\/p>\n\n\n\n<p>\u53ea\u80fd\u5e94\u7528\u4e8e\u5355\u4f4d\u3002\u4f7f\u76ee\u6807\u5728t\u5e27\u5185\u4ece\u5f53\u524d\u4f4d\u7f6e\u79fb\u52a8\u5230\u5750\u6807(x,y)\u3002mode\u8868\u793a\u79fb\u52a8\u7684\u6a21\u5f0f\uff0c\u53d6\u503c\u7684\u610f\u4e49\u5982\u4e0b\uff1a<\/p>\n\n\n\n<p>0 \u5300\u901f\uff08\u9ed8\u8ba4\uff09<\/p>\n\n\n\n<p>1 \u52a0\u901f\uff08\u5f00\u59cb\u79fb\u52a8\u65f6\u77ac\u65f6\u901f\u5ea6\u4e3a0\uff09<\/p>\n\n\n\n<p>2 \u51cf\u901f\uff08\u7ed3\u675f\u79fb\u52a8\u65f6\u77ac\u65f6\u901f\u5ea6\u4e3a0\uff09<\/p>\n\n\n\n<p>3 \u5148\u52a0\u901f\u518d\u51cf\u901f\uff08\u5f00\u59cb\u548c\u7ed3\u675f\u79fb\u52a8\u65f6\u77ac\u65f6\u901f\u5ea6\u90fd\u4e3a0\uff09<\/p>\n\n\n\n<p><strong>task.GetSelf()<\/strong><\/p>\n\n\n\n<p>\u8fd4\u56de\u5f53\u524d\u4efb\u52a1\u7684\u6240\u6709\u8005\uff0c\u5373\u8c03\u7528task.New(self,f)\u65f6\u4f20\u5165\u7684self\u3002<\/p>\n\n\n\n<p><strong>\u516b. \u73a9\u5bb6\u6570\u636e<\/strong><\/p>\n\n\n\n<p>LuaSTG\u652f\u6301\u5c06\u73a9\u5bb6\u6570\u636e\uff08\u6bd4\u5982\u901a\u5173\u60c5\u51b5\u3001\u6700\u9ad8\u5206\u7b49\uff09\u5b58\u50a8\u81f3\u786c\u76d8\uff0c\u4e0d\u540c\u7684mod\u548c\u73a9\u5bb6\uff08\u4ee5setting.lua\u4e2d\u7684username\u533a\u5206\uff09\u4e4b\u95f4\u7684\u6570\u636e\u4e0d\u5171\u4eab\uff0c\u5b58\u50a8\u7684\u6587\u4ef6\u4e3ascore\u6587\u4ef6\u5939\u4e0bmod\u540d\u6587\u4ef6\u5939\u4e0b\u7684username.dat\u3002<\/p>\n\n\n\n<p>\u73a9\u5bb6\u6570\u636e\u7684\u8bfb\u5199\u53ef\u901a\u8fc7\u8bfb\u5199scoredata\u8fd9\u4e2aLua\u8868\u6765\u5b9e\u73b0\u3002scoredata\u7684\u6240\u6709key\u7684\u7c7b\u578b\u5fc5\u987b\u662fstring\u6216\u8005number\uff0c\u6240\u6709value\u7684\u7c7b\u578b\u5fc5\u987b\u662f\u9664\u4e86function\u3001userdata\u3001thread\u4e4b\u5916\u7684Lua\u7c7b\u578b\uff0c\u800c\u4e14\u5176\u5b50\u8868\u4e5f\u8981\u6ee1\u8db3\u8fd9\u4e9b\u6761\u4ef6\uff0c\u5426\u5219\u5728\u8bbe\u7f6e\u7684\u65f6\u5019\u5c06\u4f1a\u62a5\u9519\u3002<\/p>\n\n\n\n<p>mod\u52a0\u8f7d\u65f6\u4f1a\u4ece\u786c\u76d8\u8bfb\u53d6\u8fd9\u4e2a\u8868\uff0c\u5982\u679c\u4e0d\u5b58\u5728\uff0c\u5c06\u4f1a\u8bfb\u5165\u4e00\u4e2a\u7a7a\u8868\uff0c\u5e76\u4e14\u5728\u786c\u76d8\u4e0a\u521b\u5efa\u8fd9\u4e2a\u6587\u4ef6\u3002\u6bcf\u6b21\u6539\u53d8scoredata\u8868\u7684\u65f6\u5019\uff0cLuaSTG\u90fd\u4f1a\u81ea\u52a8\u5c06\u5176\u5b58\u50a8\u81f3\u786c\u76d8\u3002<\/p>\n\n\n\n<p><strong>\u4e5d. \u968f\u673a\u6570<\/strong><\/p>\n\n\n\n<p><strong>Rand()<\/strong><\/p>\n\n\n\n<p>\u521b\u5efa\u5e76\u8fd4\u56de\u4e00\u4e2a\u968f\u673a\u6570\u751f\u6210\u5668\uff0c\u79cd\u5b50\u7684\u521d\u59cb\u503c\u4e3a0\u3002<\/p>\n\n\n\n<p>\u968f\u673a\u6570\u751f\u6210\u5668\u7684\u6210\u5458\u51fd\u6570<\/p>\n\n\n\n<p><strong>:Seed(seed)<\/strong><\/p>\n\n\n\n<p>\u8bbe\u7f6e\u968f\u673a\u6570\u751f\u6210\u5668\u7684\u5f53\u524d\u79cd\u5b50\u3002<\/p>\n\n\n\n<p><strong>:Int(a,b)<\/strong><\/p>\n\n\n\n<p>\u968f\u673a\u8fd4\u56de\u4ecb\u4e8ea\u4e0eb\u4e4b\u95f4\uff08\u5305\u62eca\u548cb\uff09\u7684\u6574\u6570\u3002<\/p>\n\n\n\n<p><strong>:Float(a,b)<\/strong><\/p>\n\n\n\n<p>\u968f\u673a\u8fd4\u56de\u4ecb\u4e8ea\u4e0eb\u4e4b\u95f4\uff08\u5305\u62eca\u548cb\uff09\u7684\u6d6e\u70b9\u6570\u3002<\/p>\n\n\n\n<p><strong>:Sign()<\/strong><\/p>\n\n\n\n<p>\u7b49\u6982\u7387\u7684\u968f\u673a\u8fd4\u56de-1\u6216+1\u3002<\/p>\n\n\n\n<p>\u5728LuaSTG\u4e2d\uff0c\u5df2\u5b9a\u4e49\u597d\u4e00\u4e2a\u968f\u673a\u6570\u751f\u6210\u5668ran\uff0c\u53ef\u4ee5\u76f4\u63a5\u901a\u8fc7\u8c03\u7528<strong>ran:Int(a,b)<\/strong>\u3001<strong>ran:Float(a,b)<\/strong>\u3001<strong>ran:Sign()<\/strong>\u5f97\u5230\u968f\u673a\u6570\u3002<\/p>\n\n\n\n<p><strong>\u5341. \u5176\u4ed6<\/strong><\/p>\n\n\n\n<p><strong>Print(&#8230;)<\/strong><\/p>\n\n\n\n<p>\u540cLua\u7684print\u51fd\u6570\uff0c\u4f46\u662f\u4f1a\u5c06\u5185\u5bb9\u540c\u65f6\u8f93\u51fa\u5230\u547d\u4ee4\u884c\u548clog.txt\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\uff0e\u7efc\u8ff0 LuaSTG\u662f\u57fa\u4e8ehge\u4ee5Lua\u4f5c\u4e3a\u6269\u5c55\u811a\u672c\u7684\u5f39\u5e55\u5c04\u51fb\u6e38\u620f\u5f15\u64ce\u3002 \u65b0\u5efa\u5e76\u8fd0\u884c\u7b2c\u4e00\u4e2a\u5de5\u7a0b\u3002 \u9996\u5148\u5728mo [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"h5ap_radio_sources":[]},"categories":[7,6],"tags":[],"_links":{"self":[{"href":"https:\/\/www.tom4kg.life\/index.php?rest_route=\/wp\/v2\/posts\/175"}],"collection":[{"href":"https:\/\/www.tom4kg.life\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tom4kg.life\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tom4kg.life\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tom4kg.life\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=175"}],"version-history":[{"count":2,"href":"https:\/\/www.tom4kg.life\/index.php?rest_route=\/wp\/v2\/posts\/175\/revisions"}],"predecessor-version":[{"id":180,"href":"https:\/\/www.tom4kg.life\/index.php?rest_route=\/wp\/v2\/posts\/175\/revisions\/180"}],"wp:attachment":[{"href":"https:\/\/www.tom4kg.life\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=175"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tom4kg.life\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=175"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tom4kg.life\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=175"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}