Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var book = [
- {title: "The Giver",
- author: "Lois Lowry",
- stars: 3,
- color: color(214, 255, 219)},
- {title: "Alchemist",
- author: "Paulo Coelho",
- stars: 3,
- color: color(224, 208, 208)},
- {title: "Lord of the Flies",
- author: "William Golding",
- stars: 4,
- color: color(238, 237, 242)},
- ];
- // draw shelf
- fill(173, 117, 33);
- rect(0, 120, width, 10);
- for( var i = 0; i < book.length; i ++)
- {
- // draw one book
- //fill(214, 255, 219);
- fill(book[i].color);
- rect(10 + i * 100, 20, 90, 100);
- fill(0, 0, 0);
- text(book[i].title, 15 + i *100, 29, 70, 100);
- text(book[i].author, 15 + i *100, 60, 70, 100);
- for (var s = 0; s < book[i].stars; s++) {
- image(getImage("cute/Star"), 11 +s*20 + i* 100, 90, 20, 30);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement