Author: Michael Benefiel
Feel free to use some or all of this code if you're trying to complete a similar project.
Let's get ready to rumble! This RPG game is set to an early '90s WWF theme and utilizes jQuery to offer a fun, unique stroll down memory lane for anyone who grew up in the '80s and '90s.
Select your wrestler. Choose an opponent. Hit the attack button until you're defeated, or you defeat all your enemies. Last man standing wins!
Below is a thorough, but not comprehensive, step-by-step process of how I got the app running in terms of code
function startGame:
-
declare and define wrestler objects
- each wrestler includes:
- id
- name
- health points
- base attack
- attack power
- counter attack power
- image
- each wrestler includes:
-
reset wrestler, defenders and defender
-
reset wrestler selections
-
bell sound
-
displayJR function for displaying announcer
-
hideJR function for hiding announcer
-
displayAnnouncement function (beg of game)
-
hideAnnouncement function (beg of game)
-
emptying divs
-
displaying announcer and msg at beg of game
-
.each() to display each wrestler
- created panels (success/green for good)
- health points included
- storing wrestler images in these containers
-
on click function to hide JR and move wrestler to ring
-
remaining wrestlers go to defender area with danger panel
-
on click function to add enemy to ring (warning panel)
-
shakeDefender function to shake enemy every time he's attacked
-
on click function for attack button
-
method for decreasing defender HP by wrestler attack power
-
status after each attack
-
method for updating health points
-
method for increasing wrestler attack power by base power
-
opponent fight area clears after opponent is defeated
-
player wins if/else statement
-
everything clears