Skip to content

Instantly share code, notes, and snippets.

@nickmain
Created March 16, 2012 06:22
Show Gist options
  • Save nickmain/2048771 to your computer and use it in GitHub Desktop.
Save nickmain/2048771 to your computer and use it in GitHub Desktop.
Receiving mouse events in Blub Prolog
sprite( X, Y ) :-
sprite(S),
S.x <- X, S.y <- Y,
paint(S,0x8888ff),
spawn(( repeat,
receive(S,mouseMove,E),
S.x <- E.stageX - 50,
S.y <- E.stageY - 30 )).
paint(Sprite,Color) :-
G <- Sprite.graphics,
G.clear(void),
G.beginFill( Color, 1 ),
G.lineStyle( 0, 0 ),
G.drawEllipse( 0, 0, 100, 60 ),
G.endFill(void).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment