Skip to content

Instantly share code, notes, and snippets.

@ezfe
Created July 12, 2016 22:16
Show Gist options
  • Save ezfe/fe0426be4e5f790b7c3409327c680f3b to your computer and use it in GitHub Desktop.
Save ezfe/fe0426be4e5f790b7c3409327c680f3b to your computer and use it in GitHub Desktop.
let somelocation = Position(x: 50.5, y: 90.13)
let cat = Sprite(name: "Cat")
cat.contents.addBlock(PressFlag())
cat.contents.addBlock(Say(text: "Hello"))
cat.contents.addBlock(GoTo(location: somelocation))
print(cat)
/*
Sprite[Cat]@(0.0,0.0)
*/
cat.eval(event: .Flag)
/*
Cat: Hello
Sprite[Cat] (0.0,0.0) -> (50.5,90.13)
*/
print(cat)
/*
Sprite[Cat]@(50.5,90.13)
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment