Blockly Game: Zero Out

133 views
Skip to first unread message

Chris Johnson

unread,
May 4, 2018, 8:46:07 PM5/4/18
to Blockly
Firstly if this kind of post is not permitted then apologies. Feel free to delete.

Recently I discovered Blockly and thought I'd a fantastic additional to a game I prototyped back in 2015. So I decided to update the game for the web and use Blockly with Angular.

The game is called Zero Out and the goal is to create a computer program that will shift all the numbers in the grid to zero. You can write your program using the Blockly interface or directly in Javascript. There are 10 level and takes about 1-2 hours to play through.





Neil Fraser

unread,
May 4, 2018, 9:01:12 PM5/4/18
to blo...@googlegroups.com
That's really cool!  Best Blockly-based game I've seen in a long time.

Not using shadow blocks?  They make editing easier.

Feel free to steal the content from here for your documentation:
https://blockly-games.appspot.com/pond/docs.html?lang=en&mode=11 (blocks)
https://blockly-games.appspot.com/pond/docs.html?lang=en&mode=12 (JS)

This ought to go on the carousel, or something.

--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Neil Fraser

unread,
May 5, 2018, 5:36:56 PM5/5/18
to blo...@googlegroups.com
A couple more suggestions:

Update your version of Blockly.  That will get rid of the bug where if you right-click a loop block, the variable name shows up mangled in the menu.

Delete this line of code in your XML:
  <field name="VAR">i</field>
That way the loop variable will be a new letter for each loop.


Chris Johnson

unread,
May 6, 2018, 6:24:32 PM5/6/18
to Blockly
Thanks for the feedback. Have updated the game with all your suggestions.


On Sunday, 6 May 2018 07:06:56 UTC+9:30, Neil Fraser wrote:
A couple more suggestions:

Update your version of Blockly.  That will get rid of the bug where if you right-click a loop block, the variable name shows up mangled in the menu.

Delete this line of code in your XML:
  <field name="VAR">i</field>
That way the loop variable will be a new letter for each loop.


On 4 May 2018 at 18:00, Neil Fraser <ro...@neil.fraser.name> wrote:
That's really cool!  Best Blockly-based game I've seen in a long time.

Not using shadow blocks?  They make editing easier.

Feel free to steal the content from here for your documentation:
https://blockly-games.appspot.com/pond/docs.html?lang=en&mode=11 (blocks)
https://blockly-games.appspot.com/pond/docs.html?lang=en&mode=12 (JS)

This ought to go on the carousel, or something.
On 4 May 2018 at 17:46, Chris Johnson <nexf...@gmail.com> wrote:
Firstly if this kind of post is not permitted then apologies. Feel free to delete.

Recently I discovered Blockly and thought I'd a fantastic additional to a game I prototyped back in 2015. So I decided to update the game for the web and use Blockly with Angular.

The game is called Zero Out and the goal is to create a computer program that will shift all the numbers in the grid to zero. You can write your program using the Blockly interface or directly in Javascript. There are 10 level and takes about 1-2 hours to play through.





--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Neil Fraser

unread,
May 8, 2018, 12:44:26 AM5/8/18
to blo...@googlegroups.com
In the Block editor a if/elseif/elseif/else block is counted as one 'if' statement, and the generated JS is shown as:

if (false) {
} else if (false) {
} else if (false) {
} else {
}

However, this same code copied and pasted into the Code editor counts as three 'if' statements.

Also, disabled blocks in the Block editor and commented-out code in the Code editor are both still counted in the results.

Looks like the Block editor is counting blocks, while the Code editor is regexing the code.  To be consistent, the Block editor should generate JS code, then use the same counting function as the Code editor.  And for accurate counts of the JS (from either editor) use Acorn.  It's already in your environment: type "acorn.parse('1+1')" in the console of Zero-out's iframe.  Just walk the AST that Acorn returns, and you'll get a 100% accurate count of conditionals, loops and function calls.

Still loving the game...

To unsubscribe from this group and stop receiving emails from it, send an email to blockly+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

rbu...@nfbconsulting.com

unread,
May 9, 2018, 7:49:23 PM5/9/18
to Blockly
Chris,

I'm working on integrating Blockly into an AngularJS application and running into some difficulties. Is this app on github by chance?

Warmly,

Ryan Busby

Chris Johnson

unread,
May 10, 2018, 8:55:10 AM5/10/18
to blo...@googlegroups.com
This may sound surprising but I didn't even play around with the cog on the if blocks so I never realised they could be expanded. I've made the changes you suggested Neil, except for using acorn to walk the AST.

@Ryan I've just setup a public repo on BitBucket with the code. I hope you find it useful.

--
You received this message because you are subscribed to a topic in the Google Groups "Blockly" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/blockly/FHaHJOja9sY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to blockly+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Chris Johnson
Game Designer from Adelaide, South Australia

rbu...@nfbconsulting.com

unread,
May 10, 2018, 12:48:32 PM5/10/18
to Blockly
Chris,

I appreciate you.


Warmly,

Ryan Busby

On Thursday, May 10, 2018 at 5:55:10 AM UTC-7, Chris Johnson wrote:
This may sound surprising but I didn't even play around with the cog on the if blocks so I never realised they could be expanded. I've made the changes you suggested Neil, except for using acorn to walk the AST.

@Ryan I've just setup a public repo on BitBucket with the code. I hope you find it useful.
On Thu, May 10, 2018 at 9:19 AM, <rbu...@nfbconsulting.com> wrote:
Chris,

I'm working on integrating Blockly into an AngularJS application and running into some difficulties. Is this app on github by chance?

Warmly,

Ryan Busby


On Friday, May 4, 2018 at 5:46:07 PM UTC-7, Chris Johnson wrote:
Firstly if this kind of post is not permitted then apologies. Feel free to delete.

Recently I discovered Blockly and thought I'd a fantastic additional to a game I prototyped back in 2015. So I decided to update the game for the web and use Blockly with Angular.

The game is called Zero Out and the goal is to create a computer program that will shift all the numbers in the grid to zero. You can write your program using the Blockly interface or directly in Javascript. There are 10 level and takes about 1-2 hours to play through.





--
You received this message because you are subscribed to a topic in the Google Groups "Blockly" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/blockly/FHaHJOja9sY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to blockly+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages