Created
March 16, 2012 06:22
-
-
Save nickmain/2048771 to your computer and use it in GitHub Desktop.
Receiving mouse events in Blub Prolog
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
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