//declare image
PImage superheroes;
PImage aquaman;
PImage batman;
PImage batman2;
PImage catwoman;
PImage catwoman2;
PImage daredevil;
PImage Electra;
int picture = 0;
void setup (){ //setup
size (400, 400);
superheroes= loadImage ("superheroes.png");
image (superheroes, 0, 0);
}
//A is for Aquaman
void draw() {
if(keyPressed) {
if (key == 'a' || key == 'A') {
background (25, 154, 250);
aquaman= loadImage ("aquaman.png");
image (aquaman, 0, 0);
}
}
//B is for Batman
if (keyPressed) {
if (key =='b' || key== 'B'){
background (50);
batman2= loadImage ("batman2.png");
image (batman, 0, 0);
}else{
batman= loadImage ("batman.png");
}
}
//C is for Catwoman
if (keyPressed) {
if (key == 'c' || key == 'C') {
background(198,14,14);
catwoman = loadImage ("catwoman.png");
image (catwoman, 0, 0);
}
}
//D is for Daredevil
if (keyPressed) {
if (key == 'd' || key == 'D') {
background (178, 129, 22);
daredevil = loadImage ("daredevil.png");
image (daredevil, 0, 0);
}
}
//E is for Electra
if (keyPressed){
if (key == 'e' || key == 'E') {
background (255, 250, 85);
Electra = loadImage ("Electra.png");
image (Electra, 0, 0);
}
}
}
Danna - F
on Wednesday, Oct 15, 2008 – 9:10 am
One Comment
Danna, I like superheros as much as the next person, but this is lacking visual structure. How can you modify the images or find different source images to improve it? Also, since you’re giving instructions on the first screen, you should mention pressing the keys A-E in addition to clicking.
Also, you should never load images in draw(). They should always be loaded inside setup(). This slows your program down.