Add right click edit grid interaction

This commit is contained in:
asraelite 2018-03-05 11:10:20 +00:00
parent 2fbabc785e
commit 548fb99c8b
9 changed files with 65 additions and 28 deletions

View file

@ -1,16 +0,0 @@
import {context} from './index.mjs';
import * as edit from '../game/edit.mjs';
import * as world from '../world/index.mjs';
export function render() {
let ship = world.playerShip;
context.save();
context.translate(...ship.com);
context.rotate(ship.r);
let [cx, cy] = ship.localCom;
context.translate(-cx, -cy);
context.restore();
}

View file

@ -49,7 +49,7 @@ function renderButton(element) {
function renderItemButton(element) {
context.globalAlpha = 0.5;
if (element.mouseHeld) {
if (element.mouseHeld || element.rightMouseHeld) {
context.fillStyle = '#080808';
} else {
context.fillStyle = element.mouseOver ? '#222' : '#0e0e0e';

View file

@ -3,7 +3,6 @@ import * as draw from './draw.mjs';
import * as input from '../input.mjs';
import {render as renderWorld} from './world.mjs';
import {render as renderBackground} from './background.mjs';
import {render as renderEdit} from './edit.mjs';
import * as world from '../world/index.mjs';
import * as consts from '../consts.mjs';

View file

@ -1,7 +1,6 @@
import {canvas, context} from './index.mjs';
import {images as assets} from '../assets.mjs';
import * as world from '../world/index.mjs';
import * as edit from './edit.mjs';
import {state} from '../game/index.mjs';
export function render() {
@ -24,7 +23,7 @@ function renderShip(ship) {
ship.modules.forEach(m => {
let [mx, my] = [m.x, m.y];
if (state.editing) {
}
context.drawImage(m.currentImage, m.x, m.y, 1, 1);
});