Skip to content

Commit

Permalink
Merge pull request #555 from mrboiisthebest/main
Browse files Browse the repository at this point in the history
Update hacks for conditionals lesson
  • Loading branch information
jm1021 authored Nov 1, 2024
2 parents 1ab4ff6 + 2417421 commit 0b47c15
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,48 +29,74 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Develop a basic combat system that allows characters to engage in battles with enemies. This will help you practice using functions, conditionals, and basic game mechanics in JavaScript."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Popcorn Hack Part 1 - 1\n",
"#### <span style=\"color: #ADD8E6; text-shadow: 3px 3px 8px #4682B4; font-weight: bold; font-size: 2em;\">Popcorn Hacks: Create a Simple Combat System for Your RPG Game</span>\n",
"Develop a basic combat system that allows characters to engage in battles with enemies. This will help you practice using functions, conditionals, and basic game mechanics in JavaScript.\n",
"\n",
"Using function `intializeData`\n",
"---\n",
"\n",
"1. Add `speed` to the `function intializeData(data = null)` and give it a default value.\n",
"2. Add `seed` to the HTML output.\n",
"3. Add `speed` to JSON data.\n",
"4. Try make call to `initializeData` with `no argument` and using `data` JSON object as argument when call "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Popcorn Hack Part 1 - 2\n",
"##### <span style=\"color: #FF6347; text-shadow: 2px 2px 6px #8B0000; font-weight: bold; font-size: 1.5em;\">Popcorn Hack 1: Using <code>initializeData</code> Function</span>\n",
"1. Add an <code>if</code> statement to compare two values.\n",
"2. Use <code>console.log()</code> to print an output.\n",
"3. Create a <code>boolean</code> variable, and use it in another <code>if</code> statement.\n",
"\n",
"On `handleKeyDown({ keyCode }` switch statement can you add conditions for IJKL keys.\n",
"---\n",
"\n",
"1. Add a `case` statement for each of the IJKL keys\n",
"2. Send key code for IJKL keys to method `gameObject.handleKeyDown` \n",
"3. Output `gameObject` using console.log"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Hack 3"
"##### <span style=\"color: #FF6347; text-shadow: 2px 2px 6px #8B0000; font-weight: bold; font-size: 1.5em;\">Popcorn Hack 2: Creating a Simple Attack System</span>\n",
"1. Add a <code>boolean</code> variable named <code>canAttack</code>, and set it to <code>false</code>.\n",
"2. Use an <code>if</code> statement to check if the player can attack.\n",
"3. If <code>canAttack</code> is <code>false</code>, output \"Can't attack.\"\n",
"4. Use <code>Math.random()</code> to determine if the player is allowed to attack. (Tip: Use ChatGPT for help with <code>Math.random()</code> if needed!)\n",
"5. This will pick a random number to decide if the attack can happen.\n",
"6. Use <code>console.log()</code> for all outputs.\n",
"\n",
"---\n",
"\n",
"##### <span style=\"color: #FF6347; text-shadow: 2px 2px 6px #8B0000; font-weight: bold; font-size: 1.5em;\">Popcorn Hack 3: Level Requirement Check</span>\n",
"1. Use the <code>ternary operator</code> to create an output if the player meets the level requirements.\n",
"2. If not, output a message telling the player they are under-leveled.\n",
"3. Use <code>console.log()</code> to print your output."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Use the ternary operator make an output apear if you meet the level requerments otherwise output a message that telss the player that they are under leveled"
"<!-- Homework Section with Enhanced Glowing Title -->\n",
"\n",
"### <span style=\"color: #78C0E0; text-shadow: 0 0 10px #1E3D59, 0 0 20px #1E3D59; font-weight: bold; font-size: 2em;\">Homework:</span>\n",
"\n",
"#### <span style=\"color: #FFA07A; text-shadow: 0 0 8px #3C3C3C, 0 0 15px #3C3C3C; font-weight: bold; font-size: 1.5em;\">Objectives</span>\n",
"\n",
"<span style=\"font-size: 1.2em; color: #E5E5E5; line-height: 1.8;\">\n",
" <br><strong style=\"color: #FFD700;\">Option 1:</strong> <span style=\"color: #C0C0C0;\">Create a simple combat system.</span>\n",
" <ul style=\"color: #D3D3D3; margin-left: 20px; list-style-type: circle;\">\n",
" <li>Allow characters to fight enemies.</li>\n",
" <li>Use basic functions and conditionals in JavaScript.</li>\n",
" <li>Focus on making it easy to understand how battles work.</li>\n",
" </ul>\n",
"\n",
" <br>\n",
" <strong style=\"color: #FFD700;\">Option 2:</strong> <span style=\"color: #C0C0C0;\">Make a dialogue system for your NPC (Non-Player Character).</span>\n",
" <ul style=\"color: #D3D3D3; margin-left: 20px; list-style-type: circle;\">\n",
" <li>Use the <code style=\"color: #7FFFD4;\">prompt()</code> function to ask the player for a response (choose a number from 1 to 4).</li>\n",
" <li>This dialogue should appear when the player gets close to the NPC and presses a button.</li>\n",
" </ul>\n",
"</span>\n",
"\n",
"### <span style=\"color: #FFA07A; text-shadow: 1px 1px 6px #3C3C3C; font-weight: bold;\">Additional Tips:</span>\n",
"- <span style=\"color: #FFD700;\">**For Option 1:**</span>\n",
" <ul style=\"color: #D3D3D3; margin-left: 20px; list-style-type: square;\">\n",
" <li>Start by writing down what the characters and enemies will be. Create simple names and attributes (like health).</li>\n",
" <li>Use <code style=\"color: #7FFFD4;\">console.log()</code> to print out what's happening at each step. This will help you understand the flow of your code.</li>\n",
" <li>Look for example code online to see how others have created combat systems. Don't be afraid to borrow ideas!</li>\n",
" </ul>\n",
"\n",
"- <span style=\"color: #FFD700;\">**For Option 2:**</span>\n",
" <ul style=\"color: #D3D3D3; margin-left: 20px; list-style-type: square;\">\n",
" <li>Plan out the dialogue options before you start coding. Write them down in a list.</li>\n",
" <li>Use comments in your code to remind yourself what each part does. For example, <code style=\"color: #7FFFD4;\">// Ask the player for a response</code>.</li>\n",
" <li>Test your code frequently. After writing a few lines, run it to see if it works before adding more.</li>\n",
" </ul>"
]
}
],
Expand Down
14 changes: 0 additions & 14 deletions _notebooks/CSSE/Lessons/Conditions/2024-11-10-conditinals_p3.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -214,20 +214,6 @@
"the : represents the else so that section of code with run if the requrments are nor met<br>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# QUIZ :]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### add your hw and hacks below"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down

0 comments on commit 0b47c15

Please sign in to comment.