/
domahes
/
Arcade
Обзор
Документация
Войти
/
domahes
/
Arcade
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
js/data/DMap.js
138 строк
3 KB
domahes
Update game scripts and data configurations
01 июн 2026, 10:11
01 июн 2026, 10:11
83cd2f8
Код
Авторство
О чём код?
/** * Created by Yitian Chen on 2019/1/4. * Map Data */ function DMap(rd){ //Map ID this.id = 0; //Map name this.name = ""; //Map width this.width = 20; //Map height this.height = 12; //Map Scene this.backgroundId = 1; //Map BGM this.bgm = new DSetSound(); //Map BGS this.bgs = new DSetSound(); //Automove or not this.autoMove = false; //Speed of automove this.autoMoveSpeed = 4; //Following is the drawing area //background layer this.backgroud = []; //Layer 1 of block this.level1 = []; //Layer 2 of block this.level2 = []; //Layer 3 of block this.level3 = []; //decoration Layer this.decorate = []; //enemy Layer this.enemys = []; //trigger this.trigger = []; //The parent ID of the map (invalid in game) this.fid = -1; //Map sorting (invalid in game) this.order = 0; //gravity coefficient this.gravity = 1.0; //jump coefficient this.resistance = 1.0; //Read Data this.id = rd.readShort(); this.name = rd.readString(); this.width = rd.readShort(); this.height = rd.readShort(); this.backgroundId = rd.readShort(); this.bgm = new DSetSound(rd); this.bgs = new DSetSound(rd); this.autoMove = rd.readBool(); this.autoMoveSpeed = rd.readShort(); this.autoDir = rd.readShort(); this.fid = rd.readShort(); this.order = rd.readShort(); this.gravity = rd.readShort() / 100; this.resistance = rd.readShort() / 100; var i = 0; var j = 0; //load background for(i = 0;i<this.width;i++){ this.backgroud[i] = []; for(j = 0;j<this.height;j++){ this.backgroud[i][j] = rd.readShort(); } } //load block for(i = 0;i<this.width;i++){ this.level1[i] = []; for(j = 0;j<this.height;j++){ var pow = rd.readShort(); if(pow == -31822){ this.level1[i][j] = null; }else{ var at = new DBlock(rd); this.level1[i][j] = at; } } } for(i = 0;i<this.width;i++){ this.level2[i] = []; for(j = 0;j<this.height;j++){ pow = rd.readShort(); if(pow == -31822){ this.level2[i][j] = null; }else{ at = new DBlock(rd); this.level2[i][j] = at; } } } for(i = 0;i<this.width;i++){ this.level3[i] = []; for(j = 0;j<this.height;j++){ pow = rd.readShort(); if(pow == -31822){ this.level3[i][j] = null; }else{ at = new DBlock(rd); this.level3[i][j] = at; } } } for(i = 0;i<this.width;i++){ this.decorate[i] = []; for(j = 0;j<this.height;j++){ this.decorate[i][j] = rd.readShort(); } } var length = rd.readInt(); for(i = 0;i<length;i++){ var tg = new DTrigger(rd); this.trigger.push(tg); } length = rd.readInt(); for(i = 0;i<length;i++){ this.enemys.push(new DMapEnemy(rd)); } }