Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var words1 = ["banana", "coffee", "computer"];
- var words2 = ["pb+J", "foosball", "plants"];
- var words3= ["moon", "lockers", "Midori"];
- var verb = ["has", "wants", "eats"]
- var prep = ["with", "on", "under"]
- var index = 0;
- function preload(){
- //images1
- banana = loadImage("images/banana.jpg");
- coffee = loadImage("images/coffee.jpg");
- computer = loadImage("images/computer.jpg");
- //images2
- pbj = loadImage("images/pbj.jpg")
- foosball = loadImage("images/foosball.jpg");
- plant = loadImage("images/plant.jpg");
- //images3
- moon = loadImage("images/moon.jpg")
- midori = loadImage("images/midori.jpg");
- locker = loadImage("images/locker.jpg");
- }
- function setup() {
- createCanvas(700,700);
- fill(0);
- textSize(32);
- }
- function mousePressed(){
- //set1
- index = index + 1;
- if (index == words1.length) {
- index = 0;
- }
- if (index == images1.length) {
- index = 0;
- }
- //verb
- index = index + 1;
- if (index == verb.length) {
- index = 0;
- }
- //set2
- if (index == words2.length) {
- index = 0;
- }
- if (index == images2.length) {
- index = 0;
- }
- //prep
- index = index + 1;
- if (index == prep.length) {
- index = 0;
- }
- //set3
- if (index == words3.length) {
- index = 0;
- }
- if (index == images3.length) {
- index = 0;
- }
- }
- function draw() {
- background(255);
- textAlign(CENTER);
- text(words1[index], 100, 400);
- text(verb[index], 200, 400);
- text(words2[index], 300, 400);
- text(prep[index], 400, 400);
- text(words3[index], 500, 400);
- var images1 = [banana, coffee, computer];
- image(images1[index], 100, 100, 100, 100);
- //image(image,[x=0],[y=0],[width],[height])
- var images2 = [pbj, foosball, plant];
- image(images2[index], 300, 100, 100, 100);
- var images3 = [moon, locker, midori];
- image(images3[index], 500, 100, 100, 100);
- }
- // //set1
- // index = index + 1;
- // if (index == words1.length) {
- // index = 0;
- // }
- // if (index == images1.length) {
- // index = 0;
- // }
- // //verb
- // index = index + 1;
- // if (index == verb.length) {
- // index = 0;
- // }
- // //set2
- // if (index == words2.length) {
- // index = 0;
- // }
- // if (index == images2.length) {
- // index = 0;
- // }
- // //prep
- // index = index + 1;
- // if (index == prep.length) {
- // index = 0;
- // }
- // //set3
- // if (index == words3.length) {
- // index = 0;
- // }
- // if (index == images3.length) {
- // index = 0;
- // }
- // }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement