-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
146 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// STYLING PREFERNCES for SITE | ||
// mixin used as a template for buttons | ||
@mixin button { | ||
width: auto; | ||
height: auto; | ||
border-radius: 10px; | ||
background-color: #21807c; | ||
border: 3px solid black; | ||
font-size: 1.5em; | ||
|
||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
|
||
grid-column: span 1; | ||
grid-row: span 1; | ||
|
||
// Creates smooth animation effect | ||
transition: all 0.5s; | ||
} | ||
|
||
/* define class for redifined button */ | ||
.button { | ||
@include button; | ||
} | ||
|
||
/* darkens the background color on hover to create a selecting effect */ | ||
.button:hover { | ||
background-color: #373737; | ||
} | ||
|
||
/* "row style" is flexible size and aligns pictures in center */ | ||
.row { | ||
align-items: center; | ||
display: flex; | ||
} | ||
|
||
/* "column style" is one-third of the width with padding */ | ||
.column { | ||
flex: 16.66%; | ||
padding: 3px; | ||
} | ||
|
||
// STYLING FOR CALCULATOR | ||
/* class to create the calculator's container; uses CSS grid dsiplay to partition off buttons */ | ||
.calculator-container { | ||
width: 90vw; /* this width and height is specified for mobile devices by default */ | ||
height: 80vh; | ||
margin: 0 auto; | ||
|
||
display: grid; | ||
grid-template-columns: repeat(4, 1fr); /* fr is a special unit; learn more here: https://css-tricks.com/introduction-fr-css-unit/ */ | ||
grid-template-rows: 0.5fr repeat(4, 1fr); | ||
gap: 10px 10px; | ||
} | ||
|
||
@media (min-width: 600px) { | ||
.calculator-container { | ||
width: 40vw; | ||
height: 80vh; | ||
} | ||
} | ||
|
||
/* styling for the calculator number button */ | ||
.calculator-number { | ||
@extend .button; | ||
} | ||
|
||
/* styling for the calculator operation button */ | ||
.calculator-operation { | ||
@extend .button; | ||
} | ||
|
||
/* styling for the calculator clear button */ | ||
.calculator-clear { | ||
@extend .button; | ||
background-color: #e68b1c; | ||
} | ||
|
||
/* styling for the calculator equals button */ | ||
.calculator-equals { | ||
@extend .button; | ||
background-color: #e70f0f; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class GameObject { | ||
constructor(canvas2D/* ADD STUFF HERE | ||
add some parameters here to customize game object (maybe width, height, color, x/y position, etc.) */) { | ||
this.c = canvas2D; | ||
/* ADD STUFF HERE | ||
set appropriate properites here */ | ||
} | ||
update() { | ||
/* ADD STUFF HERE | ||
draw this object on the canvas*/ | ||
} | ||
isCollidingWith(player) { | ||
/* ADD STUFF HERE (PART 2) | ||
(part 2) - check if this game object is colliding with the player, return true or false */ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Define the Player class | ||
class Player { | ||
constructor(canvas2D) { | ||
// Initial position and velocity of the player | ||
this.position = { | ||
x: 100, | ||
y: 200 | ||
}; | ||
this.velocity = { | ||
x: 0, | ||
y: 0 | ||
}; | ||
// Dimensions of the player | ||
this.width = 30; | ||
this.height = 30; | ||
|
||
this.c = canvas2D; | ||
} | ||
// Method to draw the player on the canvas | ||
draw() { | ||
this.c.fillStyle = 'red'; | ||
this.c.fillRect(this.position.x, this.position.y, this.width, this.height); | ||
} | ||
// Method to update the players position and velocity | ||
update() { | ||
this.draw(); | ||
this.position.y += this.velocity.y; | ||
this.position.x += this.velocity.x; | ||
/* FILL IN HERE | ||
this update method is called in the animate function, so this would be a good place to add some code to handle gravity (play around with the constant you use for gravity until you think the motion looks good) */ | ||
/* FILL IN HERE | ||
when adding gravity, make sure to add some handling so it doesn't go through the bottom of the screen */ | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.