Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.DS_Store
script2bk.js
*.pptx
onionFace.png
playerRed.png
cow.png
bandit1.png
fireball.psd
char.png
bandit1.png
139 changes: 77 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,96 +1,111 @@
# Project Name (Start editing here)
<!---
Read Me Contents
-->
# Project 1: Crops and Robbers

# ![](https://ga-dash.s3.amazonaws.com/production/assets/logo-9f88ae6c9c3871690e33280fcf557f33.png) Project #1: The Game
### Introduction

### Overview
1. Play as a farmer, Johnny Wicklebottom.
2. Defend your farm against the OnionFace Bandit Gang.
3. Survive them all to win.

Let's start out with something fun - **a game!**
Play the game at: https://soemn.github.io/project-1/

Everyone will get a chance to **be creative**, and work through some really **tough programming challenges** – since you've already gotten your feet wet with Tic Tac Toe, it's up to you to come up with a fun and interesting game to build.
![Introduction](/assets/images/introScreen2.png)

**You will be working individually for this project**, but we'll be guiding you along the process and helping as you go. Show us what you've got!
##### Gameplay
Shoot the enemies while avoiding hit or getting your house damaged. The enemies keep spawning so defeat them fast and avoid being overrun! You will lose if the enemies destroy your house or kills you.


---
### Controls

### Technical Requirements
![Instructions](/assets/images/controls.png)

Your app must:

