Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Boulder(x,y,width,height,img)
- {
- this.x = x;
- this.y = y;
- this.width = width;
- this.height = height;
- this.img = img;
- this.draw = function(){
- ctx.drawImage(this.img, this.x, this.y, this.width, this.height);
- }
- }
- var boulderArray = [];
- function createBoulders()
- {
- boulderArray.push(new Boulder(canvas.width/2, 50, 50,50,boulderImg),
- new Boulder(canvas.width/2, 220, 50,50,boulderImg)
- );
- }
- createBoulders();
- boulderArray.forEach(draw);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement