- 🐻 First-year student at UC Berkeley
- 💻 Helped run CodeDay LA
- 🛠 I do lots of JavaScript
- 😋 Enjoys Korean food
- Works for (almost) everyone with a browser
- No native download required
- All assets downloaded like a webpage
- Push out updates instantly
Open the Links document!
<canvas id="game"></canvas>
let canvas = document.querySelector('#game');
let game = canvas.getContext('2d');
function gameLoop() {
// Gets called many, many times
// Your code goes here!
game.fillRect(x, y, width, height);
}
requestAnimationFrame(gameLoop);
Open Basics of Web Game Design CodePen from the Links doc!
What do these do?
game.fillRect(<x value>, <y value>, <width>, <height>);
game.clearRect(<x value>, <y value>, <width>, <height>);
Hint: Try adding two slashes (//) before them (telling the computer to ignore the line) and see what happens!
A JavaScript framework that abstracts away web technologies like HTML5 Canvas and WebGL
function preload() {
// Load images, sounds, etc.
}
function create() {
// Setup your game world!
}
function update() {
// Like our gameLoop() function, this gets called many times per second!
}
function render() {
// Called after game elements are rendered
}
Open Basics of Phaser CodePen from the Links doc!
(such as images or audio)
- Occurs in
preload
function!
game.load.image('sprite-image', '/path/to/image');
The "characters" or individually moving components of your game.
- Occurs in
create
function!
game.add.sprite(50, 50, 'sprite-image');
- Occurs in
update
function!
sprite.velocity.x = 500;
sprite.velocity.y = 500;
Open up the link to Piskel on the Links doc!
Launch the Tiled app on your computer! (setup files in Web Game Design Drive)
Download the platformer.zip file from the Web Game Design Drive and open it up in your text editor of choice.
Note: Download Sublime Text (your platform) from the folder if you don't have a text editor you use for code!