Updated pixelScale to OS.S, added controls for WASD and Arrows.

This commit is contained in:
Robbie Antenesse 2016-04-04 23:37:01 -06:00
parent 9b6bc0f07d
commit 9886b403e5
4 changed files with 45 additions and 8 deletions

View File

@ -1,9 +1,46 @@
var ct_up = OS.C.Add("WASD Up", OS.Keycode.w);
var ct_left = OS.C.Add("WASD Left", OS.Keycode.a);
var ct_down = OS.C.Add("WASD Down", OS.Keycode.s);
var ct_right = OS.C.Add("WASD Right", OS.Keycode.d);
var ct_wasd_up = OS.C.Add("WASD Up", OS.Keycode.w);
var ct_wasd_left = OS.C.Add("WASD Left", OS.Keycode.a);
var ct_wasd_down = OS.C.Add("WASD Down", OS.Keycode.s);
var ct_wasd_right = OS.C.Add("WASD Right", OS.Keycode.d);
var ct_arrow_up = OS.C.Add("Arrow Up", OS.Keycode.up);
var ct_arrow_left = OS.C.Add("Arrow Left", OS.Keycode.left);
var ct_arrow_down = OS.C.Add("Arrow Down", OS.Keycode.down);
var ct_arrow_right = OS.C.Add("Arrow Right", OS.Keycode.right);
var ct_shift = OS.C.Add("Shift", OS.Keycode.shift);
var ct_space = OS.C.Add("Space", OS.Keycode.space);
var ct_space = OS.C.Add("Confirm", OS.Keycode.space);
var ct_esc = OS.C.Add("Cancel", OS.Keycode.escape);
function loadControls () {}
function ct_up () {
return {
held : ct_wasd_up.held || ct_arrow_up.held,
down : ct_wasd_up.down || ct_arrow_up.down,
up : ct_wasd_up.up || ct_arrow_up.up
}
}
function ct_left () {
return {
held : ct_wasd_left.held || ct_arrow_left.held,
down : ct_wasd_left.down || ct_arrow_left.down,
up : ct_wasd_left.up || ct_arrow_left.up
}
}
function ct_down () {
return {
held : ct_wasd_down.held || ct_arrow_down.held,
down : ct_wasd_down.down || ct_arrow_down.down,
up : ct_wasd_down.up || ct_arrow_down.up
}
}
function ct_right () {
return {
held : ct_wasd_right.held || ct_arrow_right.held,
down : ct_wasd_right.down || ct_arrow_right.down,
up : ct_wasd_right.up || ct_arrow_right.up
}
}

View File

@ -1,7 +1,6 @@
var Game = {};
G = Game;
G.pixelSize = 4;
G.player = {};
G.map = {};

View File

@ -1,5 +1,5 @@
var rm_TitleScreen = OS.R.Add("Default", OS.camera.width, OS.camera.height, "");
var rm_Ocean = OS.R.Add("Ocean", 64 * 1000 * G.pixelSize, 64 * 1000 * G.pixelSize, "");
var rm_Ocean = OS.R.Add("Ocean", 64 * 1000 * OS.S.pixelScale, 64 * 1000 * OS.S.pixelScale, "");
function loadRooms() {
OS.AddScript("rooms/titleScreen.js");

View File

@ -1,5 +1,6 @@
OS.S.defaultStep = 1 / 120;
OS.S.SetCamera((window.innerWidth < 500) ? window.innerWidth - 10 : 500, (window.innerHeight < 800) ? window.innerHeight - 10 : 800);
OS.S.pixelScale = 4;
OS.S.SetCamera(64 * OS.S.pixelScale, 64 * OS.S.pixelScale);
function start()
{