Last active
February 26, 2019 03:37
-
-
Save bashbaugh/c9887f8346de35cd2e7d7b8999a6ddb7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Ensure that player is within canvas: | |
player_x = Math.max(0, Math.min(player_x, canvas_element.width)) | |
// Draw player: | |
canvas.beginPath(); // Start drawing | |
canvas.arc(player_x, player_y, player_radius, 0, 2*Math.PI); // Draw 360 degree arc (full circle) | |
canvas.fillStyle = player_color; // Set color | |
canvas.fill(); // Fill in circle | |
canvas.closePath(); // End drawing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment