How to Code a Phrasal Template Word Game Using Javascript
Method 1 of 2:
Setting Up the Story Template
- Use a Notepad-type program or application to write up a story. Do not add in the blanks just yet.
- Example: One sunny day, Tom went to the grocery store to buy some ham. When he got home, he discovered that his sister had already bought some ham while he was gone.
- Add in the blanks. You may add in blanks where there are names, places, nouns, adjectives, verbs, adverbs, prepositions, numbers, animals, body parts, foods, etc.
- Example: One (Adjective) day, (Male Name) went to the (Place) to (Verb) some (Plural Food). When he got home, he (Past Tense Verb) that his (Family Member) had already bought some (Same Plural Food) while he was gone.
- Convert your new story into code. The variables will be defined in the next step, so don't worry about them just yet.
- Example: alert ('One ' + adj + ' day, ' + maleName + ' went to the ' + place + ' to ' + verb + ' some ' + pluralFood + '. When he got home, he ' + pastVerb + ' that his ' + famMember + ' had already bought some ' + sameFood + ' while he was gone. ')
Method 2 of 2:
Setting Up the Variables to Fill in the Blanks
- Code the variables using prompts. For each one, type "var nameOfVble = prompt ('Type a name of variable below. ')", replacing "nameOfVble" and "name of variable" with the part of speech. Replace "a" with "an" if necessary.
- Example:
- var adj = prompt ('Type an adjective below! ')
- var maleName = prompt ('Type a male name below! ')
- var place = prompt (Type a kind of place below! ')
- And so on.
- Add in the story code.
- Example:
- var adj = prompt ('Type an adjective below! ')
- var maleName = prompt ('Type a male name below! ')
- var place = prompt ('Type a kind of place below! ')
- var verb = prompt ('Type a verb below! ')
- var pluralFood = prompt ('Type a plural food below! ')
- var pastVerb = prompt ('Type a past tense verb below! ')
- var famMember = prompt ('Type a kind of family member below! ')
- var sameFood = prompt ('Type the word ' + pluralFood + ' below! ')
- alert ('One ' + adj + ' day, ' + maleName + ' went to the ' + place + ' to ' + verb + ' some ' + pluralFood + '. When he got home, he ' + pastVerb + ' that his ' + famMember + ' had already bought some ' + sameFood + ' while he was gone. ')
4 ★ | 2 Vote
You should read it
- How to Watch Star Wars on Command Prompt
- How to use the command history function in Command Prompt
- Windows prompt
- How to customize the Command Prompt on Windows
- Add Command Prompt to Power User Menu on Windows 10
- How to Make Command Prompt Appear at School
- 6 Best Command Prompt Alternatives for Windows
- How to open Command Prompt on Windows 10, 8, 7, Vista and XP
May be interested
- The best free Microsoft Word template download websiteswhen you need to compose a document in microsoft word, using the template is helpful. whether you want to create a resume, a report, a proposal, a plan, or another popular document, templates will give you a starting point in the right format.
- What is Currying in Javascript? How to use Currying in JavaScriptthe currying feature in javascript can help you keep your code tidy and give you a new way of seeing how functions work. currying is ideal when you want to break complex logic into smaller, manageable, and self-contained pieces of code.
- Guide to coding Flappy Bird game using JavaScriptin this article, we invite you to refer to how to code the flappy bird game simply using javascript.
- How to Make a Basic JavaScript Quizmaking a game with javascript can be fun and satisfying as well as a bit of a puzzle. the code in the this article is one way of making a game using javascript. once you know the basics, feel free to adapt and play around with it. set up...
- Syntax of JavaScriptjavascript can be implemented using javascript commands that are placed in html tags ... in a web page.
- JavaScript code that generates box and whisker charts containing outliersthe example below illustrates a box & whisker chart pattern with outlier values represented by a scatter plot. the article also provides javascript source code for you to edit or save to your computer to run internally.
- How to create a Template template in Word 2007 and Word 2010microsoft word supports users with a series of useful features, making the work of writing documents and documents faster and simpler. with these formats, operations ... often have to be used repeatedly in word instead of having to re-type a series of addresses
- 10 impressive table of contents for Microsoft Wordif you are working on a long document, you should create a table of contents for viewers to follow. this table of contents will make it easier for anyone to read through the document to grasp the overall content of the text.
- How to Use JavaScript Injectionsjavascript injection is a process by which we can insert and use our own javascript code in a page, either by entering the code into the address bar, or by finding an xss vulnerability in a website. note that the changes can only be seen...
- JavaScript location in HTML Filethere is flexibility in providing javascript code anywhere in an html document. however, the most preferred ways to include javascript in an html file.