This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//We store chat messages for the player until they send us their input | |
//Otherwise the message will get sent and terminal writes it *next to* whatever they are typing! | |
function StreamHandler() { | |
this.addMessage = function(player, message) { | |
player.messages.push(message); | |
} | |
this.writeMessage = function(player, cb) { | |
if (player.messages.length > 0) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
@interface NSNotificationCenter (CHAdditions) | |
+ (void)addObserver:(id)observer forNotificationNamed:(NSString *)notificationName withBlock:(void (^)(NSNotification *note))block; | |
@end | |
#import "NSNotificationCenter+CHAdditions.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "BlockHacking.h" | |
typedef void (^twoObjectBlock)(id a, id b); | |
typedef void (^XYZBlock)(Class x, NSArray *y, id c, twoObjectBlock b); | |
XYZBlock arrayDoBlock = ^(Class x, NSArray *y, id c, twoObjectBlock b) { | |
for (x in y) { | |
b(c,x); | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//QPBattlefield.h | |
#import "ClonePilotBattlefield.h" | |
#import "QPBFState.h" | |
#import "QPBFTitleState.h" | |
#import "QPBFDrawingState.h" | |
#import "QPBFInputConstants.h" | |
@interface QPBattlefield : ClonePilotBattlefield |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[self.button1 setImage:[UIImage imageNamed:@"image_up.png"] forState:UIControlStateNormal]; | |
[self.button1 setImage:[UIImage imageNamed:@"image_down.png"] forState:UIControlStateSelected]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stage = 1 | |
def show_prompt(): | |
if stage == 1: | |
print "You are between a volcano and a supernova." | |
print "1 for volcano, 2 for supernova." | |
def restart_input(): | |
print "Nice try." | |
input_loop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loop() { | |
this.now = Date.now(); | |
var delta = this.now - this.last; | |
this.last = this.now; | |
this.dt = this.dt + delta; | |
if (this.dt < this.rate) { | |
window.requestAnimationFrame(this.loop.bind(this)); | |
return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TurboMover extends Component { | |
registrationNames() { | |
return ['velocity']; | |
} | |
getValue(name, hash) { | |
if (name == 'velocity') { | |
hash.vx = hash.vx * 20; //times speed | |
hash.vy = hash.vy * 20; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loopGamepadInput() { | |
var pads = navigator.getGamepads(); | |
if (pads) { | |
for (var i = 0; i < pads.length; i++) { | |
var gp = pads[i]; | |
if (!gp) { | |
break; | |
} | |
var x = gp.axes[0]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Play this game by pasting the script in https://auroriax.github.io/PuzzleScript/editor.html |
OlderNewer