[DEMO] Farkle game (Storyline)

Nov 30, 2012

Hello everyone,

I'd like to share a "simple" Farkle dice game I created months ago as my first experiment with Storyline.

It started out as a simple concept that ballooned outward until I couldn't justify spending more time on it...but it was kind of fun to build.

It's not fully visually designed - I was mostly testing the (new at the time) variables, triggers and JavaScript. I am aware of a couple errors in scoring, but my limited JavaScript knowledge prevented me from truly fixing them (programmers would probably have a good laugh at my clumsy code...).

If you don't know how to play, there are instructions within the game (see tab on the right side).

https://community.articulate.com/download/farkle

Let me know what you think, and enjoy!

Matthew Kliewer

15 Replies
Jeffrey Riley

Matthew,

I have a game that I created in Storyline that takes the player around a board. I have duplicated the movement of the players, questions, cards, etc. but not rolling the dice. Can you share how you did that? We only have one die in our game but it would be great to have it roll electronically.

Jeffrey Riley

Matthew Kliewer

Hi all, thanks for the kind words and feedback.

@Jeffrey - sorry I didn't see this earlier. The die rolls were made with JavaScript: 

  • sets the Javascript variable to a random number 1-6

var die = Math.floor(Math.random()*6 + 1);

  • gets the player so it can set the JavaScript variable to the Storyline variable

var player = GetPlayer();

player.SetVar("rollDie",die);

The variable names can be anything you want, of course (except for "player" - here's a link to more on Storyline JavaScript best practices.) If you want more than one die, just make and set more variables (die1, die2, etc.).

Hope that helps. Here's a link to the Storyline file if anyone is interested (beware - it's pretty messy!)

farkle.story

Matt

Matthew Kliewer

I forgot to mention - I changed the states of each die to show or hide based on the numbers that resulted from the code above. There was a "spin" animation so each time you hit "roll", it would run the code and reveal a random die image and animate it in. It would also tally those values in my case, to determine scoring.

If you're not animating the dice at all, you could have all the dice (1-6) as different states on one object, and change the state based on the random number. It's cleaner and easier to deal with in your project, but I wanted the spin animation badly enough to complicate my life, apparently....

Good luck with your game!

This discussion is closed. You can start a new discussion or contact Articulate Support.