/
domahes
/
Arcade
Обзор
Документация
Войти
/
domahes
/
Arcade
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
js/data/DTrigger.js
97 строк
2 KB
domahes
Initial commit with game files
01 июн 2026, 09:31
01 июн 2026, 09:31
0f50ffb
Код
Авторство
О чём код?
/** * Created by Yitian Chen on 2019/1/4. * Trigger data structure */ function DTrigger(rd){ //Trigger ID this.id = 0; //X-coordinate of trigger this.x = 0; //Y-coordinate of trigger this.y = 0; //Trigger name this.name = ""; //Trigger pages this.page = []; //Read Data this.id = rd.readInt(); this.x = rd.readInt(); this.y = rd.readInt(); this.name = rd.readString(); var length = rd.readInt(); for(var i = 0;i < length ; i++){ var e = new DTriggerPage(rd); this.page.push(e); } } /** * Data structure of trigger pages */ function DTriggerPage(rd){ //Trigger type this.type = 0; //Loop execution this.loop = true; //Parallel execution or not this.isParallel = true; //Image of trigger page this.image = null; //conditions of page this.logic = null; //contents of trigger page this.events = []; //Gravity this.gravity = 0; //Penetration this.penetration = 0; //Read Data this.type = rd.readInt(); this.loop = rd.readBool(); this.isParallel = rd.readBool(); this.gravity = rd.readInt(); this.penetration = rd.readInt(); this.image = new DTriggerImage(rd); this.logic = new DIf(rd); var length = rd.readInt(); for(var i = 0;i<length;i++){ var e = new DEvent(null); e.read(rd); this.events.push(e); } } /** * Data structure of trigger image */ function DTriggerImage(rd){ //Image ID (ID in DResActor) this.id = 0; //Direction this.dir = 0; //fix direction this.fixedOrientation = false; //opacity0~255 this.opacity = 255; //index of action this.actionIndex = 0; //Fix action this.fixedAction = false; this.id = rd.readShort(); this.dir = rd.readShort(); this.fixedOrientation = rd.readBool(); this.opacity = rd.readShort(); this.actionIndex = rd.readShort(); this.fixedAction = rd.readBool(); this.entity = rd.readBool(); }