atm959

Some code.

Feb 19th, 2016
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.72 KB | None | 0 0
  1. user = System.getUsername()
  2. pad = Controls.read()
  3. console = Console.new(TOP_SCREEN)
  4. response = ""
  5. print("Hello " .. user .. "!")
  6. print("You are in a house. What do you do?")
  7. print("1: Eat food. PRESS UP")
  8. print("2: Watch TV. PRESS DOWN")
  9. print("3: Run away. PRESS LEFT")
  10. print("4: Call a friend. PRESS RIGHT")
  11. while true do
  12.    
  13.     if (Controls.check(pad, KEY_DUP)) then
  14.        
  15.         response = "eat"
  16.         break
  17.        
  18.     end
  19.    
  20.     if (Controls.check(pad, KEY_DDOWN)) then
  21.        
  22.         response = "tv"
  23.         break
  24.        
  25.     end
  26.    
  27.     if (Controls.check(pad, KEY_DLEFT)) then
  28.        
  29.         response = "run"
  30.         break
  31.        
  32.     end
  33.    
  34.     if (Controls.check(pad, KEY_DRIGHT)) then
  35.        
  36.         response = "call"
  37.         break
  38.        
  39.     end
  40.    
  41. end
  42.  
  43. if (response == "eat") then
  44.    
  45.     print("You ate a hearty meal. Now what do you do?")
  46.     print("1: Exit the game. PRESS UP")
  47.     print("2: Exit the game. PRESS DOWN")
  48.     print("3: Exit the game. PRESS LEFT")
  49.     print("4: Exit the game. PRESS RIGHT")
  50.    
  51. end
  52.  
  53. if (response == "tv") then
  54.    
  55.     print("You watched TV. Now what do you do?")
  56.     print("1: Exit the game. PRESS UP")
  57.     print("2: Exit the game. PRESS DOWN")
  58.     print("3: Exit the game. PRESS LEFT")
  59.     print("4: Exit the game. PRESS RIGHT")
  60.    
  61. end
  62.  
  63. if (response == "run") then
  64.    
  65.     print("You ran away. Now what do you do?")
  66.     print("1: Exit the game. PRESS UP")
  67.     print("2: Exit the game. PRESS DOWN")
  68.     print("3: Exit the game. PRESS LEFT")
  69.     print("4: Exit the game. PRESS RIGHT")
  70.    
  71. end
  72.  
  73. if(response == "call") then
  74.    
  75.     print("You called a friend. Now what do you do?")
  76.     print("1: Exit the game. PRESS UP")
  77.     print("2: Exit the game. PRESS DOWN")
  78.     print("3: Exit the game. PRESS LEFT")
  79.     print("4: Exit the game. PRESS RIGHT")
  80.    
  81. end
  82.  
  83. function print(text)
  84.    
  85.     Console.append(console, text)
  86.    
  87. end
Advertisement
Add Comment
Please, Sign In to add comment