* **Render a game in the browser**
* **Any number of players** will be okay, switch turns will be great
* **Design logic for winning** & **visually display which player won**
* **Include separate HTML / CSS / JavaScript files**
* Stick with **KISS (Keep It Simple Stupid)** and **DRY (Don't Repeat Yourself)** principles
* Use **Javascript** for **DOM manipulation**, jQuery is not compulsory
* **Deploy your game online**, where the rest of the world can access it
* Use **semantic markup** for HTML and CSS (adhere to best practices)
* **No canvas** project will be accepted, only HTML5 + CSS3 + JS please
### In Game Screen Shot

---
![screen shot](/assets/images/screenShot.png)

### Necessary Deliverables
---
### Game Flow

* A **working game, built by you**, hosted somewhere on the internet
* A **link to your hosted working game** in the URL section of your GitHub repo
* A **git repository hosted on GitHub**, with a link to your hosted game, and frequent commits dating back to the very beginning of the project
* **A ``readme.md`` file** with explanations of the technologies used, the approach taken, installation instructions, unsolved problems, etc.
![Gameflow](/assets/images/fightPhase.png)

---

### Suggested Ways to Get Started
### Technical Assets

* **Break the project down into different components** (data, presentation, views, style, DOM manipulation) and brainstorm each component individually. Use whiteboards!
* **Use your Development Tools** (console.log, inspector, alert statements, etc) to debug and solve problems
* Work through the lessons in class & ask questions when you need to! Think about adding relevant code to your game each night, instead of, you know... _procrastinating_.
* **Commit early, commit often.** Don’t be afraid to break something because you can always go back in time to a previous version.
* **Consult documentation resources** (MDN, jQuery, etc.) at home to better understand what you’ll be getting into.
* **Don’t be afraid to write code that you know you will have to remove later.** Create temporary elements (buttons, links, etc) that trigger events if real data is not available. For example, if you’re trying to figure out how to change some text when the game is over but you haven’t solved the win/lose game logic, you can create a button to simulate that until then.
#### Content update
The update loop uses ```window.requestAnimationFrame()``` to update the game when not paused.

---
The ```update``` function is used to move the characters using ```element.moveChar``` and check interaction using ```checkCollision()```. Each element behave differently upon collision.

### Potential Project Ideas

##### Blackjack
Make a one player game where people down on their luck can lose all their money by guessing which card the computer will deal next!
#### Element creation
The ```generateEnemy```, ```generateBullet```, ```generateUpgrade```, ```generateCat``` functions are used to create elements using the ```Character``` class.

##### Self-scoring Trivia
Test your wits & knowledge with whatever-the-heck you know about (so you can actually win). Guess answers, have the computer tell you how right you are!
The ```Character``` class is used to create all game elements on the gameBoard.
```
class Character {
constructor(
type, //player, enemy, bullet, pet
id, //element identifier
sizeX, //element size
sizeY,
spdX, //movement speed
spdY,
hp, /character health
x, //location on gameBoard
y,
atkSpd, //attack speed
bulletOwner, //who shot the bullet
aniFrame, //animation counter
aimAngle //bullet direction
)

---
addChar()
//adds the character element to the gameBoard

### Useful Resources
removeChar()
//removes the character element from the gameBoard

* **[MDN Javascript Docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript)** _(a great reference for all things Vanilla Javascript)_
* **[jQuery Docs](http://api.jquery.com)** _(if you're using jQuery)_
* **[GitHub Pages](https://pages.github.com)** _(for hosting your game)_
* **[How to write readme - Markdown CheatSheet](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet)** _(for editing this readme)_
* **[How to write a good readme for github repo!](https://gist.github.com/PurpleBooth/109311bb0361f32d87a2)** _(to make it better)_
moveChar()
//moves and animates the character

---
shoot()
//Generates a bullet at the character's position
//Shoots direction base on aimAngle.
//All characters can shoot. Even pets and bullets.
```

### Project Feedback + Evaluation

* __Project Workflow__: Did you complete the user stories, wireframes, task tracking, and/or ERDs, as specified above? Did you use source control as expected for the phase of the program you’re in (detailed above)?

* __Technical Requirements__: Did you deliver a project that met all the technical requirements? Given what the class has covered so far, did you build something that was reasonably complex?
##### Levels

* __Creativity__: Did you add a personal spin or creative element into your project submission? Did you deliver something of value to the end user (not just a login button and an index page)?
3 Levels with varying enemy spawn rates base on a timer. Past a certain point, enemies stop spawning and once all enemies are dead, the game is won.

* __Code Quality__: Did you follow code style guidance and best practices covered in class, such as spacing, modularity, and semantic naming? Did you comment your code as your instructors have in class?

* __Deployment__: Did you deploy your application to a public url using GitHub Pages?
##### Game Design Log

* __Total__: Your instructors will give you a total score on your project between:
###### First Idea:
Create a resource management game, where the player has to plant crops and then defend his crops from the enemies. Earning gold at the end of each level which can be used to buy seeds or defence for the next level.

Score | Expectations
----- | ------------
**0** | _Incomplete._
**1** | _Does not meet expectations._
**2** | _Meets expectations, good job!_
**3** | _Exceeds expectations, you wonderful creature, you!_
###### Idea Testing:
The fighting mechanic was tested first as it was more complicated than the resource management component. While testing the fighting mechanic, it was found to be quite fun and the game was then decided to be simplified to focus only on the fighting aspect.

###### Detailed Design
Originally functions were used to create ```objects``` without the use of ```Class```. After refactoring the code to use a ```Class``` to define all characters, new entities and mechanics could be created quickly.

###### Juicing
Pets and sounds were added. Improved sprites.

###### To do:
1. Dog enemy (does not shoot, chases player and attacks)
2. Additional sounds for getting hit
3. Improvement to level design and difficulty adjustment
4. Reduce the use of `setInterval` and improve game performance


---

This will serve as a helpful overall gauge of whether you met the project goals, but __the more important scores are the individual ones__ above, which can help you identify where to focus your efforts for the next project!
Sprites from:
- opengameart.org
- spriters-resource.com (Stardew Valley)
- charas-project.net
Binary file added assets/audio/catMeow.mp3
Binary file not shown.
Binary file added assets/audio/fightMusic.mp3
Binary file not shown.
Binary file added assets/audio/shootSoundEnemy.wav
Binary file not shown.
Binary file added assets/audio/shootSoundPlayer.wav
Binary file not shown.
Binary file added assets/audio/spring.mp3
Binary file not shown.
88 changes: 88 additions & 0 deletions assets/css/stylesheet.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
.container {
display: flex;
justify-content: left;
}

body {
background: url("../images/background.png");
font-family: "Press Start 2P";
}

.gameWrapper {
width: 800px;
height: 730px;
}

.controls {
height: 400px;
width: 450px;
background: url("../images/controls.png");
background-size: 100%;
}

.startGame {
display: inline-block;
padding: 0;
height: 90px;
width: 250px;
background: green;
text-align: center;
color: white;
position: absolute;
top: 500px;
left: 500px;
font-size: 20px;
}

#startGame {
margin: 7px auto;
}

button {
margin-top: 20px;
}

.gameBoard {
width: 800px;
height: 630px;
border: 3px solid black;
position: absolute;
display: inline-block;
background: url("../images/introScreen2.png");
background-size: 103%;
background-repeat: no-repeat;
}

.info {
width: 800px;
height: 60px;
display: flex;
justify-content: space-between;
}

.aside {
display: inline-block;
padding: 0 50px;
}

.hitpointsDiv {
display: inline-block;
}

.scoreDiv {
display: inline-block;
}

.cow1 {
background: url("../images/cow1.png");
width: 80px;
height: 80px;
background-size: 100%;
}

.cow2 {
background: url("../images/cow2.png");
width: 80px;
height: 80px;
background-size: 100%;
}
Binary file added assets/images/annoyingDog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/bandit1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/char.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/controls.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/cow1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/cow2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/doggo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/fightPhase.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading