-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflappyscript.js
More file actions
36 lines (31 loc) · 763 Bytes
/
flappyscript.js
File metadata and controls
36 lines (31 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//Board
let board;
let boardWidth = 360;
let boardHeight = 640;
let context;
//bird
let birdWidth = 34;
let birdHeigth = 24;
let birdX = boardWidth/8;
let birdY = boardHeight/8;
let bird ={
x :birdX,
y : birdY,
width : birdWidth,
height : birdHeigth,
}
window.onload = function(){
board = document.getElementById("board");
board.height = boardHeight;
board.width = boardWidth;
context = board.getContext("2d");
//draw the bird here
//context.fillStyle ="green";
//context.fillRect(bird.x,bird.y,bird.height,bird.width);
//loadimage
birdImg = new Image();
birdImg.src = "./flappybird.png";
birdImg.onload = function(){
context.drawImage(birdImg,bird.x,bird.y,bird.width,bird.height);
}
}