//Grade 9 Library V4 //Declarations Sometimes we want to make a simple picture show up on the screen, but don't need all the advanced features a createObjectPic makes. To do this we have to make a variable that is just the image. Not the other stuff like movement and collision control that createObjectPic has. //This is how you insert the image into your program. But it will need another step to actually make it draw. Take a look in the engine for that part. var myBackground = addPicture("duckUtopia.png"); var DuckFace = createObjectPic("duck.bmp"); //Setup function setup(){ DuckFace.x = 200; //These set the start coordinates for the duck DuckFace.y = 300; } //Main Game function engine(){ //Here is how you make your picture show up. This works for any image, it doesn't have to be a background. ctx.drawImage(myBackground, 0,0, w,h); //This tells the canvas to draw the image at location (0,0) for the top left corner. The 'w' and 'h' make it stretch or shink to match the //size of the canvas. //Also, if this is your background, make sure to draw it first. Anything that happens afterwards will go on top of the background, anything //before will be BEHIND it, making it invisible. //Draw the object DuckFace.draw(); } //Mouse Click function onClick(){ } //Key presses function keyPress(key){ }