DEV Community

Ioannis Gyftakis
Ioannis Gyftakis

Posted on

Make Rock, Paper, Scissor game with Ink "Game Engine"

Recently I discovered Ink narrative language by INKLE that you has the Inky editor and it is an alternative to Twine.

You can make interactive text based games easily but you can also insert media like images etc. It could also be useful to teach concepts more interactively, especially on the early steps of programming concepts to beginners.

So here is a simple Rock, Paper, Scissor game that uses basic building blocks of INK language like Choices, Knots, Conditionals, Variables, Lists.

Welcome to Rock, Paper, Scissor game

VAR choice = ""
LIST options = (Rock),(Paper),(Scissor)
VAR result = ""

-> main
=== main ===
Wanna play a round of «Rock, Paper, Scissor»?
    + [Yes]
        -> round
    + [No]
        -> DONE

=== round ===
What do you choose?
 + [Rock]
    ~ choice = "Rock"
 + [Paper]
    ~ choice = "Paper"
 + [Scissor]
    ~ choice = "Scissor"

- You chose {choice} 
~ result = LIST_RANDOM(options)
and I chose {result}.
{
    - choice == "Rock" && result == Scissor:
        You won!
    - choice == "Rock" && result == Paper:
        You lost!
    - choice == "Scissor" && result == Rock:
        You lost!
    - choice == "Scissor" && result == Paper:
        You won!
    - choice == "Paper" && result == Rock:
        You won!
    - choice == "Paper" && result == Scissor:
        You lost!
    - else:
        Draw!
}
-> main

-> END
Enter fullscreen mode Exit fullscreen mode

for more try watching this tutorial which is great.

  • Br, John

Top comments (0)