Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

functional 2048 game #13

Open
wants to merge 40 commits into
base: jmnsat/master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
37d2a51
function to get empty spaces
jennaplusplus Feb 1, 2016
2eca20e
method to add 2 or 4 to empty board cell
jennaplusplus Feb 2, 2016
67bf1f8
made tile logic clearer
jennaplusplus Feb 2, 2016
50c51c9
removed hard-coded lengths from loop
jennaplusplus Feb 2, 2016
1b3f3e4
two random tiles at the beginning of the game
jennaplusplus Feb 2, 2016
0529184
moving multiple tiles up to a wall
jennaplusplus Feb 2, 2016
784d14e
moving tiles up, not working
jennaplusplus Feb 2, 2016
dc89923
Tiles correctly move to top of board without replacing existing values
trowbrsa Feb 2, 2016
ece9cd0
Troubleshooting why currentRow breaks after completion of while loop …
trowbrsa Feb 2, 2016
1d35bc9
Moving tiles to the left now works
trowbrsa Feb 2, 2016
47bd398
Moving tiles to the right now works
trowbrsa Feb 2, 2016
143b296
not checking every cell for up condition
jennaplusplus Feb 2, 2016
179ba9a
refactor up and down
jennaplusplus Feb 2, 2016
f1fc46a
refactor all directions
jennaplusplus Feb 3, 2016
a279b24
new tile looks better
jennaplusplus Feb 3, 2016
92336df
Added logic for winning game
trowbrsa Feb 3, 2016
d45ebfb
Added a reset board function
trowbrsa Feb 3, 2016
d878611
Added css styling for reset button
trowbrsa Feb 3, 2016
4eccf5a
fixed reset button
jennaplusplus Feb 3, 2016
7dadcd7
method to get tile from row and col
jennaplusplus Feb 3, 2016
6a157b5
combine method for UP direction
jennaplusplus Feb 4, 2016
85aa20d
collisions UP
jennaplusplus Feb 4, 2016
cf9b4b7
You can now have collisions when you press the downkey
trowbrsa Feb 4, 2016
4499983
Left arrow not correctly combining values
trowbrsa Feb 4, 2016
bdba1a6
Left and right collisions now working
trowbrsa Feb 4, 2016
7927ee8
updated gitignore and cleaned up move tile function
jennaplusplus Feb 4, 2016
e0b8d4d
fixed spacing
jennaplusplus Feb 4, 2016
da17015
fixed function name
jennaplusplus Feb 4, 2016
f9a7ae0
Score method now works
trowbrsa Feb 5, 2016
94deae4
Added minor css and a 'you win' message
trowbrsa Feb 5, 2016
6047c56
Reverted back to master branch'
trowbrsa Feb 5, 2016
b0aafab
Fixed syntax for win function
trowbrsa Feb 5, 2016
47e1b66
Fixed if/else in scoreboard statement
trowbrsa Feb 5, 2016
264ec09
Win message now displaying
trowbrsa Feb 5, 2016
6709bfd
fixed merge conflict
trowbrsa Feb 5, 2016
fb6d603
no tile added if your move was impossible
jennaplusplus Feb 5, 2016
072ce75
Score method now displays beautifully
trowbrsa Feb 5, 2016
04146ae
game lost function
jennaplusplus Feb 5, 2016
aa86ebd
Styling for header
trowbrsa Feb 5, 2016
36d32a8
fixed merge conflict
trowbrsa Feb 5, 2016
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Recreate as much of the original game as is reasonable in the one week we have a
**How does scoring work?**
Scoring happens when two tiles of the same value are combined. The value of those two tiles are added to your total score.
**When do tiles enter the game?**
Every time you move on the board, a new tile enters the game. It can be a 2 or a 4, not sure if they are equally likely. It is seemingly placed in a random empty spot on the board, after the pre-existing tiles have already moved.
Every time you move on the board, a new tile enters the game. It can be a 2 or a 4, but 2 is much more likely. It is seemingly placed in a random empty spot on the board, after the pre-existing tiles have already moved.
**How do you know if you've won?**
You win the game when one of your tiles on the board has a value of 2048.
**How do you know if you've lost?**
Expand Down
13 changes: 12 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,20 @@
<link rel="stylesheet" media="all" href="stylesheets/2048.css"/>
<script type="text/javascript" src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="javascripts/2048.js"></script>
<script src="node_modules/sweetalert/dist/sweetalert.min.js"></script>
<link rel="stylesheet" href="node_modules/sweetalert/dist/sweetalert.css">
</head>
<body>
<div class="container">
<div class="heading">
<h1 class="title">2048</h1>
<div class="scores-container">
<div id="scoreboard">
<p>Score: 0</p>
</div>
<div id="button">
<p id="reset">Reset Game</p>
</div>
<div id="gameboard">
<div class="cells">
<div class="cell"></div>
Expand All @@ -26,7 +38,6 @@
<div class="cell"></div>
<div class="cell"></div>
</div>
<div class="tile" data-row="r1", data-col="c1" data-val="2">2</div>
</div>
</body>
</html>
Loading