forked from nccu-programming-105-Summer/assign1
/
assign1.pde
54 lines (41 loc) · 912 Bytes
/
assign1.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* please implement your assign1 code in this file. */
int x,y,a,b,w,z,k;
PImage img;
PImage img1;
PImage img2;
PImage img3;
PImage img4;
PImage img5;
void setup () {
size(640,480) ; // must use this size.
img=loadImage("img/fighter.png");
img1=loadImage("img/hp.png");
img2=loadImage("img/treasure.png");
img3=loadImage("img/enemy.png");
img4=loadImage("img/bg1.png");
img5=loadImage("img/bg2.png");
x=floor(random(20,620));
y=floor(random(20,440));
a=floor(random(20,600));
b=floor(random(20,440));
w=floor(random(100,200));
k=floor(random(420));
// your code
}
void draw() {
background(0);
x+=5;
x%=640;
z+=2;
z%=1280;
image(img4,z%1280-640,0);
image(img5,(z+640)%1280-640,0);
image(img2,a,b);
rect(20,13,w,20);
colorMode(RGB);
fill(255,0,0);
image(img,570,230);
image(img1,10,10);
image(img3,x,k);
// your code
}