Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
- Added basic lang files
- Added map music
- Added entity action trigger
- Added basic entity notification messages
- Added faceEntity to player entity class
- Disable player face changing while in moving state
Rate limit · GitHub

Access has been restricted

You have triggered a rate limit.

Please wait a few minutes before you try again;
in some cases this may take up to an hour.

maierfelix committed Apr 12, 2016
1 parent 3629090 commit 9ed9bdd
Showing 26 changed files with 592 additions and 135 deletions.
33 changes: 33 additions & 0 deletions assets/i18n/de.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"s_BrowserNotSupported": "Browser nicht unterstützt.",
"s_Days": [
"Sonntag",
"Montag",
"Dienstag",
"Mittwoch",
"Donnerstag",
"Freitag",
"Samstag"
],
"s_Months": [
"Januar",
"Februar",
"März",
"April",
"Mai",
"Juni",
"Juli",
"August",
"September",
"Oktober",
"November",
"Dezember"
],
"s_German": "Deutsch",
"s_English": "Englisch",
"s_Settings": "Einstellungen",
"s_Objects": "Objekte",
"s_On": "An",
"s_Off": "Aus",
"s_ChangeLanguage": "Sprache wechseln"
}
33 changes: 33 additions & 0 deletions assets/i18n/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"s_BrowserNotSupported": "Browser not supported.",
"s_days": [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
],
"s_months": [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
],
"s_German": "German",
"s_English": "English",
"s_Settings": "Settings",
"s_Objects": "Objects",
"s_On": "On",
"s_Off": "Off",
"s_ChangeLanguage": "Change language"
}
Binary file added assets/img/85.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/chat/bleft.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/chat/bright.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/chat/fill.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/chat/point.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/chat/tleft.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/chat/tright.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 25 additions & 2 deletions src/Engine/Audio/index.js
Original file line number Diff line number Diff line change
@@ -8,7 +8,15 @@ class Audio {
/**
* @constructor
*/
constructor() {}
constructor() {

/**
* Audio res path
* @type {String}
*/
this.path = "assets/audio/";

}

/**
* Play a sound with custom volume
@@ -18,7 +26,7 @@ class Audio {
* @param {Number} y
*/
playSound(name, vol, x, y) {
let path = `assets/audio/${name}.ogg`;
let path = this.path + `${name}.ogg`;
var sound = new Howl({
urls: [path],
autoplay: true,
@@ -27,6 +35,21 @@ class Audio {
});
}

/**
* Play a song
* @param {String} name
* @param {Number} vol
*/
playSong(name, vol) {
let path = this.path + `${name}.ogg`;
var song = new Howl({
urls: [path],
autoplay: true,
loop: true,
volume: vol / 1e2
});
}

}

export default Audio = new Audio();
56 changes: 6 additions & 50 deletions src/Engine/Editor/commands.js
Original file line number Diff line number Diff line change
@@ -3,8 +3,6 @@ import {
DIMENSION
} from "../../cfg";

import MapEntity from "../Map/MapEntity";

export let commands = [
/** Select command */
{
@@ -54,12 +52,11 @@ export let commands = [
{
action: "cut",
onUndo: function(entity) {
this.instance.addEntity(entity);
this.entitySelection = entity;
this.instance.editor.pasteEntity();
},
onRedo: function(entity) {
this.entityCopy = entity;
this.instance.removeEntity(entity);
this.instance.editor.copyEntity();
this.instance.editor.deleteEntity();
}
},
/** Copy command */
@@ -82,60 +79,19 @@ export let commands = [
},
onRedo: function(entity, paste) {

let entities = this.instance.instance.entities;

let map = this.map;

let tmp = null;

let pushEntity = null;

if (paste !== null && paste !== void 0) {
map.entities.push(paste);
return void 0;
}

if (entity instanceof entities.Player) {
tmp = new entities.Player({
name: "undefined",
map: entity.map,
x: entity.x, y: entity.y,
zIndex: entity.zIndex,
sprite: entity.sprite,
width: entity.width, height: entity.height,
isLocalPlayer: false,
collidable: entity.collidable,
shadow: entity.hasShadow
});
if (entity.instance) {
tmp.instance = entity.instance;
}
if (tmp.hasShadow) {
tmp.shadow.x = entity.shadow.x;
tmp.shadow.y = entity.shadow.y;
}
tmp.fadeIn(.75);
}
else if (entity instanceof MapEntity) {
tmp = map.objectTemplates[entity.name.toLowerCase()];
} else {
return void 0;
}

tmp.x = entity.x;
tmp.y = entity.y;
tmp.z = entity.z;

if (entity instanceof MapEntity) {
pushEntity = map.addEntity(tmp);
} else {
pushEntity = tmp;
}
let clone = this.instance.cloneEntity(entity);

/** Fuck that */
this.instance.editor.commander.stack[this.instance.editor.commander.position].data[1] = pushEntity;
this.instance.editor.commander.stack[this.instance.editor.commander.position].data[1] = clone;

map.entities.push(pushEntity);
map.entities.push(clone);

}
}
57 changes: 57 additions & 0 deletions src/Engine/Entity/functions.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import MapEntity from "../Map/MapEntity";

import Entity from "./index";

/**
@@ -20,6 +22,61 @@ export function addEntity(entity) {

}

/**
* Clone a entity
* @param {Object} entity
* @return {Object}
*/
export function cloneEntity(entity) {

let entities = this.instance.entities;

let map = this.currentMap;

let clone = null;
let tmp = null;

if (entity instanceof entities.Player) {
tmp = new entities.Player({
name: "undefined",
map: entity.map,
x: entity.x, y: entity.y,
zIndex: entity.zIndex,
sprite: entity.sprite,
width: entity.width, height: entity.height,
isLocalPlayer: false,
collidable: entity.collidable,
shadow: entity.hasShadow
});
if (entity.instance) {
tmp.instance = entity.instance;
}
if (tmp.hasShadow) {
tmp.shadow.x = entity.shadow.x;
tmp.shadow.y = entity.shadow.y;
}
tmp.fadeIn(.75);
}
else if (entity instanceof MapEntity) {
tmp = map.objectTemplates[entity.name.toLowerCase()];
} else {
return void 0;
}

tmp.x = entity.x;
tmp.y = entity.y;
tmp.z = entity.z;

if (entity instanceof MapEntity) {
clone = map.addEntity(tmp);
} else {
clone = tmp;
}

return (clone);

}

/**
* Get a entity by its
* matching property
56 changes: 49 additions & 7 deletions src/Engine/Entity/index.js
Original file line number Diff line number Diff line change
@@ -3,13 +3,15 @@ import {
LEFT, RIGHT, UP, DOWN,
SHADOW_X, SHADOW_Y,
WGL_SUPPORT,
IS_CLIENT
IS_CLIENT,
TYPES
} from "../../cfg";

import math from "../../Math";
import { TextureCache, getSprite, createCanvasBuffer } from "../utils";

import DisplayObject from "../DisplayObject";
import MapEntity from "../Map/MapEntity";
import Texture from "../Texture";
import Shadow from "../Shadow";

@@ -232,12 +234,7 @@ export default class Entity extends DisplayObject {
*/
this.x = 0;
this.y = 0;

/**
* Z axis position
* @type {Number}
*/
this.z = .0;
this.z = 0;

/**
* Velocity
@@ -300,6 +297,12 @@ export default class Entity extends DisplayObject {
*/
this.glTexture = null;

/**
* Action trigger
* @type {Function}
*/
this.onAction = null;

/**
* Enter trigger
* @type {Function}
@@ -330,6 +333,9 @@ export default class Entity extends DisplayObject {
*/
this.onJump = null;

if (obj.onAction !== void 0) {
this.onAction = obj.onAction;
}
if (obj.onLoad !== void 0) {
this.onLoad = obj.onLoad;
}
@@ -346,6 +352,12 @@ export default class Entity extends DisplayObject {
this.onJump = obj.onJump;
}

/**
* Entity numeric type
* @type {Number}
*/
this.type = this.getEntityType();

/**
* X
* @type {Number}
@@ -378,6 +390,24 @@ export default class Entity extends DisplayObject {
}
});

/**
* Z
* @type {Number}
* @getter
* @setter
* @overwrite
*/
Object.defineProperty(this, "z", {
get: function() {
return (this.position.z);
},
set: function(value) {
this.position.z = value;
}
});

this.position.z = 0;

/**
* Lock
* @type {Number}
@@ -395,6 +425,7 @@ export default class Entity extends DisplayObject {
});

if (IS_CLIENT === false) return void 0;
if (this.sprite === null) return void 0;

/** Load texture */
getSprite(
@@ -417,6 +448,17 @@ export default class Entity extends DisplayObject {

}

/**
* Get entity type
* @return {Number}
*/
getEntityType() {
if (this instanceof MapEntity) {
return (TYPES.MapEntity);
}
return (TYPES.Player);
}

/**
* Orbit around a entity
* @param {Object} target
10 changes: 9 additions & 1 deletion src/Engine/Environment/Evaluator/index.js
Original file line number Diff line number Diff line change
@@ -49,7 +49,9 @@ export default class Evaluator {

console: window.console,

alert: window.alert
alert: window.alert,

kernel: this.instance.instance

};

@@ -537,6 +539,12 @@ export default class Evaluator {
return (!this.evalBinaryExpression(ast.init));
}

if (this.isIdentifier(ast) === true) {
return (
this.context[ast.name]
);
}

return (0);

}
2 changes: 1 addition & 1 deletion src/Engine/Map/events.js
Original file line number Diff line number Diff line change
@@ -51,7 +51,7 @@ export function actionTrigger(position, entity) {
event = entities[ii];
if (event.id === id) continue;
if (event.x << 0 === x && event.y << 0 === y) {
event.orbitAround(entity);
this.triggerEvent(event, entity, "onAction");
}
};

9 changes: 8 additions & 1 deletion src/Engine/Map/functions.js
Original file line number Diff line number Diff line change
@@ -5,8 +5,12 @@ import {

import math from "../../Math";

import Audio from "../Audio";

import {
DIMENSION
DIMENSION,
BGM,
VOLUME
} from "../../cfg";

import Map from "../Map";
@@ -29,6 +33,9 @@ export function addMap(path, resolve) {
if (this.editor !== null) {
this.editor.map = this.currentMap;
}
if (map.settings.music && BGM) {
Audio.playSong(map.settings.music, VOLUME.MUSIC);
}
return (resolve());
});
});
30 changes: 13 additions & 17 deletions src/Engine/Map/index.js
Original file line number Diff line number Diff line change
@@ -122,6 +122,12 @@ export default class Map extends DisplayObject {
*/
this.collisionLayer = null;

/**
* Settings
* @type {Object}
*/
this.settings = {};

/** Load texture */
getSprite(this.tileset, -1, -1, this::function(texture) {
this.texture = TextureCache[this.tileset];
@@ -136,20 +142,6 @@ export default class Map extends DisplayObject {

}

/**
* Load map settings
* @param {Object} obj
*/
loadMapSettings(obj) {

for (let key in obj) {
if (this[key] !== void 0) {
this[key] = obj[key];
}
};

}

/**
* Load map file
* @param {Function} resolve
@@ -161,9 +153,7 @@ export default class Map extends DisplayObject {
$GET(path).then(this::function(data) {
let map = new Function(data)();
this.entities = map.entities;
if (map.settings !== void 0) {
this.loadMapSettings(map.settings);
}
this.settings = map.settings;
this.loadMapObjectTypes();
this.loadMapObjects(function() {
if (resolve instanceof Function) {
@@ -237,6 +227,12 @@ export default class Map extends DisplayObject {

}

/**
* Inherit properties
* @param {Object} entity
* @param {Object} parent
* @return {Object}
*/
inheritProperties(entity, parent) {

let key = null;
214 changes: 209 additions & 5 deletions src/Engine/Notification/index.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,231 @@
import {
DIMENSION
DIMENSION,
TYPES
} from "../../cfg";

import math from "../../Math";

import DisplayObject from "../DisplayObject";
import { TextureCache, getSprite, createCanvasBuffer } from "../utils";

import Entity from "../Entity";

/**
* Notification
* @class Notification
* @export
*/
export default class Notification extends DisplayObject {
export default class Notification extends Entity {

/**
* @param {Object} obj
* @constructor
*/
constructor(obj) {

super(null);
super(obj);

/**
* Entity to follow
* @type {Object}
*/
this.follow = obj.follow || null;

if (this.follow !== null) {
this.position = this.follow.position;
}

/**
* Has shadow
* @type {Boolean}
*/
this.hasShadow = false;

/**
* Attach type
* @type {Number}
*/
this.type = TYPES.Notification;

/**
* Message
* @type {String}
*/
this.msg = obj.msg || "undefined";

/**
* Top left texture
* @type {String}
*/
this.topLeft = "assets/img/chat/tleft.png";

/**
* Top right texture
* @type {String}
*/
this.topRight = "assets/img/chat/tright.png";

/**
* Bottom left texture
* @type {String}
*/
this.bottomLeft = "assets/img/chat/bleft.png";

/**
* Bottom right texture
* @type {String}
*/
this.bottomRight = "assets/img/chat/bright.png";

/**
* Pointer texture
* @type {String}
*/
this.pointer = "assets/img/chat/point.png";

/**
* Fill texture
* @type {String}
*/
this.fill = "assets/img/chat/fill.png";

/**
* Texture
* @type {Object}
*/
this.texture = null;

this.sprite = null;

this.padding = 3;

this.msgMaxWidth = 100;

this.heightOfMessage = 20;

this.loadTexture();

}

/**
* Get frame index
* @return {Number}
*/
getFrameIndex() {
return (0);
}

/**
* Load texture
*/
loadTexture() {

var self = this;

function load(sprite, resolve) {
getSprite(
self[sprite], self.width, self.height, self::function(texture) {
this[sprite] = texture;
resolve();
});
}

load("topLeft", () =>
load("topRight", () =>
load("bottomLeft", () =>
load("bottomRight", () =>
load("pointer", () =>
load("fill", this::function() {
this.draw();
})
)
)
)
)
)

}

/**
* Draw
*/
draw() {

this.texture = createCanvasBuffer(this.width, this.height + this.pointer.height);

let ctx = this.texture;

let cornerWidth = this.topLeft.width;
let cornerHeight = this.topLeft.height;

ctx.drawImage(
this.fill.texture.canvas,
this.padding, this.padding,
this.width - this.padding * 2, this.height - this.padding * 2
);

ctx.drawImage(
this.fill.texture.canvas,
0, this.padding,
this.padding, this.height - this.padding * 2
);
ctx.drawImage(
this.fill.texture.canvas,
this.width - this.padding, this.padding,
this.padding, this.height - this.padding * 2
);

ctx.drawImage(
this.fill.texture.canvas,
this.padding, 0,
this.width - this.padding * 2, this.padding
);
ctx.drawImage(
this.fill.texture.canvas,
this.padding, this.height - this.padding,
this.width - this.padding * 2, this.padding
);

ctx.drawImage(
this.topLeft.texture.canvas,
0, 0
);
ctx.drawImage(
this.topRight.texture.canvas,
this.width - this.topRight.width, 0
);
ctx.drawImage(
this.bottomLeft.texture.canvas,
0, this.height - this.bottomLeft.height
);
ctx.drawImage(
this.bottomRight.texture.canvas,
this.width - this.topRight.width,
this.height - this.bottomLeft.height
);

ctx.drawImage(
this.pointer.texture.canvas,
this.width / 2, this.height
);

let txt = createCanvasBuffer(this.width, this.height + this.pointer.height);

txt.font = 20 + "px AdvoCut";
txt.strokeStyle = "#000";
txt.lineWidth = 2;
txt.strokeText(this.msg, this.width / 2, (this.height + this.pointer.height) / 2);
txt.fillStyle = "white";
txt.fillText(this.msg, this.width / 2, (this.height + this.pointer.height) / 2);

let resolution = .75;

ctx.drawImage(
txt.canvas,
0, 0,
(this.width * resolution) << 0, ((this.height + this.pointer.height) * resolution) << 0
);

console.log(obj);
return void 0;

}

47 changes: 35 additions & 12 deletions src/Engine/Renderer/render.js
Original file line number Diff line number Diff line change
@@ -5,7 +5,8 @@ import {
DIMENSION,
DISPLAY_SHADOWS, SHADOW_X, SHADOW_Y,
RENDER_MODE, CANVAS, WGL,
MINI_MAP
MINI_MAP,
TYPES
} from "../../cfg";

import math from "../../Math";
@@ -23,6 +24,8 @@ export function render() {

this.update();

this.instance.logic();

this.draw();

if (DEBUG_MODE === true) {
@@ -202,14 +205,14 @@ export function renderEntities(lowest) {
for (; ii < length; ++ii) {
entity = entities[ii];
if (lowest === 0 && entity.zIndex <= 0) continue;
scaling = entity.scale + (-entity.z / resolution) / ((entity.size.x + entity.size.y) / 2);
scaling = entity.scale + (-entity.position.z / resolution) / ((entity.size.x + entity.size.y) / 2);
if (entity.renderable === false) continue;
this.updateEntitySpriteFrame(entity);
this.renderEntity(
entity,
/** Position */
(camX + (entity.position.x + entity.xMargin + ((entity.z / (entity.size.x / 2)) / 2)) * resolution) << 0,
(camY + (entity.position.y + entity.yMargin + entity.z) * resolution) << 0,
(camX + (entity.position.x + entity.xMargin + ((entity.position.z / (entity.size.x / 2)) / 2)) * resolution) << 0,
(camY + (entity.position.y + entity.yMargin + entity.position.z) * resolution) << 0,
/** Size */
(entity.size.x * resolution) * scaling << 0, (entity.size.y * resolution) * scaling << 0,
/** Scale */
@@ -261,14 +264,34 @@ export function renderEntity(entity, x, y, width, height, eWidth, eHeight) {
}
}

this.context.drawImage(
entity.texture.effect_sprites[entity.sFrame].canvas,
0, 0,
/** Scale */
eWidth, eHeight,
x, y,
width, height
);
if (entity.type === TYPES.Notification) {
let padding = (
(
(
(Math.max(entity.follow.width, entity.width / 2) / 2) - entity.follow.width / 2
)
- entity.follow.xMargin - (entity.size.x === entity.follow.size.x ? DIMENSION : 0)
)
* resolution
);
this.context.drawImage(
entity.texture.canvas,
0, 0,
/** Scale */
eWidth, eHeight,
x - padding, y - (entity.size.y * resolution),
width, height
);
} else {
this.context.drawImage(
entity.texture.effect_sprites[entity.sFrame].canvas,
0, 0,
/** Scale */
eWidth, eHeight,
x, y,
width, height
);
}

/** Reset ctx opacity */
if (cOpacity === true) {
43 changes: 37 additions & 6 deletions src/Engine/index.js
Original file line number Diff line number Diff line change
@@ -6,7 +6,8 @@ import {
DIMENSION,
LEFT, RIGHT, UP, DOWN,
WGL_SUPPORT,
MIN_SCALE
MIN_SCALE,
TYPES
} from "../cfg";

import {
@@ -19,11 +20,12 @@ import * as logic from "./logic";
import * as map from "./Map/functions";
import * as entity from "./Entity/functions";

import Camera from "./Camera";
import Editor from "./Editor";
import MiniMap from "./MiniMap";
import Environment from "./Environment";
import Notification from "./Notification";
import DisplayObject from "./DisplayObject";
import Camera from "./Camera";

import { Language } from "./Language";

@@ -171,8 +173,6 @@ export default class Engine extends DisplayObject {

this.camera.scale = MIN_SCALE;

setInterval(() => this.logic(), 1e3 / 60);

}

/**
@@ -295,15 +295,46 @@ export default class Engine extends DisplayObject {
let pushEntity = map.addEntity(tpl);

pushEntity.opacity = .0;

pushEntity.fadeIn(2);

pushEntity.lifeTime = this.renderer.now + 60;

pushEntity.type = TYPES.Ping;

map.entities.push(pushEntity);

}

/**
* Trigger a notification
* @param {Object} entity
* @param {String} msg
*/
notify(entity, msg) {

let offset = entity || this.instance.localEntity;

let map = this.currentMap;

let notification = new Notification({
sprite: null,
hasShadow: false,
width: math.roundTo(this.context.measureText(String(msg)).width, DIMENSION),
height: 16,
msg: msg,
follow: entity
});

notification.type = TYPES.Notification;

notification.opacity = .0;
notification.fadeIn(2);
notification.lifeTime = this.renderer.now + (60 * (msg.length * 4));
notification.zIndex = 9999;

map.entities.push(notification);

}

/**
* Local entity walk to
* @param {Number} x
15 changes: 13 additions & 2 deletions src/Game/entities/Player/index.js
Original file line number Diff line number Diff line change
@@ -62,8 +62,8 @@ export class Player extends Entity {
* Shadow offsets
* @type {Number}
*/
this.shadowX = 0;
this.shadowY = -1.75;
this.shadowX = obj.shadowX === void 0 ? 0 : obj.shadowX;
this.shadowY = obj.shadowY === void 0 ? -1.75 : obj.shadowY;

/**
* Local player check
@@ -262,6 +262,17 @@ export class Player extends Entity {
Maps[this.map].actionTrigger(position, this);
}

/**
* Face a entity
* @param {Object} entity
*/
faceEntity(entity) {
let facing = this.oppositFacing(entity.facing);
if (this.facing !== facing) {
this.changeFacing(facing);
}
}

}

inherit(Player, movement);
2 changes: 1 addition & 1 deletion src/Game/entities/Player/movement.js
Original file line number Diff line number Diff line change
@@ -161,7 +161,7 @@ export function move(dir, resolve) {
*/
export function changeFacing(dir) {

if (this.STATES.LOCK === true) return void 0;
if (this.STATES.LOCK === true || this.moving === true) return void 0;

this.idleTime = 0;

16 changes: 14 additions & 2 deletions src/Game/index.js
Original file line number Diff line number Diff line change
@@ -126,12 +126,24 @@ export default class Game {

this.engine.addEntity(new player({ name: "Joy", map: "Town", x: 120, y: 120, sprite: "assets/img/200.png", width: 16, height: 16, collidable: true,
onCollide: {
JavaScript: function(entity) {
this.facing = this.oppositFacing(entity.facing);
JavaScript: function(entity, engine) {
this.faceEntity(entity);
console.log(engine.instance.notify(this, "Stop it fucktard!"));
}
}
}));

this.engine.addEntity(new player({ name: "Merlin", map: "Town", x: 176, y: 152, sprite: "assets/img/85.png", width: 16, height: 16, collidable: true, shadowY: -3,
onAction: {
EngelScript: `
if (trigger.facing == 2) {
kernel.notify(this, "Ameno");
}
this.faceEntity(trigger);
`
}
}));

if (OFFLINE_MODE) {
this.engine.addEntity(new player({ name: "Felix", map: "Town", x: 152, y: 128, sprite: "assets/img/0.png", width: 16, height: 16, isLocalPlayer: true, collidable: true }));
}
22 changes: 15 additions & 7 deletions src/Game/input.js
Original file line number Diff line number Diff line change
@@ -117,13 +117,6 @@ export const keys = [
name: "Y",
fire: function() {}
},
{
name: "Z",
fire: function() {
let local = this.engine.localEntity;
local.action();
}
},
/** BUGGY, KEY COMBOS DONT WORK WITHOUT THIS */
{
name: "G",
@@ -150,6 +143,21 @@ export const keys = [
}
}
},
{
name: "B",
spam: false,
fire: function() {
this.engine.notify(this.engine.localEntity, "Hello World");
}
},
{
name: "Z",
spam: false,
fire: function() {
let local = this.engine.localEntity;
local.action();
}
},
{
name: "X",
spam: false,
46 changes: 29 additions & 17 deletions src/cfg.js
Original file line number Diff line number Diff line change
@@ -65,7 +65,7 @@ export const VERSION = "0.1.0";
* @constant
* @type {Boolean}
*/
export const WGL_SUPPORT = supportWGL();
export const WGL_SUPPORT = false;

/**
* Walk by keyboard
@@ -130,20 +130,6 @@ export let MINI_MAP = true;
*/
export const DEBUG_FPS = 60;

/**
* Play bgm
* @constant
* @type {Number}
*/
export const BGM = false;

/**
* Play bgs
* @constant
* @type {Number}
*/
export const BGS = false;

/**
* Vertical depth sorting hack
* @constant
@@ -168,7 +154,7 @@ export const PIXEL_SCALE = .125;
* @constant
* @type {Number}
*/
export const MIN_SCALE = 2.0;
export const MIN_SCALE = 3.0;

/**
* @constant
@@ -238,13 +224,39 @@ export const DOWN = 0;
*/
export const GRAVITY = -1;

/**
* Play bgm
* @constant
* @type {Number}
*/
export const BGM = false;

/**
* Play bgs
* @constant
* @type {Number}
*/
export const BGS = true;

/**
* @constant
* @type {Object}
*/
export const VOLUME = {
LOCAL_PLAYER: 100,
NETWORK_PLAYER: 10
NETWORK_PLAYER: 10,
MUSIC: 50
};

/**
* @constant
* @type {Object}
*/
export const TYPES = {
Notification: 0,
MapEntity: 1,
Player: 2,
Ping: 3
};

/**
9 changes: 5 additions & 4 deletions worlds/kanto/town/town.js
Original file line number Diff line number Diff line change
@@ -4,7 +4,9 @@ return (function() {

var MAP = {
entities: [],
settings: {}
settings: {
music: "new-bark-town"
}
};

var x = 0;
@@ -141,9 +143,9 @@ return (function() {
EngelScript: `
if (trigger.facing == 2) {
if (FLAGS.GOT_STARTER_PKMN == false) {
console.log("You didnt got your starter pokemon yet!");
kernel.notify(trigger, "You didnt got your starter pokemon yet!");
} {
console.log("You successfully received your starter pkmn!", 2 * 2, FLAGS.GOT_STARTER_PKMN);
kernel.notify(trigger, "You successfully received your starter pkmn!", 2 * 2, FLAGS.GOT_STARTER_PKMN);
}
}
if (trigger.facing == 1) {
@@ -152,7 +154,6 @@ return (function() {
if (trigger.facing == 0) {
FLAGS.COUNTER -= 1;
}
console.log(FLAGS.COUNTER);
`
}
});

0 comments on commit 9ed9bdd

Please sign in to comment.