Storyline 360 added a number of new object events that can be used to check when an object:
- intersects with another object (or objects)
- doesn’t intersect with an object any longer
- enters a slide, or
- leaves a slide.
The most obvious application for these events would be ‘collision detection’. I thought that creating a simple game, like the good old Pong (a game that was first introduced in the 70s) would be a good test case to try out these events.
The idea seemed simple: move an object along randomly selected motion paths at different angles and duration until it hits one of two movable ‘paddles’, intersects with the bottom or top wall, or leaves the slide on either side.
For my test, I just used a couple of motion paths that bounce the pong object back and forth. I did set up a question bank that could be used to randomize the initial motion path. The paddle on the right (‘MyPaddle’) can be moved with the mouse. The left paddle (“OpponentPaddle’) can be moved as well, although for the test I just automatically move it up/down a few steps. The original plan was to allow the left paddle to be moved by up/down keypresses. That didn’t work out though because in SL360, keypresses require you to click an object first. As an alternative, the paddle’s position could be randomly set, by either Javascript or a random number drawn from a question bank.
Also, my first idea was to use sliders for the paddles. It turns out that sliders, although they can be selected as an intersecting object, do not generate ‘hits’. So, I had to use transparent objects that are turned on/off depending on the position of the paddle sliders. Whenever the pong object hits one of the paddles a sound is played and the current motion path is reversed. If neither paddle is hit, the pong object will continue on the selected motion path and eventually leave the slide on either side. When the object leaves the slide:
- a sound is played
- a score is calculated (depending on which side of the slide the object existed)
- a new motion path is drawn and the interaction is repeated until one of the players has reached 10 points.
In Preview this works flawlessly. However, I did notice that in the published version, both HTML5 and Flash, the interaction randomly locks up. But that’s the point of an experiment; sometimes it just doesn’t work out as expected and that’s okay. I did learn enough about the Storyline mechanics of a pong-like game, so that I could expand on the prototype anytime and create a full-featured game interaction.
Here is a first version of the interaction.
Edit 04/2017: It seems that changing the browser and player settings to lock the interaction at its optimal size improves the stability of the published content. Here is a version with edited player settings.