├── .github
└── stale.yml
├── README.md
├── images
├── arrows.png
├── car.png
├── logo.png
└── road.png
├── index.html
├── js
└── index.js
└── styles
└── style.css
/.github/stale.yml:
--------------------------------------------------------------------------------
1 | # Configuration for probot-stale - https://github.com/probot/stale
2 |
3 | # Number of days of inactivity before an Issue or Pull Request becomes stale
4 | daysUntilStale: 21
5 |
6 | # Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
7 | exemptLabels:
8 | - bug
9 | - enhancement
10 |
11 | # Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
12 | # Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
13 | daysUntilClose: 7
14 |
15 | # Label to use when marking as stale
16 | staleLabel: stale
17 |
18 | # Comment to post when marking as stale. Set to `false` to disable
19 | markComment: >
20 | This pull request has been automatically marked as stale because it didn't have any recent activity. It will be closed if no further activity occurs. Thank you
21 | for your contributions.
22 | closeComment: >
23 | This pull request is closed. Thank you.
24 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 | # LAB | Canvas Race Car
4 |
5 |
6 |
7 |
Learning Goals
8 |
9 |
10 | This exercise allows you to practice and apply the concepts and techniques taught in class.
11 |
12 | Upon completion of this exercise, you will be able to:
13 |
14 | - Use Canvas API to create a simple 2d game.
15 | - Implement game logic and UI using HTML, CSS, and JavaScript, including start, game, and end game screens.
16 | - Draw shapes using Canvas API methods.
17 | - Change the style and color of the Canvas shapes.
18 | - Create animations in Canvas using a game loop that continuously updates the screen.
19 | - Load and display images of different formats on canvas.
20 | - Display text on canvas.
21 | - Handle user input and events to control game elements.
22 | - Create and display randomly generated obstacles to add complexity to the game.
23 |
24 |
25 |
26 |
27 |
28 |
29 | ## Introduction
30 |
31 | We are ready to start making some games with `canvas` help, so in this first exercise, we will do a **Car Race** using some basic animations we learned today.
32 |
33 | Remember, you have the Learning Units to check any concept you need. We are working with the `2D` context, so you should think the canvas is a cartesian plane, where you can move elements changing their position in any of the `axis`.
34 |
35 | ## Requirements
36 |
37 | - Fork this repo
38 | - Clone this repo
39 |
40 | ## Submission
41 |
42 | - Upon completion, run the following commands:
43 |
44 | ```
45 | git add .
46 | git commit -m "done"
47 | git push origin master
48 | ```
49 |
50 | - Create Pull Request so your TAs can check up your work.
51 |
52 | ## Instructions
53 |
54 | ### Iteration 1: Draw the game board
55 |
56 | 
57 |
58 | The first thing we need is to create our board. The left side of the image is already on the HTML file, but when we click on the **Start Game** button, we need to create the canvas and display the road.
59 |
60 | The canvas HTML element is already part of the HTML starter code provided in the `index.html` file. In addition, you can find the image of the road in the `images` folder.
61 |
62 | ### Iteration 2: Draw the car
63 |
64 | 
65 |
66 | Once we have our road, we need the player's car - the same as the road. In the `images` folder, you will find a `.png` file you should use.
67 |
68 | ### Iteration 3: Make the car move right and left
69 |
70 | In our game, the player can only move the car to the right and left. Using the `left` and `right` arrows, the player should be able to move the car.
71 |
72 | :bulb: Remember the boundaries!
73 |
74 | ### Iteration 4: Create obstacles
75 |
76 | 
77 |
78 | Now let's make this interesting. First, we should create obstacles that show up every specific amount of time.
79 |
80 | They will always start in the position **0** of the `y` axis (the obstacles will be coming from the top of the canvas), but you should make them appear in a random place on the `x`-axis.
81 |
82 | ### Iteration 5: Move the obstacles
83 |
84 | To move the obstacles, we need to update our `canvas` continuously. In this iteration, you need to continually change the position of the obstacles in every update, making them move down the road.
85 |
86 | ### Iteration 6: Points, points, points
87 |
88 | Oh! If we want to challenge somebody, we need to quantify who is making it better. So we need to add a **score**. Add a method to count points while you keep the car avoiding obstacles.
89 |
90 | 
91 |
92 | 
93 |
94 |
95 |
96 | **Happy coding!** :heart:
--------------------------------------------------------------------------------
/images/arrows.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ironhack-labs/lab-canvas-race-car/fd192dda0e305410642448f6eeeddb591d60f21d/images/arrows.png
--------------------------------------------------------------------------------
/images/car.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ironhack-labs/lab-canvas-race-car/fd192dda0e305410642448f6eeeddb591d60f21d/images/car.png
--------------------------------------------------------------------------------
/images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ironhack-labs/lab-canvas-race-car/fd192dda0e305410642448f6eeeddb591d60f21d/images/logo.png
--------------------------------------------------------------------------------
/images/road.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ironhack-labs/lab-canvas-race-car/fd192dda0e305410642448f6eeeddb591d60f21d/images/road.png
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |