Skip to content

Commit

Permalink
Start the ball a-bouncing.
Browse files Browse the repository at this point in the history
  • Loading branch information
jessmartin committed Dec 20, 2013
1 parent 7446b8c commit 44ecb80
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 15 deletions.
8 changes: 4 additions & 4 deletions ball.dae
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<contributor>
<authoring_tool>SketchUp 13.0.4811</authoring_tool>
</contributor>
<created>2013-12-19T00:04:27Z</created>
<modified>2013-12-19T00:04:27Z</modified>
<created>2013-12-20T15:18:32Z</created>
<modified>2013-12-20T15:18:32Z</modified>
<unit meter="0.0254000" name="inch" />
<up_axis>Z_UP</up_axis>
</asset>
Expand All @@ -31,7 +31,7 @@
<geometry id="ID2">
<mesh>
<source id="ID5">
<float_array id="ID10" count="144">239.9712683 5.8548035 10.0481001 239.9712683 -4.1255775 0.0481001 239.9712683 -4.1255775 10.0481001 239.9712683 5.8548035 0.0481001 239.9712683 5.8548035 0.0481001 239.9712683 5.8548035 10.0481001 239.9712683 -4.1255775 0.0481001 239.9712683 -4.1255775 10.0481001 249.9712683 5.8548035 0.0481001 239.9712683 -4.1255775 0.0481001 239.9712683 5.8548035 0.0481001 249.9712683 -4.1255775 0.0481001 249.9712683 -4.1255775 0.0481001 249.9712683 5.8548035 0.0481001 239.9712683 -4.1255775 0.0481001 239.9712683 5.8548035 0.0481001 249.9712683 -4.1255775 10.0481001 239.9712683 -4.1255775 0.0481001 249.9712683 -4.1255775 0.0481001 239.9712683 -4.1255775 10.0481001 239.9712683 -4.1255775 10.0481001 249.9712683 -4.1255775 10.0481001 239.9712683 -4.1255775 0.0481001 249.9712683 -4.1255775 0.0481001 249.9712683 -4.1255775 10.0481001 239.9712683 5.8548035 10.0481001 239.9712683 -4.1255775 10.0481001 249.9712683 5.8548035 10.0481001 249.9712683 5.8548035 10.0481001 249.9712683 -4.1255775 10.0481001 239.9712683 5.8548035 10.0481001 239.9712683 -4.1255775 10.0481001 239.9712683 5.8548035 10.0481001 249.9712683 5.8548035 0.0481001 239.9712683 5.8548035 0.0481001 249.9712683 5.8548035 10.0481001 249.9712683 5.8548035 10.0481001 239.9712683 5.8548035 10.0481001 249.9712683 5.8548035 0.0481001 239.9712683 5.8548035 0.0481001 249.9712683 5.8548035 0.0481001 249.9712683 -4.1255775 10.0481001 249.9712683 -4.1255775 0.0481001 249.9712683 5.8548035 10.0481001 249.9712683 5.8548035 10.0481001 249.9712683 5.8548035 0.0481001 249.9712683 -4.1255775 10.0481001 249.9712683 -4.1255775 0.0481001</float_array>
<float_array id="ID10" count="144">239.9712683 4.9485535 10.0481001 239.9712683 -5.0318275 0.0481001 239.9712683 -5.0318275 10.0481001 239.9712683 4.9485535 0.0481001 239.9712683 4.9485535 0.0481001 239.9712683 4.9485535 10.0481001 239.9712683 -5.0318275 0.0481001 239.9712683 -5.0318275 10.0481001 249.9712683 4.9485535 0.0481001 239.9712683 -5.0318275 0.0481001 239.9712683 4.9485535 0.0481001 249.9712683 -5.0318275 0.0481001 249.9712683 -5.0318275 0.0481001 249.9712683 4.9485535 0.0481001 239.9712683 -5.0318275 0.0481001 239.9712683 4.9485535 0.0481001 249.9712683 -5.0318275 10.0481001 239.9712683 -5.0318275 0.0481001 249.9712683 -5.0318275 0.0481001 239.9712683 -5.0318275 10.0481001 239.9712683 -5.0318275 10.0481001 249.9712683 -5.0318275 10.0481001 239.9712683 -5.0318275 0.0481001 249.9712683 -5.0318275 0.0481001 249.9712683 -5.0318275 10.0481001 239.9712683 4.9485535 10.0481001 239.9712683 -5.0318275 10.0481001 249.9712683 4.9485535 10.0481001 249.9712683 4.9485535 10.0481001 249.9712683 -5.0318275 10.0481001 239.9712683 4.9485535 10.0481001 239.9712683 -5.0318275 10.0481001 239.9712683 4.9485535 10.0481001 249.9712683 4.9485535 0.0481001 239.9712683 4.9485535 0.0481001 249.9712683 4.9485535 10.0481001 249.9712683 4.9485535 10.0481001 239.9712683 4.9485535 10.0481001 249.9712683 4.9485535 0.0481001 239.9712683 4.9485535 0.0481001 249.9712683 4.9485535 0.0481001 249.9712683 -5.0318275 10.0481001 249.9712683 -5.0318275 0.0481001 249.9712683 4.9485535 10.0481001 249.9712683 4.9485535 10.0481001 249.9712683 4.9485535 0.0481001 249.9712683 -5.0318275 10.0481001 249.9712683 -5.0318275 0.0481001</float_array>
<technique_common>
<accessor count="48" source="#ID10" stride="3">
<param name="X" type="float" />
Expand All @@ -41,7 +41,7 @@
</technique_common>
</source>
<source id="ID6">
<float_array id="ID11" count="144">-1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000</float_array>
<float_array id="ID11" count="144">-1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 1.0000000 -0.0000000 -0.0000000 -1.0000000 -0.0000000 -0.0000000 -1.0000000 -0.0000000 -0.0000000 -1.0000000 -0.0000000 -0.0000000 -1.0000000 0.0000000 1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 -0.0000000 -1.0000000 -0.0000000 -0.0000000 -1.0000000 -0.0000000 -0.0000000 -1.0000000 -0.0000000 -0.0000000 -1.0000000 -0.0000000 1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 -1.0000000 -0.0000000 -0.0000000 -1.0000000 -0.0000000 -0.0000000 -1.0000000 -0.0000000 -0.0000000 -1.0000000 -0.0000000 -0.0000000</float_array>
<technique_common>
<accessor count="48" source="#ID11" stride="3">
<param name="X" type="float" />
Expand Down
8 changes: 4 additions & 4 deletions board.dae
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<contributor>
<authoring_tool>SketchUp 13.0.4811</authoring_tool>
</contributor>
<created>2013-12-19T00:59:13Z</created>
<modified>2013-12-19T00:59:13Z</modified>
<created>2013-12-20T15:18:45Z</created>
<modified>2013-12-20T15:18:45Z</modified>
<unit meter="0.0254000" name="inch" />
<up_axis>Z_UP</up_axis>
</asset>
Expand All @@ -31,7 +31,7 @@
<geometry id="ID2">
<mesh>
<source id="ID5">
<float_array id="ID10" count="144">499.4900415 -149.9741232 0.0000000 -0.5099585 150.0258768 0.0000000 -0.5099585 -149.9741232 0.0000000 499.4900415 150.0258768 0.0000000 499.4900415 150.0258768 0.0000000 499.4900415 -149.9741232 0.0000000 -0.5099585 150.0258768 0.0000000 -0.5099585 -149.9741232 0.0000000 499.4900415 150.0258768 -2.0000000 499.4900415 -149.9741232 0.0000000 499.4900415 -149.9741232 -2.0000000 499.4900415 150.0258768 0.0000000 499.4900415 150.0258768 0.0000000 499.4900415 150.0258768 -2.0000000 499.4900415 -149.9741232 0.0000000 499.4900415 -149.9741232 -2.0000000 -0.5099585 150.0258768 0.0000000 499.4900415 150.0258768 -2.0000000 -0.5099585 150.0258768 -2.0000000 499.4900415 150.0258768 0.0000000 499.4900415 150.0258768 0.0000000 -0.5099585 150.0258768 0.0000000 499.4900415 150.0258768 -2.0000000 -0.5099585 150.0258768 -2.0000000 -0.5099585 150.0258768 0.0000000 -0.5099585 -149.9741232 -2.0000000 -0.5099585 -149.9741232 0.0000000 -0.5099585 150.0258768 -2.0000000 -0.5099585 150.0258768 -2.0000000 -0.5099585 150.0258768 0.0000000 -0.5099585 -149.9741232 -2.0000000 -0.5099585 -149.9741232 0.0000000 499.4900415 -149.9741232 0.0000000 -0.5099585 -149.9741232 -2.0000000 499.4900415 -149.9741232 -2.0000000 -0.5099585 -149.9741232 0.0000000 -0.5099585 -149.9741232 0.0000000 499.4900415 -149.9741232 0.0000000 -0.5099585 -149.9741232 -2.0000000 499.4900415 -149.9741232 -2.0000000 499.4900415 150.0258768 -2.0000000 -0.5099585 -149.9741232 -2.0000000 -0.5099585 150.0258768 -2.0000000 499.4900415 -149.9741232 -2.0000000 499.4900415 -149.9741232 -2.0000000 499.4900415 150.0258768 -2.0000000 -0.5099585 -149.9741232 -2.0000000 -0.5099585 150.0258768 -2.0000000</float_array>
<float_array id="ID10" count="144">499.4900415 -150.0053732 0.0000000 -0.5099585 149.9946268 0.0000000 -0.5099585 -150.0053732 0.0000000 499.4900415 149.9946268 0.0000000 499.4900415 149.9946268 0.0000000 499.4900415 -150.0053732 0.0000000 -0.5099585 149.9946268 0.0000000 -0.5099585 -150.0053732 0.0000000 499.4900415 149.9946268 -2.0000000 499.4900415 -150.0053732 0.0000000 499.4900415 -150.0053732 -2.0000000 499.4900415 149.9946268 0.0000000 499.4900415 149.9946268 0.0000000 499.4900415 149.9946268 -2.0000000 499.4900415 -150.0053732 0.0000000 499.4900415 -150.0053732 -2.0000000 -0.5099585 149.9946268 0.0000000 499.4900415 149.9946268 -2.0000000 -0.5099585 149.9946268 -2.0000000 499.4900415 149.9946268 0.0000000 499.4900415 149.9946268 0.0000000 -0.5099585 149.9946268 0.0000000 499.4900415 149.9946268 -2.0000000 -0.5099585 149.9946268 -2.0000000 -0.5099585 149.9946268 0.0000000 -0.5099585 -150.0053732 -2.0000000 -0.5099585 -150.0053732 0.0000000 -0.5099585 149.9946268 -2.0000000 -0.5099585 149.9946268 -2.0000000 -0.5099585 149.9946268 0.0000000 -0.5099585 -150.0053732 -2.0000000 -0.5099585 -150.0053732 0.0000000 499.4900415 -150.0053732 0.0000000 -0.5099585 -150.0053732 -2.0000000 499.4900415 -150.0053732 -2.0000000 -0.5099585 -150.0053732 0.0000000 -0.5099585 -150.0053732 0.0000000 499.4900415 -150.0053732 0.0000000 -0.5099585 -150.0053732 -2.0000000 499.4900415 -150.0053732 -2.0000000 499.4900415 149.9946268 -2.0000000 -0.5099585 -150.0053732 -2.0000000 -0.5099585 149.9946268 -2.0000000 499.4900415 -150.0053732 -2.0000000 499.4900415 -150.0053732 -2.0000000 499.4900415 149.9946268 -2.0000000 -0.5099585 -150.0053732 -2.0000000 -0.5099585 149.9946268 -2.0000000</float_array>
<technique_common>
<accessor count="48" source="#ID10" stride="3">
<param name="X" type="float" />
Expand All @@ -41,7 +41,7 @@
</technique_common>
</source>
<source id="ID6">
<float_array id="ID11" count="144">-0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 -1.0000000 -0.0000000 -0.0000000 -1.0000000 -0.0000000 -0.0000000 -1.0000000 -0.0000000 -0.0000000 -1.0000000 -0.0000000 -0.0000000 -0.0000000 1.0000000 0.0000000 -0.0000000 1.0000000 0.0000000 -0.0000000 1.0000000 0.0000000 -0.0000000 1.0000000 0.0000000 0.0000000 -1.0000000 -0.0000000 0.0000000 -1.0000000 -0.0000000 0.0000000 -1.0000000 -0.0000000 0.0000000 -1.0000000 -0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 -0.0000000 -1.0000000 -0.0000000 -0.0000000 -1.0000000 -0.0000000 -0.0000000 -1.0000000 -0.0000000 -0.0000000 -1.0000000 -0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000</float_array>
<float_array id="ID11" count="144">0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 1.0000000 -0.0000000 -0.0000000 -1.0000000 -0.0000000 -0.0000000 -1.0000000 -0.0000000 -0.0000000 -1.0000000 -0.0000000 -0.0000000 -1.0000000 1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 -1.0000000 -0.0000000 -0.0000000 -1.0000000 -0.0000000 -0.0000000 -1.0000000 -0.0000000 -0.0000000 -1.0000000 -0.0000000 -0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 -0.0000000 -1.0000000 -0.0000000 -0.0000000 -1.0000000 -0.0000000 -0.0000000 -1.0000000 -0.0000000 -0.0000000 -1.0000000 -0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 -0.0000000 -1.0000000 -0.0000000 -0.0000000 -1.0000000 -0.0000000 -0.0000000 -1.0000000 -0.0000000 -0.0000000 -1.0000000 -0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000 -0.0000000 -0.0000000 1.0000000</float_array>
<technique_common>
<accessor count="48" source="#ID11" stride="3">
<param name="X" type="float" />
Expand Down
30 changes: 23 additions & 7 deletions index.vwf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ extends: http://vwf.example.com/scene.vwf
methods:
initializeCamera:
initializeGame:
bounce:
children:
playerOne:
extends: http://vwf.example.com/node3.vwf
Expand All @@ -26,11 +25,33 @@ children:
ball:
extends: http://vwf.example.com/node3.vwf
source: ball.dae
properties:
xSpeed: 1
ySpeed: 3
children:
material:
extends: http://vwf.example.com/material.vwf
properties:
color: "#0000ff"
methods:
bounce: |
var topX = 230;
var topY = 145;
var bottomY = -145;
var bottomX = -230;
//
var trans = this.translation;
var newTrans = [ trans[0] + this.xSpeed, trans[1] + this.ySpeed, trans[2] ];
if (newTrans[1] >= topY) {
// Wall was hit
newTrans[1] = topY;
this.ySpeed = -this.ySpeed;
} else if (newTrans[1] <= bottomY) {
newTrans[1] = bottomY;
this.ySpeed = -this.ySpeed;
}
this.translateTo( newTrans );
this.future( 0.05 ).bounce(); // schedule the next step
board:
extends: http://vwf.example.com/node3.vwf
source: board.dae
Expand All @@ -56,10 +77,5 @@ scripts:
this.camera.rotation = [ 1, 0, 0, -10 ];
}
this.initializeGame = function() {
this.bounce();
}
this.bounce = function() {
console.log("bouncing");
this.ball.translation[0] += 100;
this.future( 0.05 ).bounce(); // schedule the next step
this.ball.bounce();
}

0 comments on commit 44ecb80

Please sign in to comment.