Skip to content

Commit

Permalink
Add example on how to bounce a ball
Browse files Browse the repository at this point in the history
Merge pull request #126 from haroldo-ok/example-bounce-ball
Fix #123
  • Loading branch information
haroldo-ok authored Oct 26, 2024
2 parents e7d2706 + ed617b7 commit e3a2d5d
Show file tree
Hide file tree
Showing 2 changed files with 277 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.25.6",
"version": "0.26.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
Expand Down
276 changes: 276 additions & 0 deletions src/components/blockly-toolbox-ball-movement.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<category name="Ball movement" colour="#ff8800">

<category name="Vertically bouncing ball" colour="#ff8800">

<block type="controls_if">
Expand Down Expand Up @@ -153,4 +154,279 @@
</block>

</category>

<category name="Diagonally 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">1</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">3</field>
</shadow>
</value>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
<next>
<block type="controls_if">
<mutation else="1"></mutation>
<value name="IF0">
<block type="variables_get">
<field name="VAR">Even Frame</field>
</block>
</value>
<statement name="DO0">
<block type="variables_set">
<field name="VAR">Even Frame</field>
<value name="VALUE">
<block type="logic_boolean">
<field name="BOOL">FALSE</field>
</block>
</value>
</block>
</statement>
<statement name="ELSE">
<block type="variables_set">
<field name="VAR">Even Frame</field>
<value name="VALUE">
<block type="logic_boolean">
<field name="BOOL">TRUE</field>
</block>
</value>
</block>
</statement>
<next>
<block type="controls_if">
<mutation else="1"></mutation>
<value name="IF0">
<block type="variables_get">
<field name="VAR">Even Frame</field>
</block>
</value>
<statement name="DO0">
<block type="controls_if">
<value name="IF0">
<block type="collision_get">
<field name="VAR0">ball</field>
<field name="VAR1">playfield</field>
</block>
</value>
<statement name="DO0">
<block type="simple_sound_set">
<field name="AUDC">1</field>
<field name="AUDF">16</field>
<field name="AUDV">7</field>
<field name="DURATION">5</field>
<field name="CHANNEL">0</field>
<next>
<block type="controls_if">
<mutation else="1"></mutation>
<value name="IF0">
<block type="logic_compare">
<field name="OP">EQ</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">1</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>
</block>
</next>
</block>
</next>
</block>
</statement>
<next>
<block type="sprite_ball_change">
<field name="VAR">ballx</field>
<value name="DELTA">
<shadow type="math_number">
<field name="NUM">1</field>
</shadow>
<block type="variables_get">
<field name="VAR">Ball X Speed</field>
</block>
</value>
</block>
</next>
</block>
</statement>
<statement name="ELSE">
<block type="controls_if">
<value name="IF0">
<block type="collision_get">
<field name="VAR0">ball</field>
<field name="VAR1">playfield</field>
</block>
</value>
<statement name="DO0">
<block type="simple_sound_set">
<field name="AUDC">1</field>
<field name="AUDF">15</field>
<field name="AUDV">7</field>
<field name="DURATION">5</field>
<field name="CHANNEL">0</field>
<next>
<block type="controls_if">
<mutation else="1"></mutation>
<value name="IF0">
<block type="logic_compare">
<field name="OP">EQ</field>
<value name="A">
<block type="variables_get">
<field name="VAR">Ball X Speed</field>
</block>
</value>
<value name="B">
<block type="math_number">
<field name="NUM">1</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">255</field>
</block>
</value>
</block>
</statement>
<statement name="ELSE">
<block type="variables_set">
<field name="VAR">Ball X 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">ballx</field>
<value name="DELTA">
<shadow type="math_number">
<field name="NUM">1</field>
</shadow>
<block type="variables_get">
<field name="VAR">Ball X Speed</field>
</block>
</value>
</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>
</block>
</next>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</category>

</category>

0 comments on commit e3a2d5d

Please sign in to comment.