Skip to content

Instantly share code, notes, and snippets.

@Kirkman
Kirkman / gist:a8f9162bd51c4572b0aa
Created January 15, 2015 03:41
maskFrame() function
function maskFrame(theFrame,maskChar,maskAttr) {
var x, y, xl, yl;
xl = theFrame.data.length;
for (x=0; x<xl; x++) {
yl = theFrame.data[x].length;
for (y=0; y<yl; y++) {
var theChar = theFrame.data[x][y];
if (theChar.ch == maskChar && theChar.attr == maskAttr) {
theFrame.data[x][y].ch = undefined;
theFrame.data[x][y].attr = undefined;
@Kirkman
Kirkman / gist:fc53eac2c6818604022d
Last active August 29, 2015 14:13
Sample scrolling routine. Uses frame.scrollCircular() method.
function gamePlay() {
player.sprite = new Sprite.Profile("girl-walking", bgFrame, 18, 9, 'e', 'stand');
// Mask the sprite. 219 = solid block. 2 = green
maskFrame( player.sprite.frame, ascii(219), 2 );
player.sprite.frame.draw();
var userInput = '';
while( ascii(userInput) != 13 ) {
userInput = console.getkey(K_UPPER | K_NOCRLF);
@Kirkman
Kirkman / gist:87532d5e3bc5cd8ed844
Last active August 29, 2015 14:13
Circular scrolling for Synchronet's frame.js
this.scrollCircular = function(x,y) {
var update = false;
if (typeof y == "number" && y > 0 && settings.v_scroll) {
for (var i=0; i<y; i++) {
var rowToMove = properties.data.shift();
properties.data.push(rowToMove);
update = true;
}
}