C .
ODE
G
AMELET
# TwilightWarsLib A Top-down view shooting game framework. ## Getting Started These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. To start a .event ```typescript CG.TwilightWarsLib.initialize() .then(() => { CG.TwilightWarsLib.events.startEvents('test/test.events', 'arena'); }) ``` To manually setup the game: ```typescript CG.TwilightWarsLib.initialize() .then(() => let mapSource = 'test/test.twmap'; CG.Base.resourceManager.addAppSource(mapSource); CG.Base.resourceManager.load(() => { let mapResource = new CG.TWMap.resources.MapResource(); mapResource.importBase64(CG.Base.resourceManager.getText(mapSource)); mapResource.loadTextures(() => { CG.Base.pixi.initialize(600, 500); let game = new CG.TwilightWarsLib.games.Game(); CG.Base.pixi.root.addChild(game); game.initResources(mapResource); game.start(); console.log('tw game created'); let me = new CG.TwilightWarsLib.games.actors.Actor(game, 'me'); game.addActor(me, new MyActorController(me), 32, 100, 0, null); game.gameCamera.setFocus(me); game.interface.setMe(me); let ai = new CG.TwilightWarsLib.games.actors.Actor(game, 'ai'); ai.camp = CG.TwilightWarsLib.games.datas.Camp.CAMP2; ai.actorClip.headClip.clip.gotoAndStop(5); game.addActor(ai, new CG.TwilightWarsLib.games.actors.controllers.AIController(ai), 160, 300, 0, null); game.createStuff(null, 64 + 16, 128 + 16, CG.TwilightWarsLib.games.items.StuffInfo.getByCode('sword'), game.stuffManager.useNextStuffId(), true); }); }); }) ``` ## Versioning We use [SemVer](http://semver.org/) for versioning. ## Authors * **[Haskasu](/profile/Haskasu)** ## Acknowledgments * Hat tip to anyone who's code was used * Inspiration * etc
# CgEventsExp 本模組用於 CG 編輯器的擴充。 可至專案內 **Test** 資料夾,查看各動作、檢查的範例。 ### 動作 - 更新 - 顯示 - 更新文字 - 更新顯示物件 - 更新畫面遮罩 - 攝影機 - 設置攝影機焦點 - 系統 - 控制台輸出 - 儲存Cookies - 讀取Cookies - 開啟URL - 取得日期 - 輸出檔案 - 上傳檔案 - 設置 Debug 控制台 - 呼叫函數 - 彈出視窗 - 彈出確認視窗 - 彈出選項視窗 - 彈出輸入視窗 - 彈出複製字串視窗 - 彈出載入視窗 - 關閉彈出視窗 - 彈出複數字串輸入視窗 - PIXI 視窗 - 顯示自訂義 PIXI 視窗 - 關閉自訂義 PIXI 視窗 - 背包視窗 - 顯示背包視窗 - 更新背包視窗 - 變數 - 儲存區域變數 - 儲存全域變數 - 複數儲存區域變數 - 複數儲存全域變數 - 複數儲存物件變數 - 儲存 Json 變數 - 補間動畫 - 數學 - 計算兩點距離 - 函數 - Array.splice() - Array.slice() - Array.concat() - JSON.stringify() - JSON.parse() - Object.keys() - Window.btoa() - Window.atob() - String.split() - 音效 - 加載 URL 音訊 - 播放 URL 音效 - 設置 URL 音樂 - 音效濾鏡 - 播放音效 - 特效 - 文字特效 - 逐字動畫 - 文字捲動動畫 - 滾動文字特效 - 特殊工具 - 背包 - 設置背包 - 設置物品 - 設置背包物品 - 取得背包資料 - 整理背包 - 伺服器 - 狀態 - 儲存玩家狀態 - 取得玩家狀態 - 儲存玩家狀態 - 使用者名稱 - 取得玩家狀態 - 使用者名稱 - 分數 - 取得分數 - 上傳分數 - 使用者 - 取得使用者 - 道具 - 隱藏我的背包 - 事件 - 觸發事件 - 權重觸發事件 - 移除 - 移除物件 - 移除全域變數 - Base - 資源管理器 - 取得文字 - 取得 JSON - 隨機數產生器 - 設置隨機數產生器 - 使用隨機數產生器 - 柏林噪聲 - 設置柏林噪聲 - 使用一維柏林噪聲 - 使用二維柏林噪聲 - 使用三維柏林噪聲 ### 觸發 - 彈出視窗 - 視窗確認 - 視窗關閉 - PIXI 視窗 - 按下 PIXI 自訂義視窗 - 背包視窗 - 背包視窗選擇 ### 檢查 - 虛擬工具 - 背包 - 檢查背包 - 迴圈 - For Index - For...in - 變數 - 檢查物件函數結果 - 檢查物件屬性數量 ## 作者 **[cook1470](/profile/cook1470)** ### **[More modes](/profile/[email protected])** # CgEventsExp The engine of CgEvents. You can go to the Test folder in the project to view examples of actions and inspections. ### Actions - Update - Display - Update Text - Update Display - Update Root Mask - Camera - Camera Set Focus - System - Console - Set Cookies - Get Cookies - Open Url - Get Date - Export File - Upload File - Set Debug Console - Call Function - Dialogs - Show Confirm Dialog - Show Select Dialog - Show Input Dialog - Show Copy String Dialog - Show Loading Dialog - Close Dialog - Show Inputs Dialog - PIXI Dialog - Show Custom PIXI Dialog - Close Custom PIXI Dialog - Backpack Dialog - Show Backpack Dialog - Update Backpack Dialog - Variable - Set Local - Set Global - Set Local Array - Set Global Array - Set Object Array - Set Json - Tween - Math - Distance Formula - Functions - Array.splice() - Array.slice() - Array.concat() - JSON.stringify() - JSON.parse() - Object.Keys() - Window.btoa() - Window.atob() - String.split() - Sound - Load URL Sound - Play URL Sound - Set URL Music - Sound Filter - Play Sound - Effects - Text - Typing Animation - Text Scrolling Animation - Scrolling Text Effect - Special Tools - backpack - Set Backpack - Set Item - Bag Set Item - Get Backpack - Sort Backpack - Server - State - Set User State - Get User State - Set Username State - Get Username State - Scores - Get Score - Submit Score - User - Get User - Items - Hide Backpack - Event - Trigger Event - Weight Trigger Event - Remove - Remove Object - Remove Global Var - Base - Resource Manager - Get Text - Get JSON - Random Generator - Set Random Generator - Use Random Generator - Perlin Noise - Set Perlin Noise - Use 1D Perlin Noise - Use 2D Perlin Noise - Use 3D Perlin Noise ### Triggers - Dialogs - Dialog Confirm - Dialog Close - PIXI Dialog - PIXI Button Dialog Confirm - Backpack Dialog - Backpack Dialog Select ### Checks - Special Tools - backpack - Check Backpack - Loop - For Index - For...in - variable - Check Object Function Result - Check Object Properties Count
# TwilightWarsEventsExp 本專案為光暈戰記的擴充模組,主要是建立在 **[TwilightWarsLib](/edit/TwilightWarsLib)** 的基礎之上,添加一些小東西。本專案並不包含 **[TwilightWarsEvents](/edit/TwilightWarsEvents)** 模組。 本模組並不會覆蓋原有的動作、檢查,所有本模組新增的檢查、動作等,都會被整合在**光暈戰記 / 擴充包**內,且不會新增任何跟光暈無關的檢查或動作,希望是一個純淨的光暈模組,跟光暈無關的相關事件,有需要的話會在 **[CgEventsExp](/edit/CgEventsExp)** 做更新。 本專案開放查詢原始碼,所有的檢查、動作,皆有在本專案的 **Test** 資料夾內做實際範例,歡迎自行查看使用方法,也歡迎自行進入程式區內,看各個檢查、動作是如何完成。 本人希望弄一個可以讓大家互相交流、維護,甚至更新的這麼一個光暈同人模組,我覺得這樣共同成長,才會讓嘎母變得更成熟,所以如果你有什麼好想法,也都歡迎提供給我。 另外個人創了一個第三方的 **[嘎母討論區(Discord)](https://discord.gg/hZKQzRfPJM)** ,主要是希望大家有一個好的交流平台,可以一起討論一些設計,除了光暈,還有其他非光暈的專案等等,甚至是能夠一起合作,讓作者們有機會推出更多優質的作品。 有任何 BUG 的話都歡迎回報,會盡量在最短的時間內處裡掉。 **[Google 試算表 - 光暈戰記](https://docs.google.com/spreadsheets/d/1kRPdI6caisjZuHJGmCjB3kHBveR2RVAeTJoyCmqOZVs/edit?usp=sharing)** 本專案有些需要查詢的地方,例如武器道具的索引值等等,可以由此試算表查詢。 @ - 不支援開放式遊戲室、觀戰系統,可能會造成加入遊戲室者、觀戰者遊戲卡住。 ## 事件表工具 - ImageIndex 查詢器 ## 動作 - 角色 - 新增角色 - 角色說話 - 清除角色對話 - 角色持有金幣 - 取得角色屬性 - 角色發動攻擊 - 角色跳至定點 - 取得角色身體動畫 - 設定角色身體動畫 - 移動角色位置 - 角色重生位置 - 人物走至定點 - 人物面向 - 設定AI參數 - 範圍傷害/治療 - 角色設置彈匣 - 替換角色部件 - 跟隨人物 - 尋找前往目標 - 角色加減血 - 人物裝備武器 - 施展技能 - 取得擊殺數 - 角色切換主副手 - 集氣並施展技能 - 角色丟棄當前武器道具 - 角色賺取分數 - 替換角色身體動畫物件 - 行為 - 搖頭 - 閃現 - 控制器 - 大腦 - 設置 AI 腦中移動狀態 - AI 大腦觸發事件 - 任務流程 - 任務完成 - 任務失敗 - 遊戲繼續 - 遊戲暫停 - 略過事件按鈕 - 設定遊戲規則 - 特效 - 新增標題文字 - 移除特效 - @自訂動態特效 - 自訂動態特效說話 - 進度條特效 - 操控進度條 - 角色 - 角色濾鏡 - 眼冒金星特效 - @集氣特效 - 初始人物色調 - 外流生命值特效 - 影分身特效 - 角色頭特效 - 技能 - 光彈特效 - 震地特效 - 衝擊波特效 - 設置角色燃燒 - 噴射火焰 - 黑龍 - 黑龍波 - 血爆特效 - 炸彈爆炸特效 - 地圖 - 視野縮放 - 爆炸特效 - 塵土飛楊特效 - 治療特效 - 散發光環特效 - 飛濺特效 - 爆炸痕跡特效 - @自訂地圖特效/貼圖 - 移除地圖特效/貼圖 - @自訂特效/貼圖濾鏡 - 新增地圖動畫 - 操控地圖動畫 - 隨機取得可行走座標 - 火焰燃燒特效 - 煙霧上升特效 - 煙火特效 - 地圖冰凍特效 - 基礎飛鳥特效 - 快跳文字特效 - 替身木樁特效 - 畫面 - 畫面遮色 - 畫面濾鏡 - 下雨特效 - 打雷特效 - 目標提示特效 - 魄力標題動畫特效 - 武器道具 - 新增武器道具 - 新增可拾取道具 - 取得骰子點數 - 發射火箭 - 設定道具屬性 - 移除地板武器道具 - 修復盾牌 - 建立遠程武器資料 - 地圖 - 取得滑鼠相對位置 - 增加可走區域 - 新增地圖標示文字 - 移除地圖標示文字 - 新增地圖物件 - 移除地圖物件 - 新增地圖標示箭頭 - 取得地勢高度 - 取得隨機座標 - 路徑搜尋 - 地圖物件說話 - 設定地圖格子 - 設定臨時地圖格子 - 移除可走區域 - 地圖機關 - 新增燭火 - 新增拉桿開關 - 新增告示牌 - 新增可推石塊 - 新增淹水機關 - 操作拉桿開關 - 系統 - 離開遊戲 - 下一場遊戲 - 執行光暈事件表 - 音訊 - 播放光暈戰記音效 - 設置光暈戰記音樂 - 特殊工具 - 數據化地圖 - 新增數據化地圖核心 - 新增數據化地圖資料 - 移除數據化地圖資料 - 取得數據化地圖物件 - 更新數據化地圖區域大小 - 生成數據化地圖 - 儲存數據化地圖至 Cookies - 從 Cookies 讀取數據化地圖 - 角色錄製 - 開始錄製 - 停止錄製 - 開始播放 - 計算 - 計算角色位置 - 視窗 - 任務提示視窗 - 初始化任務提示視窗 - 設置任務提示格內容 ## 檢查 - 角色 - 角色位置 - 角色數值比較 - 人物面向 - 角色所在區域 - 說話內容 - 角色狀態 - 角色離開玩家視線 - 地圖 - 可行走座標 - 滑鼠位置 - 檢查地勢高度 - 可通過路徑 - 可通過路徑(路徑搜尋) - 找出所有座標 - 武器道具 - 骰子點數 - 特效 - 自訂動態特效位置 - 自訂動態特效所在區域 ## 觸發 - 角色 - 角色進入戰場 - 角色死亡 - 角色發動攻擊 - 角色受傷 - 角色座標改變 - 地圖機關 - 拉桿開關 - 告示牌按鈕 - 特效 - 自訂動態特效撞到障礙物 - 自訂動態特效碰到角色 - 自訂動態特效抵達目的地 - 自訂動態特效時間到 - 技能 - 黑龍消失 - 武器道具 - 拾取武器道具 - 掉落武器道具 - 骰子點數 ## 作者 **[cook1470](/profile/cook1470)** ### **[More modes](/profile/[email protected])**
# 花靈宮模組 - 作者 **[妮娜](/profile/[email protected])** - 使用此模組為你的專案增加新的陣營和技能 - 注意電腦AI使用技能時有機會比較蠢 - 過快使用技能將會有概率出BUG - 此為測試版本,有BUG很正常 - 查詢及回報請到<b><a href="https://gamelet.online/user/nina/board">我的留言板</a></b> ## 目前提供支援的有: <table> <tr> <td> <h3><center>花靈宮<center></h3> <table width=280px> <tr> <th> <font color=#ee8800>陣營全稱</font> </th> <td> <center>花靈宮</center> </td> </tr> <tr> <th> <font color=#ee8800>陣營簡稱</font> </th> <td> <center>花靈</center> </td> </tr> <tr> <th> <font color=#ee8800>陣營圖標</font> </th> <td> <center><img src="https://i.imgur.com/10wgzRS.png" width=36px height=36px></center> </td> </tr> <tr> <th> <font color=#ee8800>陣營代碼</font> </th> <td> <center>fairy</center> </td> </tr> <tr> <th> <font color=#ee8800>陣營ID</font> </th> <td> <center>4</center> </td> </tr> </table> <br> <table width=280px> <tr> <th> <font color=#ee8800>武器</font> </th> <th> <font color=#56db9b>第一級技能</font> </th> <th> <font color=#60CFEA>第二級技能</font> </th> </tr> <tr> <th> <font color=#ee8800>小刀</font> </th> <td> <center><font color=#56db9b>自然庇祐</font></center> </td> <td> <center><font color=#60CFEA>迷情之風</font></center> </td> </tr> <tr> <th> <font color=#ee8800>雙爪</font> </th> <td> <center><font color=#56db9b>花影迷蹤</font></center> </td> <td> <center><font color=#60CFEA>霧隱遁音</font></center> </td> </tr> <tr> <th> <font color=#ee8800>大刀</font> </th> <td> <center><font color=#56db9b>霜寒之鋒</font></center> </td> <td> <center><font color=#60CFEA>永恆凍土</font></center> </td> </tr> <tr> <th> <font color=#ee8800>冰劍</font> </th> <td> <center><font color=#56db9b>冰凝霧</font></center> </td> <td> <center><font color=#60CFEA>雪光斬</font></center> </td> </tr> <tr> <th> <font color=#ee8800>水晶弓</font> </th> <td> <center><font color=#56db9b>虹彩弦</font></center> </td> <td> <center><font color=#60CFEA>虹彩環</font></center> </td> </tr> </table> </td> <td> <h3><center>盜賊幫</center></h3> <table width=280px> <tr> <th> <font color=#ee8800>陣營全稱</font> </th> <td> <center>盜賊幫</center> </td> </tr> <tr> <th> <font color=#ee8800>陣營簡稱</font> </th> <td> <center>盜賊</center> </td> </tr> <tr> <th> <font color=#ee8800>陣營圖標</font> </th> <td> <center><img src="https://code.gamelet.com/gassets/resource/6738342fc7e884e51987674c69dc5bb5/iconThief.webp?ide" width=36px height=36px></center> </td> </tr> <tr> <th> <font color=#ee8800>陣營代碼</font> </th> <td> <center>thief</center> </td> </tr> <tr> <th> <font color=#ee8800>陣營ID</font> </th> <td> <center>5</center> </td> </tr> </table> <br> <table width=280px> <tr> <th> <font color=#ee8800>武器</font> </th> <th> <font color=#56db9b>第一級技能</font> </th> <th> <font color=#60CFEA>第二級技能</font> </th> </tr> <tr> <th> <font color=#ee8800>小刀</font> </th> <td> <center><font color=#56db9b>障眼法</font></center> </td> <td> <center><font color=#60CFEA>夜襲</font></center> </td> </tr> <tr> <th> <font color=#ee8800>雙爪</font> </th> <td> <center><font color=#56db9b>再生術</font></center> </td> <td> <center><font color=#60CFEA>血祭</font></center> </td> </tr> <tr> <th> <font color=#ee8800>大刀</font> </th> <td> <center><font color=#56db9b>落雷砍</font></center> </td> <td> <center><font color=#60CFEA>雷池</font></center> </td> </tr> <tr> <th> <font color=#ee8800>冰劍</font> </th> <td> <center><font color=#56db9b>鬼火</font></center> </td> <td> <center><font color=#60CFEA></font></center> </td> </tr> <tr> <th> <font color=#ee8800>水晶弓</font> </th> <td> <center><font color=#56db9b>燃苗</font></center> </td> <td> <center><font color=#60CFEA></font></center> </td> </tr> </table> </td> </tr> </table> ### 觸發 - 暫無 ### 檢查 - 技能/角色技能狀態 - 角色/角色狀態 ### 動作 - 跳出系統訊息 - 工作階段儲存空間數據庫存取 - 以符號分離字串 - 定義Json變數 - 轉換Json為字串 - 轉換Json為物件 - 角色/設定陣營暱稱 - 角色/新增角色 - 技能/角色使用技能 - 技能/角色結束技能 - 技能/限制使用技能
# CgEventsLib The engine of CgEvents. CgEvents is a great way to build your own games with with a CG.built-in editor. ## Live Demo <a href="cg://source/test/physics.events" class="mat-raised-button mat-primary">Open Demo Events Sheet</a> ## Concept The engine takes a *.events file to run. The .events file is an encoded json which contains a config field and a events field. ```json { config: { stage: { width: "number", height: "number", resolutionPolicy: "showAll" | "exactFit" | "fixedWidth" | "fixedHeight" | "origin", alignHorizontal: "left" | "center" | "right", alignVertical: "top" | "middle" | "bottom" } }, events: [ { id: "string", triggers: [], checks: [], actions: [] }, ... ] } ``` Yon can edit the json with CG.built-in editor to control all your game events. ## How Events Work Each event contains a TRIGGER, some CHECKS, and some ACTION. The event flow works like this: 1. The TRIGGER of the event is triggered by the engine (keyboard pressed, event over, or maybe the hero collides with an enemy) 1. Once the trigger is triggered, the engine then goes check the CHECKS. 1. If all CHECKS pass, the engine executes all the ACTIONS in the event. ## Getting Started ```typescript let manager = new CgEventManager(); manager.importFromSource('CG.YourProject/yourGame.events') .then(() => manager.preload()) .then(() => manager.start()) ; ``` ## Versioning We use [SemVer](http://semver.org/) for versioning. ## Authors * **[Haskasu](/profile/Haskasu)**
# CG.Base Provide tool kits that helps you fast build an app on Code.Gamelet. Key features include: 1. initialize [pixi.js](#pixi.init) environment 1. load and access resources that are imported via Code.Gamelet IDE 1. manage update functions that are called every frame 1. provide debug utilities ## Getting Started Follow the steps below to fast start an app with [PixiJS](#pixi.init). We will implement a box2d environment to demo the usage of Base. <a name="pixi.init"></a> ## Start with Pixi.js<a name="pixi.init"></a> ```typescript class App { constructor() { // initialize pixi CG.Base.pixi.initialize(600, 400); CG.Base.pixi.physicsDebugDraw.setActive(true); // make a physics wall var wall = CG.Base.physics.createPhysicsObject('wall', {type: 'static'}); wall.addEdge(new CG.Base.geom.Point(10, 300), new CG.Base.geom.Point(500, 330)); // make a dynamic physics ball var ball = CG.Base.physics.createPhysicsObject('ball', {type: 'dynamic'}); ball.addCircle(0, 0, 10, {friction: 0.1, density: 0.1, restitution: 0.3}); ball.setPosition(100, 10); } } new App(); ``` @see [Demo](/edit/Base_Start_with_PIXI) ## Load and play with Resources To load resources that are imported from IDE: ```typescript // tell resources what resources to load (using the alias names) CG.Base.resourceManager.addAppResource('Game1.button'); CG.Base.resourceManager.addAppResource('Game1.music'); // start loading CG.Base.resourceManager.load(() => { // all loaded callback // create button with the image "Game1.button" alias name var button = new CG.Base.pixis.interactive.Button(CG.Base.resourceManager.createPixiSprite('Game1.button', 20, 20)); // set the position of the button button.displayObject.position.set(100, 100); // add the button to pixi.root, so pixi can render the button CG.Base.pixi.root.addChild(button.displayObject); // add a click event listener button.on(CG.Base.pixis.interactive.Button.EVENT.CLICK, () => { // when the button is clicked, play sound with "Game1.music" alias name CG.Base.resourceManager.playSound('Game1.music') }); }); ``` @see [Demo](/edit/Base_Load_Resources) ## Manage update functions Take advantage of CG.Base.addUpdateFunction to make a function called every frame ```typescript class App { constructor() { CG.Base.pixi.initialize(600, 400); CG.Base.addUpdateFunction(this, this.update); } // this function will be called every frame(called 60 times per second normally) private update(deltaTime:number):void { // do something } } new App(); ``` @see [Demo](/edit/Base_Update_and_Delay_Func) You can call a function in the future by CG.Base.addDelayFunction ```typescript class App { constructor() { CG.Base.pixi.initialize(600, 400); // call this.delayAction in 1000 milliseconds(= one second) CG.Base.addDelayFunction(this, this.delayAction, 1000); } private delayAction():void { // do something } } new App(); ``` @see [Demo](/edit/Base_Update_and_Delay_Func) ## Interact with Keyboard Use CG.Base.keyboard package to interact with keyboard events. ```typescript export class App { constructor() { // make the window focused, so we can receive keyboard events. window.focus(); // initialize pixi CG.Base.pixi.initialize(600, 400); // tell resourceManager to load the resource 'Game1.button' CG.Base.resourceManager.addAppResource('Game1.button'); // load resources, and wait callback when resources are all loaded CG.Base.resourceManager.load(() => { // add keyboard event listener, when a key is pressed CG.Base.keyboardManager.on(CG.Base.keyboard.KeyboardManagerEvent.PRESSED, key => { // if the pressed key is space, we call this.createSprite() if (key == CG.Base.keyboard.Key.SPACE) { this.createSprite(); } }); }); } private createSprite(): void { // create a sprite with the image 'Game1.button' var sprite: PIXI.Sprite = CG.Base.resourceManager.createPixiSprite('Game1.button'); // set the position of the sprite sprite.position.set(CG.Base.utils.IntUtil.randomBetween(100, 500), CG.Base.utils.IntUtil.randomBetween(100, 300)); // add the sprite to pixi.root, so it can be rendered CG.Base.pixi.root.addChild(sprite); } } new App(); ``` @see [Demo](/edit/Base_PIXI_Keyboard) ## Debugging The best debug tool on browser is the [developer tools](https://developer.chrome.com/devtools) in Chrome (F12). To find your source code in developer tools, first open developer tools(F12), click "Sources" tab, and search the Network tree as below: > top => {projectCode} => gameFrame => code.gamelet.com => gassets => file/{projectCode}/src for example, if the projectCode is 'Game1', source code is located at > top => Game1 => gameFrame => code.gamelet.com => gassets => file/Game1/src ![Source Network Tree](https://code.gamelet.com/gassets/asset/Base/Base.networktree/networktree.png "Source Network Tree") ### Add Watch In addition to browser's debugging tools, CG.Base provides other useful tools. CG.Base.addWatch() adds objects or objects' properties to Watch panel in CG IDE. ```typescript export class App { constructor() { // initialize pixi CG.Base.pixi.initialize(600, 400); // tell resourceManager to load the resource 'Game1.button' CG.Base.resourceManager.addAppResource('Game1.button'); CG.Base.resourceManager.load(() => { // add the created sprite into Watch panel, the alias name in Watch panel is 'sprite' CG.Base.addWatch('sprite', this.createSprite()); }); // add this(App)'s 'time' property into Watch panel. The alias name for this property is 'now' CG.Base.addWatch('now', this, 'time'); } private createSprite(): PIXI.Sprite { // create a sprite with the image 'Game1.button' var sprite: PIXI.Sprite = CG.Base.resourceManager.createPixiSprite('Game1.button'); // set the position of the sprite sprite.position.set(CG.Base.utils.IntUtil.randomBetween(100, 500), CG.Base.utils.IntUtil.randomBetween(100, 300)); // add the sprite to pixi.root, so it can be rendered CG.Base.pixi.root.addChild(sprite); return sprite; } // a getter function, that works like a property of App object. get time(): number { return CG.Base.time(); } } new App(); ``` @see [Demo](/edit/Base_Add_Watch) ## Versioning We use [SemVer](http://semver.org/) for versioning. ## Links and Resources This library is running with the libraries below. * [Pixi.js](http://www.pixijs.com/) - 2D rendering engine * [API reference](http://pixijs.download/release/docs/index.html) * [Examples](http://pixijs.io/examples/) * [Pixi keyboard](https://github.com/Nazariglez/pixi-keyboard) - Keyboard utility * [Pixi sound](https://github.com/pixijs/pixi-sound) - Sound utility * [Pixi filters](https://github.com/pixijs/pixi-filters) - Filters Collections * [Pixi GafPlayer](https://github.com/mathieuanthoine/PixiGAFPlayer) - [GafMedia](https://gafmedia.com/) Player * [Liquidfun](http://google.github.io/liquidfun/) - Box2D based physics engine * [MD5](http://www.myersdaily.org/joseph/javascript/md5-text.html) - MD5 implementation by Joseph Myers ## Authors **Haska Su** - *Initial work*
# 瓦片地圖引擎(TilemapEngine) 瓦片地圖,是由一格一格的方塊所組成,本模組提供了簡單的函示庫,可以快速的渲染出一個瓦片地圖。 ## 讓我們開始吧! 本模組結合了 CgEventsEngine(CG事件表引擎),提供一些簡單的事件表動作,若不寫程式的話,也可以進行一些基本的操作。 ### 如何開始? 一般專案在新建完成後,都一定會有一個叫做 app.ts 的檔案,寫程式的位置如下表示。 ```typescript export class App { constructor() { // 程式寫在這裡,例如: console.log("Hello CG.") } } export const APP = new App(); ``` ### 創建瓦片地圖 以下為創建瓦片地圖,並將其顯示到舞台中的程式範例。 ```typescript // 新增一個瓦片地圖的資源物件。 let mapResource = new TilemapResource(); // 新增地圖的圖片資源到資源物件中,並且等待瀏覽器加載完成。 mapResource.addTileset('TileMapEngine.image.FD_Free_Tiles') .loadTileset(() => { // 加載完後才會開始做這裡的事情。 // 初始化舞台大小。 CG.Base.pixi.initialize(600, 600); // 將地圖資源初始化一個空地圖,長寬為 10x10,瓦片大小為 48,圖層有 3 個。 mapResource.emptyMap(10, 10, 48, 3); // 把圖層 0 的所有瓦片換成瓦片集 0 中,第 3 個瓦片。 mapResource.setLayerAllTile(0, 0, 3); // 新增一個瓦片地圖,並使用剛剛的地圖資源。 let tilemap = new Tilemap(mapResource); // 將瓦片地圖放置到舞台中。 CG.Base.pixi.root.addChild(tilemap); }) ``` ### 匯出地圖資料 地圖資源的資料,可以使用函數來匯出 JSON,並且將其下載成檔案。 ```typescript // 將地圖資料匯出成 JSON,並下載成檔案。 let json = mapResource.exportJson(); let element = document.createElement('a'); element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(JSON.stringify(json))); element.setAttribute('download', 'map' + '.' + 'json'); // map 為檔案名稱, json 為副檔名,皆可隨意定義。 document.body.appendChild(element); element.click(); document.body.removeChild(element); ``` ### 匯入地圖資料 除了生成空白地圖,也可使用檔案匯入地圖資料來生成以前儲存的地圖。 ```typescript let mapResource = new TilemapResource(); // 定義地圖資源路徑。 let mapSource = 'test/map.json'; // 使用 resourceManager 匯入專案資源,後方填入地圖資源路徑。 CG.Base.resourceManager.addAppSource(mapSource); mapResource.addTileset('TileMapEngine.image.FD_Free_Tiles') .loadTileset(() => { CG.Base.pixi.initialize(600, 600); // 使用 resourceManager 取得專案資源的 JSON,並將其匯入地圖資源中。 let json = CG.Base.resourceManager.getJSON(mapSource); mapResource.importJson(json); let tilemap = new Tilemap(mapResource); CG.Base.pixi.root.addChild(tilemap); }) ``` ### 編輯地圖屬性、材質 若要以程式對瓦片地圖進行編輯,可參考下列簡易的示範。 其餘更多函示詳細說明,皆有在函示上進行備註,可自行參閱。 ```typescript // 設定座標 (1,2) 的 height 屬性為 1 mapResource.setTileAttribute(1, 2, 'height', 1); // 讀取座標 (1,2) 的 height 屬性,儲存在 height 這個變數中。 let height = mapResource.getTileAttribute(1, 2, 'height'); // 於控制台輸出() 內的內容。 console.log("座標 (1,2) 的高度為 " + height); // 座標 (1,2) 的高度為 1 // 設定圖層 0 座標 (2,2) 的瓦片為,瓦片集 0 中的第 2 個瓦片。 mapResource.setLayerTile(0, 2, 2, 0, 2); tilemap.reRender(); // 重新渲染瓦片地圖。 ``` ## Authors **[cook14709](/profile/cook14709)**
# 光暈戰記 RPG 模組包(TwilightWarsRPGEvents) 此專案為 **[TwilightWarsLib](/edit/TwilightWarsLib)** 的 RPG 功能擴充模組。 大量自訂義的資料型態,搭配少量光暈本身的功能,主要是為了省略在光暈製作一個 RPG 任務時,還要先用一堆事件來製作相關系統、功能的步驟,而誕生的模組。 本專案的所有功能,皆是建立在任務為開放式房間、可多人遊玩,且可跨事件表的前提下製作,也就是說整個專案共用同一個玩家資料,故如果要製作更多不同的 RPG 任務,請另建新的專案製作。 有任何問題或 BUG,歡迎於討論區提出、回報。 <font color=red>**安裝此模組後,事件表會增加一些變數保留字,請避免在宣告全域變數時,使用下列名稱:**</font> **itemInfo, questInfo, {玩家代碼}_quests, {玩家代碼}_inventories, {玩家代碼}_equipmentSlot, {玩家代碼}_datas** # 主要功能介紹 - [存讀檔功能](#存讀檔功能) <font color=grey>*ps.自動存檔、本機存/讀檔*</font> - [任務系統](#任務系統) - [自訂道具](#自訂道具) - [背包/裝備欄](#背包/裝備欄) - [跨事件表傳送](#跨事件表傳送) ## 存讀檔功能 本專案所有會更動玩家資料的動作,在變更玩家資料後,皆會**自動將資料儲存到專案資料庫**中。 專案任務作者只需要在玩家進入戰場後,使用動作來讀取資料即可,原則上並不需要考慮存檔的問題。 若有需要,本模組也提供於本機存讀檔的功能,但不建議使用於多人遊戲中,且讓玩家可以於本機存讀檔,可能會增加玩家隨意更改資料的風險。 提供可自訂玩家資料的功能,可設定例如等級、經驗值、金錢、稱號等屬性,修改數值時會自動存檔,也可隨時使用變數讀取數值。 ```typescript // 假設儲存玩家的代碼為 instance {instance.code}_datas // 使用此變數名稱可以得到該玩家的所有自訂資料。 // 於後方加上 .資料名稱 即可取得該自訂資料的數值,例如: {instance.code}_datas.level // 可以取得該玩家,自訂資料 level 的數值。 {instance.code}_datas.money // 可以取得該玩家,自訂資料 money 的數值。 ``` ## 任務系統 提供可以**儲存玩家任務狀態**的功能,每個任務皆需要有不同的任務代碼,而主要的任務狀態有「未接取」、「進行中」、「已完成」。 每個任務在玩家進行中的狀態時,皆還可以**設定任務的進度**,進度的數量沒有限制,且也可以自訂進度的名稱,以及隨時更改進度的值,例如在設定某個玩家的任務狀態為「進行中」的同時,可以設定該任務的進度有「探索:0」,每當玩家到指定的地點探索後,可以讓該任務的探索進度增加,或是為擊殺型的任務時,在玩家擊殺目標對象後,使擊殺進度增加,最後在嘗試回報任務的事件中,可以在檢查的部分加上「檢查任務進度」,來檢查該任務的進度是否達到目標,以執行回報任務後會觸發的動作。 由於任務進度的數量並沒有限制,所以專案作者也可以為某個任務同時設定多個進度,並檢查所有的進度都要完成時,任務才會完成。 本任務系統並未明確的提供可以設定任務類型的功能,例如「主線」、「支線」、「收集」、「對話」、「循環」等,專案作者可以自行在任務代碼中加上前綴來分類,搭配任務進度來自定義自己的任務類型。 如在初始化時有執行過動作**「設置系統變數」**,可使用變數讀取任務資訊,可以參考下列格式: ```json // 假設儲存任務資訊的變數名稱為 questInfo,它會儲存所有任務的預設資訊。 {questInfo.questCode} // 將 questCode 改為自訂的任務代碼,可以取得該任務的所有資料。 {questInfo.main_0.name} // 可以取得任務代碼為 main_0 的名稱。 {questInfo.main_0.description} // 可以取得任務代碼為 main_0 的描述。 {questInfo.main_0.datas} // 可以取得任務代碼為 main_0 的自訂屬性,於後方加上 .屬性名稱 即可取得該自訂屬性,例如: {questInfo.main_0.datas.returnActor} // 可以取得該任務中,自訂屬性 returnActor 的資料。 ``` ## 自訂道具 提供可以**自定義道具**的動作,可設定道具的名稱、描述、最大堆疊數量、物品樣式,以及其他自訂屬性,例如傷害力、防禦力、恢復力、可否裝備等。 至於定義物品道具的部分,請專門開一個事件表,將所有定義物品道具的動作放在裡面,並在玩家進入專案時執行一次即可,不需要每個事件表都重新放置動作。 或是可以直接在專案的進入點,加上 new ItemInfo 來定義物品。 ```typescript /** * @param {string} code 物品代碼 * @param {string} maxStack 最高堆疊數量 * @param {string} name 物品名稱 * @param {string} description 物品描述 * @param {string} stuffCode 物品外觀道具代碼 * @param {object} datas 自訂物品屬性 */ new ItemInfo(code: string, maxStack: number, name?: string, description?: string, stuffCode?: string, datas?: { [key: string]: number }) // 例如以下,創建一個 apple,最高可堆疊 10 個,手持時的武器為拳頭,datas 包含了 health 為 10。 new ItemInfo('apple', 10, '蘋果', '香甜可口的水果,散發著一股淡淡的香味。', 'kongfu', datas: { 'health': 10 }); ``` 如在初始化時有執行過動作**「設置系統變數」**,可使用變數讀取物品資訊,可以參考下列格式: ```typescript // 假設儲存物品資訊的變數名稱為 itemInfo,它會儲存所有物品道具的預設資訊。 {itemInfo.itemCode} // 將 itemCode 改為自訂的物品代碼,可以取得該物品的所有資料。 {itemInfo.apple.name} // 可以取得物品代碼為 apple 的名稱。 {itemInfo.apple.description} // 可以取得物品代碼為 apple 的描述。 {itemInfo.apple.datas} // 可以取得物品代碼為 apple 的自訂屬性,於後方加上 .屬性名稱 即可取得該自訂屬性,例如: {itemInfo.apple.datas.weight} // 可以取得該物品中,自訂屬性 weight 的數值。 ``` ## 背包/裝備欄 提供以**陣列為架構的背包系統**,並且可以為每個玩家**設置多個不同的背包**,可用裝備不同種類的物品,或是其他用途。 每個背包都可以**設置容量**,來決定這個背包可以裝多少組物品,當給予玩家物品時,若該物品的數量超過最大堆疊數量,則無法在同一欄位填裝,會自動尋找空位放入,直到背包沒有容量,且沒有可以堆疊的物品為止,並且會回傳多餘的物品數量,讓專案作者自行決定多餘的物品要怎麼處裡,例如直接丟棄,或是詢問玩家是否要替換背包中的物品,又或者是新增一個暫存用的背包,當物品數量過多時會自動裝入等等。 除了給予物品以外,也可以移除物品,移除時可以決定要不要指定背包中的哪一格,或是不指定,直接移除背包中指定物品代碼的物品。 提供可以檢查玩家背包物品數量的功能,可用於檢查玩家是否持有指定物品,且數量是否有達到條件,除了指定物品代碼以外,也可以檢查該物品的屬性是否符合條件。 提供裝備欄系統,可以自訂玩家的裝備欄狀態,以及各部位的名稱,並且裝備上物品道具,並且提供檢查**「檢查裝備欄物品」**,可檢查玩家某個裝備欄的物品,是否符合條件,例如是否為背包上的某一物品,或是符合某些物品代碼、屬性等,也可以單純檢查該裝備欄是否存在物品道具。 裝備欄的資料是直接儲存於背包資料中,故讀取背包資料時,會自動建置裝備欄的資料。 另外也提供了簡易的整理背包功能,專案作者可以讓玩家自行使用,或是在背包物品改變時使用。 如需要在事件表中,使用變數讀取玩家背包資料,可以參考下列格式: ```typescript // 假設儲存玩家的代碼為 instance {instance.code}_inventories // 使用此變數名稱可以得到該玩家的所有背包資料。 {instance.code}_inventories.inventoryCode // 將 inventoryCode 改為自訂的背包代碼,可以取得該背包的所有資料。 {instance.code}_inventories.myBag.slots // 可以取得背包代碼為 myBag 的容量大小。 {instance.code}_inventories.myBag.items // 可以取得背包代碼為 myBag 的所有物品資料。 {instance.code}_inventories.myBag.items.index // 可以取得該背包中,第 index 格的所有資料,index 請改為數字。 // index 是從 0 開始計算,故第一格為 0,第二格為 1,依此類推。 {instance.code}_inventories.myBag.items.0.item // 可以取得該背包中,第 0 格的物品資料。 {instance.code}_inventories.myBag.items.0.quantity // 可以取得該背包中,第 0 格的物品數量。 {instance.code}_inventories.myBag.items.0.equipped // 可以取得該背包中,第 0 格物品是否被裝備。 {instance.code}_inventories.myBag.items.0.slot // 可以取得該背包中,第 0 格物品的裝備位置。 {instance.code}_inventories.myBag.items.0.item.name // 可以取得該背包中,第 0 格物品的名稱。 // 將 name 改成其他屬性可以取得其他資料,例如: // code - 物品代碼, maxStack - 最大堆疊數量, stuffCode - 物品外型代碼, description - 物品描述 {instance.code}_inventories.myBag.items.0.item.datas // 可以取得該背包中,第 0 格物品的自訂屬性資料,於後方加上 .屬性名稱 即可取得該自訂屬性,例如: {instance.code}_inventories.myBag.items.0.item.datas.damage // 可以取得該物品中,自訂屬性 damage 的數值。 ``` ## 跨事件表傳送 提供簡單的跨事件表傳送功能,可以**將玩家傳送到指定事件表的指定座標**上,只要在需要傳送玩家時,執行動作「傳送玩家」並填入事件表路徑,以及傳送座標,並且在目標事件表初始化玩家時,執行動作「讀取玩家位置」即可。 儲存玩家位置,實際上是將該**玩家目前所在的事件表路徑以及座標儲存於資料庫**,也就是說事件表的位置、名稱,即是玩家所在的地點,請在一開始就確定好事件表的位置以及名稱,並不要於日後隨意更改,否則可能會導致玩家的位置資料損壞。 傳送玩家,實際上就是一個會先執行「儲存玩家位置」,然後讓玩家執行目標事件表的動作。 而讀取玩家位置,則是會先讀取玩家位於資料庫中的位置,並且判斷當下所在的事件表是否為資料所存的事件表,若不是的話,會自動將該玩家轉移到目標事件表,如果是的話,就會傳送玩家到資料所儲存的座標。 此功能可以用於讓每張地圖都有自己的事件表,並使玩家可以在這些地圖間進行傳送,而非如同以往需要繪製一張大地圖,並使用分割區域來達成不同區域的效果,跨事件表可以有效的降低遊戲的負擔。 ## 作者 **[cook14709](/profile/cook14709)**
# GLT One Paragraph of the game description goes here ## Getting Started ### Auth (Login) ```typescript // All action must wait until auth system is ready. CG.GLT.auth.onReady(user => { if(user.isLocalGuest()) { // not login yet } else { // logged in user } }); // auth event listener, triggered when auth user changed let authListener = CG.GLT.auth.onAuth(user => { if(user.isLocalGuest()) { // logged out } else { // logged in user } }); // auth event listener, triggered when validating a new auth action // a following onAuth event is expected. this.validatingListener = onAuthValidating(() => { // show loading animation }); ``` ### API The CG.GLT.api is responsible to communicate with glt.gamelet.online. CG.GLT.commands includes all comments to query/submit data from glt.gamelet.online. The commands has a function submit() that uses CG.GLT.api.submitCommand(), so most of the time, you don't need to call the api to submit. ```typescript CG.GLT.commands.scoreService.submitScore( 'challenge', // the name of the score to submit 10, // the score SubmitType.KEEP_HIGHEST, // submit only when the new score is greater than the one on server TimeRange.ALL // submit to all time-ranges (history and weekly) ) .submit(); // to receive the weekly high score list CG.GLT.commands.scoreService.listScores( 'challenge', // the name of the scores to get TimeRange.WEEKLY, // in which time range OrderType.HIGH_TO_LOW, // how to order the scores CG.GLT.api.lastUpdatedServerTimestamp, // tell the server which week to see 0, // start index 10, // how many to get (list: UserScoreList) => { // do something with the scorelist }, (error) => { // deal with error } ) ``` ## Authors **[Haskasu](/profile/[email protected])**
---------------以下開始前綴--------------- 0Ej7tfKqPJxUEpiSiR1P8Zb06onu5yF73UbQC9hCIroO2rHpZ7IfXv2GXow5NhK1uHBtEfFGdFPLwsBOPDa7HQEVJ2epr2qt5N6ZaU8YrFOOq7ahVUYmdNMFfGaATHvHyY1TAtWc1fQXludIPkqgU3X1UIN9Rgkh oabdrAYzYF9qGUWg9l8rykxLjthmgXThYGW6waOB0TrqhS8QxqhomcpHCIMJ0ubMmsF29krpCfAog5VN1bxR3HtoiFKpxn3ehF2z1u9N6fwaymj8n7QAgjyZ2q53AUToKugzfarC5Odb3iaXctFg57yXYorCrFfg 3jKGd8JQ8ysdyMOPt1Nj4XlKiFgfYLq6lN13dnrT5Wi7ojzLLsbadCKZKId05gXo8GCIXZuTJhSNIubx6eMNSxfWzhf9UCMlrtHM6zCu0veWSsAB8AeyKEoX7pZIrgbtF6mGdg3f4qS18ML1MhGsHj6inGPNVRHj 9AtTrRuXRa7ILb5VZZSr9Xm99gZsleUxLfTHmNYcA9Cc3IrXsMKQVryHlrvnAnciOvJBeUwbkHY7QwkHBlOI4as9vy6dD6tspPsZBp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t0j56ngUMoOM29cAKPdoERN9UBrldztUE74bI3DpGrEFyz4Ny21RDBAZQ9qpViHbVKlSGKAH0lAXdxeqER5r7V008HN08ZuSoa0qhvNaiiS7xgj0MSb792LriXGnAaTDyEWPgUtA0yGsTtj4MlCdAESBmmnRPwR sjlbcdGWjnQHznUE37GutGfOaIwa5oZNs6vzQe4RuDI2x2mGcIQDG4GSZKDkujCdaz75pg6MiCJh1VwNvNXFOm6vZvycj0NnGMXpwEPcImTpYT8sdoXXFVEZwM6yucN5xXlpI9A3ZevHxHa8oqo8BsRFwTKtVdUh 1lsQjuKaxTFLP4k8SxEaAYOLoSd7BRZtT0qSssI9HzCy3ZtiebaYdNQpaPs1MeF0flVdkrRRrKten3OVRfxiELEIhbgUdSL6BoW2W8vxQJyPXlO2Hv16QlwFeohX692iQxXeN1uEvg6Hi12qX9Qi7uiEZnbEu1RM sxEXvkWonFvIe5WSc7ncv4jn9N1a0LlZhbEiqdxE2tcnuYo0CBkwQkdnVlw191P7zNWaZxuBbYLYpDfrDAGr90VCBxfswey0YwwuN2wGuy0kj8yfhGl6DUy5Tog9BhY7izB3hzdZnwGNYcrxwDufXSBxX6cuGRIy gIt3M4AedFnU8wVGNoLahEJL1c897AM7Rdjvdag0tfE7RN27PrkuY3Vnb8tvx8u4poLhQnKBszEINDd30yhZVvGsmpdnJin5KB1m83uuoFhY7zs3i60ahhlsE6IGOuqxeTTU3RDZ5jP3NeDDnFVF91v4fiCI4akX ---------------前綴結束--------------- # 光暈事件擴充 # 光暈資料:[光暈資料](https://discord.gg/ZEdGFDnthe) ## 本專案已進入慢速更新模式 ## 請幫忙評分以利範例文章推出(需先玩3分鐘):[我要遊玩3分鐘](https://tweventsalt.gamelet.online/play) [我要評分](https://gamelet.online/review/TWEventsAlt) ## 更新日誌:[CHANGELOG](https://tweventsalt.gamelet.online/) ## README - 部分功能需要用到監聽作業,請於事件最一開始執行一次監聽作業,參數空白或是填0即可。 ## Links - 同人陣範例檔:[我的同人陣](https://code.gamelet.com/edit/TWSample) - 同人陣功能示範(只是示範,不用認真玩):[愛的教育](https://twmission001.gamelet.online) - 同人相關問題可到以下地點詢問: - 留言板:[留言板](https://gamelet.online/user/[email protected]/board) - 討論區:[該專案的討論區](https://code.gamelet.com/discuss/p/TWEventsAlt/0) - 注意:在其他地方(談程式設計、談遊戲設計、discord)詢問,將會看情況回答 ## 事件功能: - 觸發:角色 - 觸發:角色攻擊 - 觸發:說話內容 - 觸發:角色受傷Alt - 觸發:角色盾牌防禦 - 觸發:武器道具 - 觸發:拾取武器道具 - 觸發:使用自創商店武器道具 - 檢查:取得盾牌屬性 - 觸發:地圖機關 - 觸發:石塊移動 - 觸發:籃框收集物品 - 觸發:變數 - 觸發:匯入變數 - 觸發:顯示 - 觸發:關閉彈出視窗 - 觸發:確認彈出視窗 - 檢查:角色 - 檢查:找出所有角色(隨機排列) - 檢查:找出所有角色 - 檢查:比對距離 - 檢查:面向角度 - 檢查:角色狀態Alt - 檢查:隨機取得演員代碼 - 檢查:區域內的角色數量 - 檢查:角色戰鬥對象 - 檢查:道具武器 - 檢查:地圖 - 檢查:隨機取得可行走座標 - 檢查:取得TWLoc - 檢查:系統 - 檢查:取得現在時間 - 檢查:變數 - 檢查:取得數字部分 - 動作:角色 - 動作:發動武器攻擊 - 動作:角色裝備或移除武器道具 - 動作:角色發動技能 - 動作:玩家按空白鍵跳躍 - 動作:設定預設武器 - 動作:移動人物位置 - 動作:設定角色屬性[註1] - 動作:設定角色演員[支援部分開放式遊戲房:除自訂以外都支援] - 動作:思考模式 - 動作:思考間隔 - 動作:角色伺服器狀態 - 動作:角色暫停 - 動作:角色繼續 - 動作:新增角色Alt - 動作:補充彈藥 - 動作:玩家應用傷害特效 - 動作:進入技能狀態 - 動作:停止說話 - 動作:設定暱稱[註1] - 動作:給遊戲幣 - 動作:角色跳躍 - 動作:中毒 - 動作:角色死亡叫聲[註1] - 動作:角色切換元素 - 動作:武器道具 - 動作:新增武器道具 - 動作:設定武器道具屬性[註1] - 動作:放置可拾取道具Alt - 動作:移除武器道具 - 動作:設定武器技能[註1] - 動作:連結自訂商店武器道具[註1] - 動作:新增自創近距武器 - 動作:盾牌設定 - 動作:設定Alt商店武器道具熱鍵 - 動作:角色特效 - 動作:噴火[註1] - 動作:電擊[註3] - 動作:人物濾鏡 - 動作:角色著火 - 動作:角色衝擊波 - 動作:殘影 - 動作:集氣[註1] - 動作:自訂角色GAF特效 - 動作:血條[註1] - 動作:角色火箭 - 動作:角色圓形範圍 - 動作:角色影分身[註1] - 動作:角色散發粒子 - 動作:角色光彈[註1] - 動作:角色散發光環[註1] - 動作:角色進度條 - 動作:腳印[註1] - 動作:角色中箭[註3] - 動作:角色反衝箭 - 動作:擊退 - 動作:角色居合斬 - 動作:角色波動拳 - 動作:人物天火 - 動作:角色武器濾鏡 - 動作:名字條[註1] - 動作:集氣濾鏡[註1] - 動作:技能條 - 動作:角色龍[支援部分開放式遊戲房:出現位置、大小] - 動作:地圖特效 - 動作:衝擊波 - 動作:震地[註3] - 動作:噴氣[註1] - 動作:煙霧[註1] - 動作:爆炸[註1] - 動作:自訂地圖GAF特效 - 動作:快跳文字 - 動作:煙火[註1] - 動作:龍波[支援部分開放式遊戲房:出現位置、路徑、大小、每格停留時間] - 動作:火箭 - 動作:定時炸彈 - 動作:真氣風暴[支援部分開放式遊戲房:除大小以外都支援] - 動作:濺起水花[註1] - 動作:揚起塵土[註1] - 動作:圓形範圍 - 動作:散發粒子 - 動作:散發光環[註1] - 動作:進度條 - 動作:光印[支援部分開放式遊戲房:除濾鏡以外都支援] - 動作:天箭[註1] - 動作:反衝箭 - 動作:防護泡 - 動作:任務流程 - 動作:可使用的武器道具[註1] - 動作:任務完成Alt - 動作:完成任務章節Alt - 動作:自動上傳角色分數[註1] - 動作:死後自動觀戰[註1] - 動作:禁用背包 - 動作:畫面特效 - 動作:畫面震動[註1] - 動作:畫面色調[註1] - 動作:畫面濾鏡 - 動作:錐形視界[註1] - 動作:畫面遮色 - 動作:畫面遊戲結束 - 動作:畫面散發粒子 - 動作:顯示 - 動作:彈出確認視窗 - 動作:更新文字 - 動作:更新顯示物件 - 動作:彈出遊戲通知 - 動作:彈出選項視窗 - 動作:彈出遊戲錯誤通知 - 動作:彈出字串輸入視窗 - 動作:顯示可拖曳面板 - 動作:顯示遊戲倒數 - 動作:顯示商店 - 動作:前置作業 - 動作:監聽作業 - 動作:攝影機 - 動作:觀戰模式 - 動作:縮放玩家視野 - 動作:地圖 - 動作:新增可行走座標[註1] - 動作:新增洞[註1] - 動作:靜態物件 - 動作:新增地圖傳送點 - 動作:地圖機關 - ~~動作:告示牌[v 6.19.0][註1]~~ - 動作:新增可推石塊 - 動作:新增蠋火 - 動作:新增噴火孔[註1] - 動作:新增旋轉斧 - 動作:新增飛箭機關 - 動作:新增籃框 - 動作:變數 - 動作:延遲設定變數[註1] - 動作:匯出變數 - 動作:匯入變數 - 動作:獲取外部變數 - 動作:儲存區域變數 - 動作:物件特效 - 動作:物件震動[註1] - 動作:物件標示箭頭 - 動作:物件震盪[註1] - 動作:黑科技 - 動作:斷線 - 動作:關閉視窗 - 動作:視窗當機 - 動作:系統 - 動作:執行光暈事件表 - 動作:取得IPv4位址 - 動作:嘗試關閉視窗時顯示警告 - 動作:邀請觀眾 - 動作:音樂 - 動作:播放音樂 - 動作:停止音樂 - 動作:靜音官方音樂 - 動作:Cutting Edge - 動作:Add Green Dragon Crescent Blade[不支援開放式遊戲房] - 動作:多媒體 - 動作:網頁多媒體 - 動作:事件 - 動作:設定事件JSON - 動作:天啟 - 動作:地裂 - 動作:洪水 - 動作:挖寶 - 動作:屍變 - 動作:GIF - 動作:新增GIF - 動作:移除GIF - 動作:角色GIF - 動作:地圖GIF - 動作:播放GIF - 動作:停止GIF - 動作:拳法 - 動作:學習拳法 - 動作:增加拳法經驗值 - 動作:釋放拳法 ### 可能不支援開放式遊戲房原因: - 註1:未同步,後來的玩家看不到該特效,但在該玩家進來後之後執行的動作當然可以看到。所以假如是短暫的動作(例如震地這種1、2秒內做完的動作),影響不大。 - 註2:同註1,且之後將會支援(預定施工項目) - 註3:同註1,此部分功能為TwilightWarsLib提供,需要小哈片刻更新才會支援 ## 額外功能 - 觀戰系統(Beta) - 按下Shift+F8即可開啟,另為防止BUG導致需重整,增設Shift+F9可強制跳到主頁面 - 使用資格:遊戲管理員(GM)、開發版本下(dev)、有申請開放之專案(TWMission001...) - 欲申請開放公開版本之一般玩家也能使用觀戰系統,請至留言板留言,將於下一版本公開時添加 - 注意:目前觀戰系統不支援最大人數為1的房間(因為單人無須與玩家交流,故不會有訊息產生以供觀戰) - 設定商店道具武器狀態: - 請在你的專案的README.md內加上: - ※setItemStatus:※§itemCode§AAA※§itemStatus§BBB※§end§ - AAA為道具武器代碼 - BBB為狀態:dev,disabled,hidden,pub,pubToOwner - 可選取該文字,然後按Ctrl + / 來隱藏文字 - 範例:※setItemStatus:※§itemCode§TwilightWarsLib.grenadeBomb※§itemStatus§hidden※§end§ - 設定玩家勳章: - 請在你的專案的README.md內加上: - ※setPlayerBadge:※§username§AAA※§badgeCode§BBB※§badgeSet§CCC※§note§DDD※§end§ - AAA為玩家ID - BBB為勳章代碼 - CCC為設定:award,remove - DDD為註記 - 可選取該文字,然後按Ctrl + / 來隱藏文字 - 範例:※setPlayerBadge:※§username§haskasu※§badgeCode§kills10k※§badgeSet§award※§note§congratulation!※§end§ - 提交玩家分數: - 請在你的專案的README.md內加上: - ※submitPlayerScore:※§username§AAA※§scoreKey§BBB※§score§CCC※§note§DDD※§end§ - AAA為玩家ID - BBB為分數代碼 - CCC為提交的分數 - DDD為註記 - 可選取該文字,然後按Ctrl + / 來隱藏文字 - 範例:※submitPlayerScore:※§username§haskasu※§scoreKey§kills※§score§3000※§note§congratulation!※§end§ - 停權: - 請在你的專案的README.md內加上: - ※suspendPlayer:※§username§AAA※§days§BBB※§suspendSet§CCC※§note§DDD※§end§ - AAA為玩家ID - BBB為天數 - CCC為設定:suspend,unsuspend - DDD為註記 - 可選取該文字,然後按Ctrl + / 來隱藏文字 - 範例:※suspendPlayer:※§username§haskasu※§days§3※§suspendSet§unsuspend※§note§congratulation!※§end§ - ~~玩家登入紀錄:[v 9.0.X]~~ - ~~本模組提供作者在dev mode查看玩家登入紀錄,只要執行專案即可在console看到(F12 -> Console)~~ - 設定最大Fps: - 請在你的專案的README.md內加上: - ※setMaxFps:※§maxFps§AAA※§end§ - AAA為最大Fps - 可選取該文字,然後按Ctrl + / 來隱藏文字 - 範例:※setMaxFps:※§maxFps§1000※§end§ - 廁所 - 誤差大約45秒 - 老少咸宜 ## Versioning - We use [SemVer](http://semver.org/) for versioning. ## Authors - **[hyper_code_gamelet](https://code.gamelet.com/profile/hyper_code_gamelet)** ## Acknowledgments - Hat tip to anyone who's code was used - Inspiration - etc
# PixiGif Add [GIF](https://en.wikipedia.org/wiki/GIF) 89a (animated GIF) support for pixi.js. ## Getting Started Add GIF image alias to resourceManager as regular resources, and create a GifSprite by CG.PixiGif.createGifSprite(); ```typescript let resourceAlias = 'PixiGif.anim'; CG.Base.resourceManager.addAppResource(alias); CG.Base.resourceManager.load(() => { CG.Base.pixi.initialize(300, 300); // create a GifSprite, attach to pixi.root and play the animation let sprite = CG.PixiGif.createGifSprite(resourceAlias); CG.Base.pixi.root.addChild(sprite); sprite.play(); }); ``` You can setup custom sequences by any combination of frames. ```typescript let sprite = CG.PixiGif.createGifSprite(resourceAlias); sprite.addSequence('jump', [1,3,5]); // define a sequence named jump sprite.setSequence('jump', true); // set jump as the current sequence, and play ``` You can listen to events from GifSprite ```typescript let sprite = CG.PixiGif.createGifSprite(resourceAlias); sprite.on('frameChanged', (sp) => console.log('the frame is just changed')); sprite.on('complete', (sp) => console.log('the animation is complete and stopped')); sprite.on('play', (sp) => console.log('just starts playing the animation')); sprite.on('stop', (sp) => console.log('the animation is stopped')); sprite.on('end', (sp) => console.log('the animation plays to the end of the sequence')); ``` #### References - [GIF reader by Dean McNamee](https://github.com/deanm/omggif) - [GIF Format](http://www.onicos.com/staff/iz/formats/gif.html)
# PyScript Integrate Py-Script into your CG project. Run py-script on web. - [PyScript home](https://pyscript.net/) - [Document](https://docs.pyscript.net/latest/) - [Github](https://github.com/pyscript/pyscript) ## Getting Started Run a py-script ```typescript CG.PyScript.runScriptFromSource('CG.PyScript/test.py'); ``` Open a py-editor ```typescript CG.PyScript.addRepl('User Script Editor'); ``` Customize the looks ```typescript CG.PyScript.setPyscriptStyles({ fontSize: '16px', padding: '10px, fontFamily: 'Courier', }) ``` ## Build-in utils Some CG related utils are embeded and ready to be used. To get the URL of a source file: ```py url = getAppSourceUrl('CG/PyScript/README.md') print(url) ``` To hide or show python console ```py # hide js.hidePythonConsole() # show js.showPythonConsole() ``` To open dialogs: ```py result = await js.dialog.prompt("What's your name?") print("Your name is " + result) result = await js.dialog.confirm("Are you a girl?") print("You are a " + ("Girl" if result else "Boy")) result = await js.dialog.select(["One", "Two"], "Choose one") print("You got a " + (result if result else "What?")) ``` To draw shapes: ```py # draw a line js.draw.line(10, 400, 300, 100, color=0xFF0000, thickness=5) # draw a rectangle js.draw.rect(100, 300, 100, 50, fillColor=0xFFFF00) # draw a circle js.draw.circle(400, 300, 30, fillColor=0x00FF00, lineThickness=5, lineColor=0x00FFFF) # draw a text js.draw.text(500, 400, "Logo", fontSize=16, color=0xFF9900) # draw lines js.draw.lines([{"x":10,"y":10},{"x":200,"y":400},{"x":100,"y":500}], thickness=2) # draw a polygon js.draw.polygon([{"x":10,"y":10},{"x":200,"y":400},{"x":100,"y":500}]) ```
ⒸCode.Gamelet.com | Privacy Policy | Terms of Service