Skip to content

Commit

Permalink
Add more examples
Browse files Browse the repository at this point in the history
Merge pull request #98 from haroldo-ok/more-examples
  • Loading branch information
haroldo-ok authored Sep 9, 2024
2 parents b0bbd8f + 43b39ef commit 213e2d6
Show file tree
Hide file tree
Showing 4 changed files with 161 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vcs-game-maker",
"version": "0.23.1",
"version": "0.24.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
Expand Down
2 changes: 2 additions & 0 deletions src/components/ActionEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import '../blocks/sprites';
import blocklyToolboxTemplate from 'raw-loader!./blockly-toolbox.xml.hbs';
import blocklyToolboxPlayer0Movement from 'raw-loader!./blockly-toolbox-player0-movement.xml';
import blocklyToolboxPlayer1Movement from 'raw-loader!./blockly-toolbox-player1-movement.xml';
import blocklyToolboxBallMovement from 'raw-loader!./blockly-toolbox-ball-movement.xml';
import BlocklyBB from '../generators/bbasic';
import {useWorkspaceStorage, useErrorStorage} from '../hooks/project';
Expand Down Expand Up @@ -78,6 +79,7 @@ export default {
toolbox: Handlebars.compile(blocklyToolboxTemplate)({
blocklyToolboxPlayer0Movement,
blocklyToolboxPlayer1Movement,
blocklyToolboxBallMovement,
}),
},
workspaceStorage: useWorkspaceStorage(),
Expand Down
156 changes: 156 additions & 0 deletions src/components/blockly-toolbox-ball-movement.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
<category name="Ball movement" colour="#ff8800">
<category name="Vertically bouncing ball" colour="#ff8800">

<block type="controls_if">
<value name="IF0">
<block type="logic_negate">
<value name="BOOL">
<block type="variables_get">
<field name="VAR">Ball Y Speed</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="variables_set">
<field name="VAR">Ball X Speed</field>
<value name="VALUE">
<block type="math_number">
<field name="NUM">0</field>
</block>
</value>
<next>
<block type="variables_set">
<field name="VAR">Ball Y Speed</field>
<value name="VALUE">
<block type="math_number">
<field name="NUM">1</field>
</block>
</value>
<next>
<block type="sprite_ball_set">
<field name="VAR">ballx</field>
<value name="VALUE">
<shadow type="math_number">
<field name="NUM">80</field>
</shadow>
</value>
<next>
<block type="sprite_ball_set">
<field name="VAR">bally</field>
<value name="VALUE">
<shadow type="math_number">
<field name="NUM">64</field>
</shadow>
</value>
<next>
<block type="sprite_ball_set">
<field name="VAR">ballheight</field>
<value name="VALUE">
<shadow type="math_number">
<field name="NUM">6</field>
</shadow>
</value>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
<next>
<block type="sprite_ball_change">
<field name="VAR">bally</field>
<value name="DELTA">
<shadow type="math_number">
<field name="NUM">1</field>
</shadow>
<block type="variables_get">
<field name="VAR">Ball Y Speed</field>
</block>
</value>
<next>
<block type="controls_if">
<value name="IF0">
<block type="collision_get">
<field name="VAR0">playfield</field>
<field name="VAR1">ball</field>
</block>
</value>
<statement name="DO0">
<block type="controls_if">
<mutation else="1"></mutation>
<value name="IF0">
<block type="logic_compare">
<field name="OP">LT</field>
<value name="A">
<block type="variables_get">
<field name="VAR">Ball Y Speed</field>
</block>
</value>
<value name="B">
<block type="math_number">
<field name="NUM">2</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="variables_set">
<field name="VAR">Ball Y Speed</field>
<value name="VALUE">
<block type="math_number">
<field name="NUM">255</field>
</block>
</value>
</block>
</statement>
<statement name="ELSE">
<block type="variables_set">
<field name="VAR">Ball Y Speed</field>
<value name="VALUE">
<block type="math_number">
<field name="NUM">1</field>
</block>
</value>
</block>
</statement>
<next>
<block type="sprite_ball_change">
<field name="VAR">bally</field>
<value name="DELTA">
<shadow type="math_number">
<field name="NUM">1</field>
</shadow>
<block type="variables_get">
<field name="VAR">Ball Y Speed</field>
</block>
</value>
<next>
<block type="sprite_ball_change">
<field name="VAR">bally</field>
<value name="DELTA">
<shadow type="math_number">
<field name="NUM">1</field>
</shadow>
<block type="variables_get">
<field name="VAR">Ball Y Speed</field>
</block>
</value>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>

</category>
</category>
2 changes: 2 additions & 0 deletions src/components/blockly-toolbox.xml.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -211,5 +211,7 @@

{{{blocklyToolboxPlayer1Movement}}}

{{{blocklyToolboxBallMovement}}}

</category>
</xml>

0 comments on commit 213e2d6

Please sign in to comment.