Week 8: Finishing and sharing our games


Today we’ll publish our games so that anyone can play them. We’ll also add in a character that asks a riddle before you can win.

Programming concepts we’ll learn:

  • Using user input with selection logic

1: Asking the player a question

In this step we’ll add in an object that asks a riddle before you can win the game. Watch the video below to learn how to evaluate data that the user inputs to make a decision.

  • Add riddle object, make sure it is blocking the trophy object
  • When created from events
  • Add tag from sensing
  • Change tag to “riddle”
  • Set immovable to true from physics
  • Close and save script
  • Edit player script
  • Go to collision detection section and duplicate “if toucher has tag”
  • Change tag to “riddle”
  • If riddle started = false (to prevent constant annoying touch triggers)
  • Set riddle started to true
  • Create new number variable from variables
  • “Set number the meaning of life to _”
  • “Prompt for number with message” from operators, drag it into the set variable block
  • Type message “What is the meaning of life?” (or whatever you want)
  • “If” from control flow
  • =” from operators
  • “Number meaning of life” from variables in left side of =
  • “42” in right side of =
  • “Destroy myself” inside if block
  • Replace “myself” with “instance toucher”
  • Else,
  • Print “sorry! Try again soon.”
  • In 5000 ms, set riddle started to false

 

2: Publishing your game

In this step we’ll publish our game. Watch the video below to learn how publishing works.

  • To publish your game, first save it, then click Publish in the menu bar
  • Click publish again
  • Copy the link and share it
  • (show link open and game being played in another tab)

 

results matching ""

    No results matching ""