Skip to content

Instantly share code, notes, and snippets.

@hendrik-weiler
Last active August 29, 2015 14:18
Show Gist options
  • Save hendrik-weiler/0665ca4dfaee6717def2 to your computer and use it in GitHub Desktop.
Save hendrik-weiler/0665ca4dfaee6717def2 to your computer and use it in GitHub Desktop.
var index = 0;
var color1, color2;
function WasPressed(text) {
game.drawText(22,text+" was pressed",145,135,game.color(255,255,255,1),1);
//game.drawRectangle(1,135,125, 300,35,game.color(122,122,122,0.5),"line", 0)
}
function m() {
on = true;
while(true) {
var key2 = game.getKeyInput([0,1,2,3,4,5]);
color1 = color2 = game.color(255,255,255,1);
game.log(key2)
if(key2==1) {
index++;
if(index>1) {
index = 1;
}
}
if(key2==0) {
index--;
if(index<0) {
index = 0;
}
}
game.log('currentindex='+index);
if(index==0) {
color1 = game.color(125,255,255,1)
}
if(index==1) {
color2 = game.color(125,255,255,1)
}
game.drawText(2,"Items",45,135,color1,1);
game.drawText(3,"Quit Game",45,175,color2,1);
if(key2==4) {
if(index==0) {
WasPressed('Items');
}
if(index==1) {
WasPressed('Quit Game');
}
}
if(key2==5) {
game.removeDrawedText(2);
game.removeDrawedText(3);
game.removeDrawedText(22);
//game.removeDrawedRectangle(1);
game.getKeyInput([5,4]);
break;
}
}
}
function CallMenu() {
var key = game.getKeyInput([5,4]);
game.log(key)
if(key==5) {
game.log('pressed')
m();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment