p5.js p5.js p5.js Tetris Tetris
|
|
|
- きよたつ こしの
- 7 years ago
- Views:
Transcription
1 平成 28 年度 数学講究録 題目 p5.js によるテトリスプログラム Processing による Shooting Game の作成 Processing の Othello のプログラム作成 指導教員 冨田耕史 熊澤龍佑 堀部達也 矢野稜也 城裕太 丸山慎椰 山本幸司 提出日平成 29 年 1 月 30 日 差替日平成 29 年 3 月 6 日
2 p5.js p5.js p5.js Tetris Tetris Tetris p5.js Tetris Tetris ,
3 test.html map1.js Tetorimino.js p5.js 1.1 p5.js p5.js Processing,, JavaScript. Canvas WebAudio, MTML5.,,, 1.,. Processing,, ([1] ). p5.js, Processing,., C., p5.js,. 2 Tetris 2.1 Tetris ,,.,.,. ([2] ). 2
4 , O-, I-, T-, S-, Z-, L-, J-., 4,,,,.,,,., 1, 2, 3, 4. 4, 4 ([2] ). 2.3,,,,.. 3 Tetris 3.1 (1) (14). (1) test.html, map1.js, Tetorimino.js 1. (2) test.html chromium. (3) 1. (4),.. t 3
5 p5.js createcanvas(x,y) x, y (x), (y). background(x) x. 0( ) 204( ). framerate(x) x, 1 x draw. fill(x,y,z) x( ), y( ), z( ),. textsize(x) x,. text 4
6 text(" ") " ". 3.3 Tetris setup ((1) (8)). draw ((9) (14)). var m,t,b=0,c=0,k=0,x=4,y=0,r,q,g=0,w=0; //(1) //m:map1 //t:tetorimino //b: //c: //k:, //x: //y: //r:map1 //g: //w: function setup(){ createcanvas(251,501); // //(2) m=new Map1(10,20); //Map1 /*(3) t=new Tetorimino(); //Tetorimino */ m.init(); //init //(4) background(204); // /*(5) framerate(7); // */ textfont("source Code Pro"); // //(6) fill(0,0,255); /*(7) textsize(35); */ text("game START",25,200); /*(8) fill(0); textsize(16); text(" ",80,240); */ 5
7 function draw(){ if(g==1){ if(y==0) m.clear(); //clear //(10) t.initmino(); //initmino //(11) t.down(); //down //(12) m.display(); //diplay //(13) if(w==1){noloop(); // //(14) fill(255,0,0); background(204); textsize(35); text("game OVER",25,200); if(mouseispressed) g=1; // 3.4 Tetris (1). setup (2) createcanvas (3) map1.js,tetorimino.js. (4) map1.js init 0. (5) background,framerate. (6) textfont. (7) fill, textsize. (8) text. draw (9) g = 1(, ),. (10) y = 0( ), clear. 6
8 (11) initmino. (12) down. (13) display. (14) down w = 1. clear clear i, j, g 1 5. i, j,q j 19 0 ( ). 2. q. 3. i 0 10 ( ). 4. q q 10 ), change, j 1. clear. this.clear=function(){ //1 for(j=19;j>=0;j--){ //1 20 q=0; for(i=0;i<10;i++){ if(this.map1[i][j]!=0) q++; //1 if(q==10) { for(i=0;i<10;i++){ // this.map1[i][j]=0; // 0 this.change(j); j++; 7
9 ; change change i, k 1, 2. i, k, i change. this.change=function(k){ // 1 for(k;k>0;k--){ // 1 for(i=0;i<10;i++){ this.map1[i][k]=this.map1[i][k-1]; ; initmino initmino b, c, d, x, y 1 3. b 1 7, c, x y. 1. y = 0, b ( ) (1 7). 2. t c 4 0 3, b = 2(i ),b = 6(s ), b = 7(z ), 2 c = 0, c = 2 c = 1, c = 3, b = 3(t ), b = 4(l ), b = 5(j 8
10 ), 4 c = 0, c = 1, c = 2, c = 3,,. d c. initmino. this.initmino=function(){ if(y==0){ b=int(random(1,8)); // 1 7, if(keyispressed){ if(key== t ){ //t c++; c=c%4; if(b==2){ // (i ) if((c==0) (c==2)){ if((m.get(x,y+1)==0)&&(m.get(x,y+2)==0)){ //i1,i3 if(m.get(x,y+3)==0){ t.i1_del(x,y); // i1,i3 else this.d=1; // d=1 else this.d=1; 9
11 if((c==1) (c==3)){ if((m.get(x+1,y)==0)&&(m.get(x+2,y)==0)){ //l0,l2 if(m.get(x+3,y)==0){ t.i0_del(x,y); // i0,i2 else this.d=2; // d=2 else this.d=2; if(this.d==1){ c=1; // c this.d=0; if(this.d==2){ c=0; this.d=0; down down b, w, x, y 1 5. b, w, x y. 1. b = 1 7. b = 1 (o ), c = 0 c = w = 1( )
12 5. y = 0, x = 4. down. this.down=function(){ // if(b==1){ if(y==0){ if((m.get(x,y)==0)&&(m.get(x+1,y)==0) // o0 &&(m.get(x,y+1)==0)&&(m.get(x+1,y+1)==0) &&(m.get(x,y+2)==0)&&(m.get(x+1,y+2)==0)){ this.o0_del(x,y+1); y++; else w=1; // else if(m.o0_serch(x,y)==1){ // 1 y++; t.o0_down(x,y); else y=0,x=4; // display display i, j 1. i, j. 1.. display. this.display=function(){ // for(i=0;i<this.map1.length;i++){ //map 11
13 ; for(j=0;j<this.map1[i].length;j++){ if(this.map1[i][j]==1) fill(82,162,197); else if (this.map1[i][j]==2) fill(255,255,0); else if (this.map1[i][j]==3) fill(196,0,204); else if (this.map1[i][j]==4) fill(15,82,188); else if (this.map1[i][j]==5) fill(255,183,76); else if (this.map1[i][j]==6) fill(0,255,65); else if (this.map1[i][j]==7) fill(204,0,0); else fill(255); rect(i*25,j*25,25,25); 12
14 4 4.1,,. o0-down search,,.,, o-,..,,,., p5.js, if., if if, &&. 13
15 this.t_serch=function(i,j){ if((this.map1[i][j+1]==0)&&(this.map1[i+1][j+1]==0)){ if(this.map1[i+2][j+1]==0){ s=1; else s=0; return s; ; this.t0_serch=function(i,j){ //t0 if((this.map1[i][j+1]==0)&&(this.map1[i+1][j+1]==0)&& (this.map1[i+2][j+1]==0)){ s=1; // 1, 0 else s=0; return s; ; 4.2,,, down,.,,,,,., 1 1,.,,, 14
16 , ,,.,.,.,, test.html <!doctype html> <html> <head> <meta charset="utf-8"> <script src=" <script src="tetorimino.js"></script> <script src="map1.js"></script> <title> test </title> </head> <body> <script> var m,t,b=0,c=0,k=0,x=4,y=0,r,q,g=0,w=0; //m:map1 //t:tetorimino //b: //c: //k:, 15
17 //x: //y: //r:map1 //g: //w: function setup(){ createcanvas(251,501); // m=new Map1(10,20); //Map1 t=new Tetorimino(); //Tetorimino m.init(); //init background(204); // framerate(7); // textfont("source Code Pro"); // fill(0,0,255); textsize(35); text("game START",25,200); fill(0); textsize(16); text(" ",80,240); function draw(){ if(g==1){ if(y==0) m.clear(); //clear t.initmino(); //initmino t.down(); //down m.display(); //diplay if(w==1){ noloop(); // fill(255,0,0); background(204); textsize(35); text("game OVER",25,200); 16
18 if(mouseispressed) g=1; </script> </body> </html> // 6.2 map1.js function Map1(m,n){ this.map1=new Array(m); //m this.p=0; this.init=function(){ for(i=0;i<this.map1.length;i++){ //i=0 m this.map1[i]=new Array(n); //m n for(i=0;i<m;i++){ // 0 for(j=0;j<n;j++){ this.map1[i][j]=0; ; this.set=function(a,b,r){ // map if (r==0) this.map1[a][b]=0; else if(r==1) this.map1[a][b]=1; else if(r==2) this.map1[a][b]=2; else if(r==3) this.map1[a][b]=3; else if(r==4) this.map1[a][b]=4; 17
19 ; else if(r==5) this.map1[a][b]=5; else if(r==6) this.map1[a][b]=6; else if(r==7) this.map1[a][b]=7; this.get=function(a,b){ // 0 if(this.map1[a][b]!=0){ return 1; else return 0; ; this.o0_serch=function(i,j){ //o0 if((this.map1[i][j+1]==0)&&(this.map1[i+1][j+1]==0)){ return 1; // 1, 0 else return 0; ; this.i0_serch=function(i,j){ //i0 if(this.map1[i][j+3]==0){ s=1; // 1, 0 else s=0; return s; ; this.i1_serch=function(i,j){ 18
20 ; //i1 if((this.map1[i][j]==0)&&(this.map1[i+1][j]==0)&& (this.map1[i+2][j]==0) &&(this.map1[i+3][j]==0)){ s=1; // 1, 0 else s=0; return s; this.t0_serch=function(i,j){ //t0 if((this.map1[i][j+1]==0)&&(this.map1[i+1][j+1]==0)&& (this.map1[i+2][j+1]==0)){ s=1; // 1, 0 else s=0; return s; ; this.t1_serch=function(i,j){ //t1 if((this.map1[i][j+2]==0)&&(this.map1[i+1][j+1]==0)){ s=1; // 1, 0 else s=0; return s; ; this.t2_serch=function(i,j){ 19
21 ; //t2 if((this.map1[i][j]==0)&&(this.map1[i+1][j+1]==0)&& (this.map1[i+2][j]==0)){ s=1; // 1, 0 else s=0; return s; this.t3_serch=function(i,j){ //t3 if((this.map1[i][j+1]==0)&&(this.map1[i+1][j+2]==0)){ s=1; // 1, 0 else s=0; return s; ; this.l0_serch=function(i,j){ //l0 if((this.map1[i][j+2]==0)&&(this.map1[i+1][j+2]==0)){ s=1; // 1, 0 else s=0; return s; ; this.l1_serch=function(i,j){ //l1 if((this.map1[i][j+1]==0)&&(this.map1[i+1][j]==0)&& 20
22 (this.map1[i+2][j]==0)){ s=1; // 1, 0 else s=0; return s; ; this.l2_serch=function(i,j){ //l2 if((this.map1[i][j+1]==0)&&(this.map1[i+1][j+3]==0)){ s=1; // 1, 0 else s=0; return s; ; this.l3_serch=function(i,j){ //l3 if((this.map1[i][j+1]==0)&&(this.map1[i+1][j+1]==0)&& (this.map1[i+2][j+1]==0)){ s=1; // 1, 0 else s=0; return s; ; this.j0_serch=function(i,j){ //j0 if((this.map1[i][j+2]==0)&&(this.map1[i+1][j+2]==0)){ s=1; 21
23 ; // 1, 0 else s=0; return s; this.j1_serch=function(i,j){ //j1 if((this.map1[i][j+1]==0)&&(this.map1[i+1][j+1]==0)&& (this.map1[i+2][j+1]==0)){ s=1; // 1, 0 else s=0; return s; ; this.j2_serch=function(i,j){ //j2 if((this.map1[i][j+2]==0)&&(this.map1[i+1][j]==0)){ s=1; // 1, 0 else s=0; return s; ; this.j3_serch=function(i,j){ //j3 if((this.map1[i][j]==0)&&(this.map1[i+1][j]==0)&& (this.map1[i+2][j+1]==0)){ s=1; // 1, 0 22
24 ; else s=0; return s; this.s0_serch=function(i,j){ //s0 if((this.map1[i][j+1]==0)&&(this.map1[i+1][j+2]==0)){ s=1; // 1, 0 else s=0; return s; ; this.s1_serch=function(i,j){ //s1 if((this.map1[i][j+1]==0)&&(this.map1[i+1][j+1]==0)&& (this.map1[i+2][j]==0)){ s=1; // 1, 0 else s=0; return s; ; this.z0_serch=function(i,j){ //z0 if((this.map1[i][j+2]==0)&&(this.map1[i+1][j+1]==0)){ s=1; // 1, 0 else s=0; 23
25 ; return s; this.z1_serch=function(i,j){ //z1 if((this.map1[i][j]==0)&&(this.map1[i+1][j+1]==0)&& (this.map1[i+2][j+1]==0)){ s=1; // 1, 0 else s=0; return s; ; this.right=function(x,y){ // if(b==1){ //, t.o0_del(x-1,y); t.o0_set(x,y); if((b==2)&&(c==0)){ t.i0_del(x-1,y); t.i0_set(x,y); if((b==2)&&(c==1)){ t.i1_del(x-1,y); t.i1_set(x,y); if((b==3)&&(c==0)){ t.t0_del(x-1,y); t.t0_set(x,y); if((b==3)&&(c==2)){ t.t2_del(x-1,y); 24
26 t.t2_set(x,y); if((b==3)&&(c==3)){ t.t3_del(x-1,y); t.t3_set(x,y); if((b==4)&&(c==1)){ t.l1_del(x-1,y); t.l1_set(x,y); if((b==4)&&(c==3)){ t.l3_del(x-1,y); t.l3_set(x,y); if((b==5)&&(c==1)){ t.j1_del(x-1,y); t.j1_set(x,y); if((b==5)&&(c==3)){ t.j3_del(x-1,y); t.j3_set(x,y); if((b==6)&&(c==1)){ t.s1_del(x-1,y); t.s1_set(x,y); if((b==7)&&(c==1)){ t.z1_del(x-1,y); t.z1_set(x,y); if((b==3)&&(c==1)){ t.t1_del(x-1,y); t.t1_set(x,y); 25
27 if((b==4)&&(c==0)){ t.l0_del(x-1,y); t.l0_set(x,y); if((b==4)&&(c==2)){ t.l2_del(x-1,y); t.l2_set(x,y); if((b==5)&&(c==0)){ t.j0_del(x-1,y); t.j0_set(x,y); if((b==5)&&(c==2)){ t.j2_del(x-1,y); t.j2_set(x,y); if((b==6)&&(c==0)){ t.s0_del(x-1,y); t.s0_set(x,y); if((b==7)&&(c==0)){ t.z0_del(x-1,y); t.z0_set(x,y); ; this.r0serch=function(x,y){ //o this.p=0; // 1 if((this.get(x+2,y-1)==0)&& (this.get(x+2,y)==0)) this.p++; 26
28 ; return this.p; this.r1serch=function(x,y){ // this.p=0; // 1 if (this.get(x+4,y-1)==0) this.p++; return this.p; ; this.r2serch=function(x,y){ // 2 this.p=0; // 2 if(((this.get(x,y-1)==1)&&(this.get(x+1,y-1)==0)) ((this.get(x+1,y-1)==1)&&(this.get(x+2,y-1)==0)) ((this.get(x+2,y-1)==1) &&(this.get(x+3,y-1)==0))) this.p++; if(((this.get(x,y)==1)&&(this.get(x+1,y)==0)) ((this.get(x+1,y)==1) &&(this.get(x+2,y)==0)) ((this.get(x+2,y)==1) &&(this.get(x+3,y)==0))) this.p++; return this.p; ; this.r3serch=function(x,y){ // 3 this.p=0; // 3 if(((this.get(x,y-1)==1)&&(this.get(x+1,y-1)==0)) ((this.get(x+1,y-1)==1)&&(this.get(x+2,y-1)==0))) this.p++; if(((this.get(x,y)==1)&&(this.get(x+1,y)==0)) ((this.get(x+1,y)==1)&&(this.get(x+2,y)==0))) this.p++; if(((this.get(x,y+1)==1)&&(this.get(x+1,y+1)==0)) ((this.get(x+1,y+1)==1)&&(this.get(x+2,y+1)==0))) this.p++; return this.p; 27
29 ; this.r4serch=function(x,y){ // 4 this.p=0; // 1 if((this.get(x+1,y-1)==0)&&(this.get(x+1,y)==0)&& (this.get(x+1,y+1)==0)&&(this.get(x+1,y+2)==0))this.p++; return this.p; ; this.left=function(x,y){ // if(b==1){ //, t.o0_del(x+1,y); t.o0_set(x,y); if((b==2)&&(c==0)){ t.i0_del(x+1,y); t.i0_set(x,y); if((b==2)&&(c==1)){ t.i1_del(x+1,y); t.i1_set(x,y); if((b==3)&&(c==0)){ t.t0_del(x+1,y); t.t0_set(x,y); if((b==3)&&(c==2)){ t.t2_del(x+1,y); t.t2_set(x,y); if((b==3)&&(c==3)){ t.t3_del(x+1,y); 28
30 t.t3_set(x,y); if((b==4)&&(c==1)){ t.l1_del(x+1,y); t.l1_set(x,y); if((b==4)&&(c==3)){ t.l3_del(x+1,y); t.l3_set(x,y); if((b==5)&&(c==1)){ t.j1_del(x+1,y); t.j1_set(x,y); if((b==5)&&(c==3)){ t.j3_del(x+1,y); t.j3_set(x,y); if((b==6)&&(c==1)){ t.s1_del(x+1,y); t.s1_set(x,y); if((b==7)&&(c==1)){ t.z1_del(x+1,y); t.z1_set(x,y); if((b==3)&&(c==1)){ t.t1_del(x+1,y); t.t1_set(x,y); if((b==4)&&(c==0)){ t.l0_del(x+1,y); 29
31 t.l0_set(x,y); if((b==4)&&(c==2)){ t.l2_del(x+1,y); t.l2_set(x,y); if((b==5)&&(c==0)){ t.j0_del(x+1,y); t.j0_set(x,y); if((b==5)&&(c==2)){ t.j2_del(x+1,y); t.j2_set(x,y); if((b==6)&&(c==0)){ t.s0_del(x+1,y); t.s0_set(x,y); if((b==7)&&(c==0)){ t.z0_del(x+1,y); t.z0_set(x,y); ; this.l0serch=function(x,y){ //o this.p=0; // 1 if((this.get(x-1,y-1)==0)&&(this.get(x-1,y)==0)) this.p++; return this.p; ; this.l1serch=function(x,y){ 30
32 // this.p=0; // 1 if (this.get(x-1,y-1)==0) this.p++; return this.p; ; this.l2serch=function(x,y){ // 2 this.p=0; // 2 if(((this.get(x,y-1)==1)&&(this.get(x-1,y-1)==0)) ((this.get(x+1,y-1)==1)&&(this.get(x,y-1)==0)) ((this.get(x+2,y-1)==1)&&(this.get(x+1,y-1)==0))) this.p++; if(((this.get(x,y)==1)&&(this.get(x-1,y)==0)) ((this.get(x+1,y)==1)&&(this.get(x,y)==0)) ((this.get(x+2,y)==1)&&(this.get(x+1,y)==0))) this.p++; return this.p; ; this.l3serch=function(x,y){ // 3 this.p=0; // 3 if(((this.get(x,y-1)==1)&&(this.get(x-1,y-1)==0)) ((this.get(x+1,y-1)==1)&&(this.get(x,y-1)==0))) this.p++; if(((this.get(x,y)==1)&&(this.get(x-1,y)==0)) ((this.get(x+1,y)==1)&&(this.get(x,y)==0))) this.p++; if(((this.get(x,y+1)==1)&&(this.get(x-1,y+1)==0)) ((this.get(x+1,y+1)==1)&&(this.get(x,y+1)==0))) this.p++; return this.p; ; this.l4serch=function(x,y){ // 4 31
33 ; this.p=0; // 1 if((this.get(x-1,y-1)==0)&&(this.get(x-1,y)==0) &&(this.get(x-1,y+1)==0)&&(this.get(x-1,y+2)==0))this.p++; return this.p; this.display=function(){ // for(i=0;i<this.map1.length;i++){ //map for(j=0;j<this.map1[i].length;j++){ if(this.map1[i][j]==1) fill(82,162,197); else if (this.map1[i][j]==2) fill(255,255,0); else if (this.map1[i][j]==3) fill(196,0,204); else if (this.map1[i][j]==4) fill(15,82,188); else if (this.map1[i][j]==5) fill(255,183,76); else if (this.map1[i][j]==6) fill(0,255,65); else if (this.map1[i][j]==7) fill(204,0,0); else fill(255); rect(i*25,j*25,25,25); ; this.clear=function(){ //1 for(j=19;j>=0;j--){ //1 20 q=0; for(i=0;i<10;i++){ if(this.map1[i][j]!=0) q++; //1 if(q==10) { 32
34 for(i=0;i<10;i++){ // this.map1[i][j]=0; // 0 this.change(j); j++; ; this.change=function(k){ // 1 for(k;k>0;k--){// 1 for(i=0;i<10;i++){ this.map1[i][k]=this.map1[i][k-1]; ; 6.3 Tetorimino.js function Tetorimino(){ this.t; this.d; this.o0_down=function(x,y){ //o0 this.o0_del(x,y-1); this.o0_set(x,y); ; this.i0_down=function(x,y){ //i0 33
35 this.i0_del(x,y-1); this.i0_set(x,y); ; this.i1_down=function(x,y){ //i1 this.i1_del(x,y-1); this.i1_set(x,y); ; this.t0_down=function(x,y){ //t0 this.t0_del(x,y-1); this.t0_set(x,y); ; this.t1_down=function(x,y){ //t1 this.t1_del(x,y-1); this.t1_set(x,y); ; this.t2_down=function(x,y){ //t2 this.t2_del(x,y-1); this.t2_set(x,y); ; this.t3_down=function(x,y){ //t3 this.t3_del(x,y-1); this.t3_set(x,y); ; this.l0_down=function(x,y){ //l0 this.l0_del(x,y-1); this.l0_set(x,y); ; this.l1_down=function(x,y){ //l1 this.l1_del(x,y-1); this.l1_set(x,y); ; this.l2_down=function(x,y){ //l2 this.l2_del(x,y-1); 34
36 this.l2_set(x,y); ; this.l3_down=function(x,y){ this.l3_del(x,y-1); this.l3_set(x,y); ; this.j0_down=function(x,y){ this.j0_del(x,y-1); this.j0_set(x,y); ; this.j1_down=function(x,y){ this.j1_del(x,y-1); this.j1_set(x,y); ; this.j2_down=function(x,y){ this.j2_del(x,y-1); this.j2_set(x,y); ; this.j3_down=function(x,y){ this.j3_del(x,y-1); this.j3_set(x,y); ; this.s0_down=function(x,y){ this.s0_del(x,y-1); this.s0_set(x,y); ; this.s1_down=function(x,y){ this.s1_del(x,y-1); this.s1_set(x,y); ; this.z0_down=function(x,y){ this.z0_del(x,y-1); this.z0_set(x,y); //l3 //j0 //j1 //j2 //j3 //s0 //s1 //z0 35
37 ; this.z1_down=function(x,y){ this.z1_del(x,y-1); this.z1_set(x,y); ; this.o0_del=function(x,y){ m.set(x,y-1,0); m.set(x+1,y-1,0); m.set(x,y,0); m.set(x+1,y,0); ; this.i0_del=function(x,y){ m.set(x,y-1,0); m.set(x,y,0); m.set(x,y+1,0); m.set(x,y+2,0) ; this.i1_del=function(x,y){ m.set(x,y-1,0); m.set(x+1,y-1,0); m.set(x+2,y-1,0); m.set(x+3,y-1,0); ; this.t0_del=function(x,y){ m.set(x+1,y-1,0); m.set(x,y,0); m.set(x+1,y,0); m.set(x+2,y,0); ; this.t1_del=function(x,y){ m.set(x,y-1,0); m.set(x,y,0); m.set(x+1,y,0); //z1 //o0 //i0 //i1 //t0 //t1 36
38 m.set(x,y+1,0); ; this.t2_del=function(x,y){ m.set(x,y-1,0); m.set(x+1,y-1,0); m.set(x+2,y-1,0); m.set(x+1,y,0); ; this.t3_del=function(x,y){ m.set(x+1,y-1,0); m.set(x,y,0); m.set(x+1,y,0); m.set(x+1,y+1,0); ; this.l0_del=function(x,y){ m.set(x,y-1,0); m.set(x,y,0); m.set(x,y+1,0); m.set(x+1,y+1,0); ; this.l1_del=function(x,y){ m.set(x,y-1,0); m.set(x+1,y-1,0); m.set(x+2,y-1,0); m.set(x,y,0); ; this.l2_del=function(x,y){ m.set(x,y,0); m.set(x+1,y,0); m.set(x+1,y+1,0); m.set(x+1,y+2,0); ; this.l3_del=function(x,y){ //t2 //t3 //l0 //l1 //l2 //l3 37
39 m.set(x+2,y-1,0); m.set(x,y,0); m.set(x+1,y,0); m.set(x+2,y,0); ; this.j0_del=function(x,y){ m.set(x+1,y-1,0); m.set(x+1,y,0); m.set(x,y+1,0); m.set(x+1,y+1,0); ; this.j1_del=function(x,y){ m.set(x,y-1,0); m.set(x,y,0); m.set(x+1,y,0); m.set(x+2,y,0); ; this.j2_del=function(x,y){ m.set(x,y-1,0); m.set(x+1,y-1,0); m.set(x,y,0); m.set(x,y+1,0); ; this.j3_del=function(x,y){ m.set(x,y-1,0); m.set(x+1,y-1,0); m.set(x+2,y-1,0); m.set(x+2,y,0); ; this.s0_del=function(x,y){ m.set(x,y-1,0); m.set(x,y,0); m.set(x+1,y,0); //j0 //j1 //j2 //j3 //s0 38
40 m.set(x+1,y+1,0); ; this.s1_del=function(x,y){ //s1 m.set(x+1,y-1,0); m.set(x+2,y-1,0); m.set(x,y,0); m.set(x+1,y,0); ; this.z0_del=function(x,y){ //z0 m.set(x+1,y-1,0); m.set(x,y,0); m.set(x+1,y,0); m.set(x,y+1,0); ; this.z1_del=function(x,y){ //z1 m.set(x,y-1,0); m.set(x+1,y-1,0); m.set(x+1,y,0); m.set(x+2,y,0); ; this.initmino=function(){ if(y==0){ b=int(random(1,8)); // 1 7, if(keyispressed){ if(key== t ){ c++; c=c%4; if(b==2){ //t // (i ) 39
41 if((c==0) (c==2)){ if((m.get(x,y+1)==0)&&(m.get(x,y+2)==0)){ //i1,i3 if(m.get(x,y+3)==0){ t.i1_del(x,y); // i1,i3 else this.d=1; // d=1 else this.d=1; if((c==1) (c==3)){ if((m.get(x+1,y)==0)&&(m.get(x+2,y)==0)){ //l0,l2 if(m.get(x+3,y)==0){ t.i0_del(x,y); // i0,i2 else this.d=2; // d=2 else this.d=2; if(this.d==1){ c=1; // c this.d=0; if(this.d==2){ c=0; this.d=0; if(b==3){ // (t ) if(c==0){ 40
42 if((m.get(x,y+1)==0)&&(m.get(x+2,y+1)==0)){ //t3 t.t3_del(x,y); // t3 else this.d=1; // d=1 if(c==1){ if((m.get(x,y+1)==0)&&(m.get(x,y+2)==0)){ //t0 if(m.get(x+1,y+1)==0){ t.t0_del(x,y); // t0 else this.d=2; // d=2 else this.d=2; if(c==2){ if((m.get(x+2,y)==0)&&(m.get(x+1,y+1)==0)){ //t1 t.t1_del(x,y); // t1 else this.d=3; // d=3 if(c==3){ if((m.get(x,y+1)==0)&&(m.get(x+1,y+2)==0)){ //t2 if(m.get(x+1,y+1)==0){ t.t2_del(x,y); // t2 else this.d=4; // d=4 else this.d=4; 41
43 if(this.d==1){ c=3; // c this.d=0; if(this.d==2){ c=0; this.d=0; if(this.d==3){ c=1; this.d=0; if(this.d==4){ c=2; this.d=0; if(b==4){ // (l ) if(c==0){ if((m.get(x,y+1)==0)&&(m.get(x,y+2)==0)){ //l3 if(m.get(x+1,y+2)==0){ t.l3_del(x,y); // l3 else this.d=1; // d=1 else this.d=1; if(c==1){ if((m.get(x+1,y)==0)&&(m.get(x+2,y)==0)){ //l0 t.l0_del(x,y); // l0 42
44 else this.d=2; // d=2 if(c==2){ if((m.get(x+1,y)==0)&&(m.get(x+1,y+1)==0)){ //l1 if(m.get(x+1,y+2)==0){ t.l1_del(x,y); // l1 else this.d=3; // d=3 else this.d=3; if(c==3){ if((m.get(x+2,y)==0)&&(m.get(x,y+1)==0)){ //l2 if(m.get(x+2,y+1)==0){ t.l2_del(x,y);// l2 else this.d=4; // d=4 else this.d=4; if(this.d==1){ c=3; // c this.d=0; if(this.d==2){ c=0; this.d=0; if(this.d==3){ c=1; this.d=0; 43
45 if(this.d==4){ c=2; this.d=0; if(b==5){ // (j ) if(c==0){ if((m.get(x+1,y)==0)&&(m.get(x+1,y+1)==0)){ //j3 if((m.get(x,y+2)==0)&&(m.get(x+1,y+2)==0)){ t.j3_del(x,y); // j3 else this.d=1; // d=1 else this.d=1; if(c==1){ if((m.get(x,y)==0)&&(m.get(x+2,y+1)==0)){ //j0 t.j0_del(x,y); // j0 else this.d=2; // d=2 if(c==2){ if((m.get(x,y+1)==0)&&(m.get(x,y+2)==0)){ //j1 t.j1_del(x,y); // j1 else this.d=3; // d=3 if(c==3){ if((m.get(x+1,y)==0)&&(m.get(x+2,y)==0)){ 44
46 //j2 if(m.get(x+2,y+1)==0){ t.j2_del(x,y); // j2 else this.d=4; // d=4 else this.d=4; if(this.d==1){ c=3; // c this.d=0; if(this.d==2){ c=0; this.d=0; if(this.d==3){ c=1; this.d=0; if(this.d==4){ c=2; this.d=0; if(b==6){ // (s ) if((c==0) (c==2)){ if((m.get(x,y+1)==0)&&(m.get(x+1,y+1)==0)){ //s1,s3 if(m.get(x+1,y+2)==0){ t.s1_del(x,y); // s1,s3 45
47 else this.d=1; // d=1 else this.d=1; if((c==1) (c==3)){ if((m.get(x+2,y)==0)&&(m.get(x,y+1)==0)){ //s0,s2 t.s0_del(x,y); // s0,s2 else this.d=2; // d=2 if(this.d==1){ c=1; // c this.d=0; if(this.d==2){ c=0; this.d=0; if(b==7){ // (z ) if((c==0) (c==2)){ if((m.get(x,y+1)==0)&&(m.get(x+1,y+1)==0)){ //z1,z3 if(m.get(x,y+2)==0){ t.z1_del(x,y); // z1,z3 else this.d=1; // d=1 else this.d=1; 46
48 if((c==1) (c==3)){ if((m.get(x+1,y+1)==0)&&(m.get(x+2,y+1)==0)){ //z0,z2 t.z0_del(x,y); // z0,z2 else this.d=2; // d=2 if(this.d==1){ c=1; // c this.d=0; if(this.d==2){ c=0; this.d=0; if(keyispressed){ if(keycode == RIGHT_ARROW){ // if((b==1)&&(x<8)&&(m.r0serch(x,y)==1)&&(y>1)){// x++;y--; // m.right(x,y+1); if((b==2)&&(c==0)&&(x<9)&&(m.r4serch(x,y)==1)&&(y>1)){ x++;y--; m.right(x,y+1); y++; if((b==2)&&(c==1)&&(x<6)&&(m.r1serch(x,y)==1)&&(y>1)){ x++;y--; m.right(x,y+1); y++; 47
49 if(((b==3)&&((c==0) (c==2)))&&(x<7)&& (m.r2serch(x,y)==2)&&(y>1)){ x++;y--; m.right(x,y+1);y++; if(((b==4)&&((c==1) (c==3)))&&(x<7)&& (m.r2serch(x,y)==2)&&(y>1)){ x++;y--; m.right(x,y+1); y++; if(((b==5)&&((c==1) (c==3)))&&(x<7)&& (m.r2serch(x,y)==2)&&(y>1)){ x++;y--; m.right(x,y+1); y++; if((((b==6) (b==7))&&(c==1))&&(x<7)&& (m.r2serch(x,y)==2)&&(y>1)){ x++;y--; m.right(x,y+1); y++; if(((b==3)&&((c==1) (c==3)))&&(x<8)&& (m.r3serch(x,y)==3)&&(y>1)){ x++;y--; m.right(x,y+1);y++; if((((b==4) (b==5))&&(c==0))&&(x<8)&& (m.r3serch(x,y)==3)&&(y>1)){ x++;y--; m.right(x,y+1); y++; if((b==4)&&(c==2)&&(x<8)&&(m.r3serch(x,y+1)==3)&&(y>1)){ x++;y--; m.right(x,y+1); y++; 48
50 if((b==5)&&(c==2)&&(x<8)&&(m.r3serch(x,y)==3)&&(y>1)){ x++;y--; m.right(x,y+1); y++; if(((b==6)&&(c==0))&&(x<8)&&(m.r3serch(x,y)==3)&&(y>1)){ x++;y--; m.right(x,y+1); y++; if(((b==7)&&(c==0))&&(x<8)&&(m.r3serch(x,y)==3)&&(y>1)){ x++;y--; m.right(x,y+1); y++; if(keyispressed){ if(keycode ==LEFT_ARROW){ // if((b==1)&&(x>0)&&(m.l0serch(x,y)==1)&&(y>1)){// x--;y--; // m.left(x,y+1); if((b==2)&&(c==0)&&(x>0)&&(m.l4serch(x,y)==1)&&(y>1)){ x--;y--; m.left(x,y+1); y++; if((b==2)&&(c==1)&&(x>0)&&(m.l1serch(x,y)==1)&&(y>1)){ x--;y--; m.left(x,y+1); y++; if(((b==3)&&((c==0) (c==2)))&&(x>0)&& (m.l2serch(x,y)==2)&&(y>1)){ x--;y--; 49
51 m.left(x,y+1); y++; if(((b==4)&&((c==1) (c==3)))&&(x>0)&& (m.l2serch(x,y)==2)&&(y>1)){ x--;y--; m.left(x,y+1); y++; if(((b==5)&&((c==1) (c==3)))&&(x>0)&& (m.l2serch(x,y)==2)&&(y>1)){ x--;y--; m.left(x,y+1); y++; if((((b==6) (b==7))&&(c==1))&&(x>0)&& (m.l2serch(x,y)==2)&&(y>1)){ x--;y--; m.left(x,y+1); y++; if(((b==3)&&((c==1) (c==3)))&&(x>0)&& (m.l3serch(x,y)==3)&&(y>1)){ x--;y--; m.left(x,y+1); y++; if((((b==4) (b==5))&&(c==0))&& (x>0)&&(m.l3serch(x,y)==3)&&(y>1)){ x--;y--; m.left(x,y+1); y++; if((b==4)&&(c==2)&&(x>0)&&(m.l3serch(x,y+1)==3)&&(y>1)){ x--;y--; m.left(x,y+1); y++; if((b==5)&&(c==2)&&(x>0)&&(m.l3serch(x,y)==3)&&(y>1)){ x--;y--; 50
52 m.left(x,y+1); y++; if(((b==6)&&(c==0))&&(x>0)&&(m.l3serch(x,y)==3)&&(y>1)){ x--;y--; m.left(x,y+1); y++; if(((b==7)&&(c==0))&&(x>0)&&(m.l3serch(x,y)==3)&&(y>1)){ x--;y--; m.left(x,y+1); y++; ; this.down=function(){ // if(b==1){ if(y==0){ if((m.get(x,y)==0)&&(m.get(x+1,y)==0) // o0 &&(m.get(x,y+1)==0)&&(m.get(x+1,y+1)==0) &&(m.get(x,y+2)==0)&&(m.get(x+1,y+2)==0)){ this.o0_del(x,y+1); y++; else w=1; // else if(m.o0_serch(x,y)==1){// 1 y++; t.o0_down(x,y); else y=0,x=4; // if(b==2){ 51
53 if(y==0){ if((m.get(x,y)==0)&&(m.get(x,y+1)==0) // i0 &&(m.get(x,y+2)==0)&&(m.get(x,y+3)==0) &&(m.get(x,y+4)==0)){ this.i0_del(x,y+1); y++; else w=1; // else if((c==0) (c==2)){ //i 1 if(m.i0_serch(x,y)==1){ y++; t.i0_down(x,y); else y=0,x=4,c=0;// else if((c==1) (c==3)){ if(m.i1_serch(x,y)==1){ y++; t.i1_down(x,y); else y=0,x=4,c=0; if(b==3){ if(y==0){ if((m.get(x,y)==0)&&(m.get(x+1,y)==0) // t0 &&(m.get(x+2,y)==0)&&(m.get(x,y+1)==0) &&(m.get(x+1,y+1)==0)&&(m.get(x+2,y+1)==0) &&(m.get(x,y+2)==0)&&(m.get(x+1,y+2)==0) &&(m.get(x+2,y+2)==0)){ 52
54 this.t0_del(x,y+1); y++; else w=1; // else if(c==0){ //t 1 if(m.t0_serch(x,y)==1){ y++; t.t0_down(x,y); else{ y=0,x=4,c=0; // else if(c==1){ if(m.t1_serch(x,y)==1){ y++; t.t1_down(x,y); else{ y=0,x=4,c=0; else if(c==2){ if(m.t2_serch(x,y)==1){ y++; t.t2_down(x,y); else{ y=0,x=4,c=0; else if(c==3){ 53
55 if(m.t3_serch(x,y)==1){ y++; t.t3_down(x,y); else{ y=0,x=4,c=0; if(b==4){ if(y==0){ if((m.get(x,y)==0)&&(m.get(x+1,y)==0) // l0 &&(m.get(x,y+1)==0)&&(m.get(x+1,y+1)==0) &&(m.get(x,y+2)==0)&&(m.get(x+1,y+2)==0) &&(m.get(x,y+3)==0)&&(m.get(x+1,y+3)==0)){ this.l0_del(x,y+1); y++; else w=1; // else if(c==0){ //l 1 if(m.l0_serch(x,y)==1){ y++; t.l0_down(x,y); else{ y=0,x=4,c=0; // else if(c==1){ if(m.l1_serch(x,y)==1){ 54
56 y++; t.l1_down(x,y); else{ y=0,x=4,c=0; else if(c==2){ if(m.l2_serch(x,y)==1){ y++; t.l2_down(x,y); else{ y=0,x=4,c=0; else if(c==3){ if(m.l3_serch(x,y)==1){ y++; t.l3_down(x,y); else{ y=0,x=4,c=0; if(b==5){ if(y==0){ if((m.get(x,y)==0)&&(m.get(x+1,y)==0) // j0 &&(m.get(x,y+1)==0)&&(m.get(x+1,y+1)==0) &&(m.get(x,y+2)==0)&&(m.get(x+1,y+2)==0) &&(m.get(x,y+3)==0)&&(m.get(x+1,y+3)==0)){ 55
57 this.j0_del(x,y+1); y++; else w=1; // else if(c==0){ //j 1 if(m.j0_serch(x,y)==1){ y++; t.j0_down(x,y); else{ y=0,x=4,c=0; // else if(c==1){ if(m.j1_serch(x,y)==1){ y++; t.j1_down(x,y); else{ y=0,x=4,c=0; else if(c==2){ if(m.j2_serch(x,y)==1){ y++; t.j2_down(x,y); else{ y=0,x=4,c=0; else if(c==3){ 56
58 if(m.j3_serch(x,y)==1){ y++; t.j3_down(x,y); else{ y=0,x=4,c=0; if(b==6){ if(y==0){ if((m.get(x,y)==0)&&(m.get(x+1,y)==0) // s0 &&(m.get(x,y+1)==0)&&(m.get(x+1,y+1)==0) &&(m.get(x,y+2)==0)&&(m.get(x+1,y+2)==0) &&(m.get(x,y+3)==0)){ this.s0_del(x,y+1); y++; else w=1; // else if((c==0) (c==2)){ if(m.s0_serch(x,y)==1){ //s 1 y++; t.s0_down(x,y); else{ y=0,x=4,c=0; // else if((c==1) (c==3)){ if(m.s1_serch(x,y)==1){ 57
59 y++; t.s1_down(x,y); else{ y=0,x=4,c=0; if(b==7){ if(y==0){ if((m.get(x,y)==0)&&(m.get(x+1,y)==0) // z0 &&(m.get(x,y+1)==0)&&(m.get(x+1,y+1)==0) &&(m.get(x,y+2)==0)&&(m.get(x+1,y+2)==0) &&(m.get(x,y+3)==0)){ this.z0_del(x,y+1); y++; else w=1; // else if((c==0) (c==2)){ if(m.z0_serch(x,y)==1){ //z 1 y++; t.z0_down(x,y); else{ y=0,x=4,c=0; // else if((c==1) (c==3)){ if(m.z1_serch(x,y)==1){ y++; 58
60 t.z1_down(x,y); else{ y=0,x=4,c=0; ; this.o0_set=function(x,t){ m.set(x,y-1,b); m.set(x+1,y-1,b); m.set(x,y,b); m.set(x+1,y,b); ; this.i0_set=function(x,y){ m.set(x,y-1,b); m.set(x,y,b); m.set(x,y+1,b); m.set(x,y+2,b); ; this.i1_set=function(x,y){ m.set(x,y-1,b); m.set(x+1,y-1,b); m.set(x+2,y-1,b); m.set(x+3,y-1,b); ; this.t0_set=function(x,y){ m.set(x+1,y-1,b); m.set(x,y,b); m.set(x+1,y,b); m.set(x+2,y,b); ; this.t1_set=function(x,y){ //o0 //i0 //i1 //t0 //t1 59
61 m.set(x,y-1,b); m.set(x,y,b); m.set(x+1,y,b); m.set(x,y+1,b); ; this.t2_set=function(x,y){ m.set(x,y-1,b); m.set(x+1,y-1,b); m.set(x+2,y-1,b); m.set(x+1,y,b); ; this.t3_set=function(x,y){ m.set(x+1,y-1,b); m.set(x,y,b); m.set(x+1,y,b); m.set(x+1,y+1,b); ; this.l0_set=function(x,y){ m.set(x,y-1,b); m.set(x,y,b); m.set(x,y+1,b); m.set(x+1,y+1,b); ; this.l1_set=function(x,y){ m.set(x,y-1,b); m.set(x+1,y-1,b); m.set(x+2,y-1,b); m.set(x,y,b); ; this.l2_set=function(x,y){ m.set(x,y,b); m.set(x+1,y,b); m.set(x+1,y+1,b); //t2 //t3 //l0 //l1 //l2 60
62 m.set(x+1,y+2,b); ; this.l3_set=function(x,y){ m.set(x+2,y-1,b); m.set(x,y,b); m.set(x+1,y,b); m.set(x+2,y,b); ; this.j0_set=function(x,y){ m.set(x+1,y-1,b); m.set(x+1,y,b); m.set(x,y+1,b); m.set(x+1,y+1,b); ; this.j1_set=function(x,y){ m.set(x,y-1,b); m.set(x,y,b); m.set(x+1,y,b); m.set(x+2,y,b); ; this.j2_set=function(x,y){ m.set(x,y-1,b); m.set(x+1,y-1,b); m.set(x,y,b); m.set(x,y+1,b); ; this.j3_set=function(x,y){ m.set(x,y-1,b); m.set(x+1,y-1,b); m.set(x+2,y-1,b); m.set(x+2,y,b); ; this.s0_set=function(x,y){ //l3 //j0 //j1 //j2 //j3 //s0 61
63 m.set(x,y-1,b); m.set(x,y,b); m.set(x+1,y,b); m.set(x+1,y+1,b); ; this.s1_set=function(x,y){ m.set(x+1,y-1,b); m.set(x+2,y-1,b); m.set(x,y,b); m.set(x+1,y,b); ; this.z0_set=function(x,y){ m.set(x+1,y-1,b); m.set(x,y,b); m.set(x+1,y,b); m.set(x,y+1,b); ; this.z1_set=function(x,y){ m.set(x,y-1,b); m.set(x+1,y-1,b); m.set(x+1,y,b); m.set(x+2,y,b); ; //s1 //z0 //z1,. HP Workstaion Z600 (Memory 4GB, CPU Xeon 2.67GHz ) OS: VineLinux 6.1 Web Browser : Firefox version 33.0 p5.js: version
64 [1] L.McCarthy, C.Reas,and B.Fry,Getting Started with p5.js,maker Media books (2015) [2], toha.html (2010) 63
65 Processing Shooting Game Shooting Game Processing N-way ,
66 Shooting( ) Boss Enemy Stage Tama set Tama set Tama type color Boss Boss Boss Boss Boss Boss Stage1 Enemy Stage2 Enemy Stage3 Enemy Stage4 Enemy Stage5 Enemy Stage6 Enemy Shooting Game,, STG SHT., 1962,, ([2] ). 1978,, 2
67 ,. 1980,,,., 1990,,,.,,. 2D, 3D,. 2D, 2. 3D 3D,, 3D FPS(First-person shooter), TPS(Third-Person Shooter). ([3] ). Processing Shooting Game, 2D,.,,, ([4] ). 1.2 Processing,, ([5] ).,,,.,, Java, Processing
68 . 6. 1, ( ).. 10, 1 1.,,..,, Shift.,. Shift 2,. ( ).. ( )..., 4
69 .,.,., , Processing. if( ), if( ),,,.,, 2, ([6] ). int keymove=0; void keypressed(){ if (key == CODED){ switch(keycode){ case UP: keymove =0x1;//0001 break; case DOWN: keymove =0x2;//0010 break; case LEFT: keymove =0x4;//0100 break; 5
70 case RIGHT: keymove =0x8;//1000 break; void keyreleased() { if (key == CODED) { switch(keycode) { case UP: keymove&=~0x1;//0001 break; case DOWN: keymove&=~0x2;//0010 break; case LEFT: keymove&=~0x4;//0100 break; case RIGHT: keymove&=~0x8;//1000 break; if((keymove&0x1)!=0)y-=speed;// if((keymove&0x2)!=0)y+=speed;// if((keymove&0x4)!=0)x-=speed;// if((keymove&0x8)!=0)x+=speed;//, 0 keymove 2, 1, 1, 2, 4, 8. 6
71 1, keymove 0001 keymove., 1., keymove 0010 keymove , 1000.,., keymove=0011, keymove 0001, keymove ,. 0010, 0100, keymove 0001,0010,0100,1000,,,,,,. keystat Shift. 2.2 Processing Processing, y, 2 x 0., Processing 1,,.. 1 z angle(). 7
72 2 \end{figure float z_angle(float Ex,float Ey){ float angle; angle=atan((y-ey)/(x-ex)); if(x-ex<0)angle=pi+angle; return angle;,. 2 arctan, angle=atan((y-ey)/(x-ex));,., xy-. Processing, y,., if(x-ex<0)angle=pi+angle;. 2.3 N-way N-way., N., N-way, N 8
73 . N,,. N,,,,. 3 N 4 N,. void N_way(float x,float y,float speed,int span,int N,float angle, float anglespan,tama_set2 Tama,Tama_type TamaT,color c){ //( X, Y,,,way,, //,Tama_set ( ),Tama_type (, ), ) if(tama.flag==true){ if(tama.time%span==0){//sspan Tama.Tspeed[Tama.n]=speed; for(int k=1;k<n+1;k++){ Tama.Tx[Tama.n][k]=x; Tama.Ty[Tama.n][k]=y; 9
74 Tama.out[Tama.n][k]=true; if(n%2!=0){// for(int k=n/2,k1=1;k>0;k--,k1++){ Tama.Tangle[Tama.n][k]=angle-anglespan*k1; // for(int k=n/2+1,k1=0;k<n+1;k++,k1++){ Tama.Tangle[Tama.n][k]=angle+anglespan*k1; // if(n%2==0){// for(int k=n/2,k1=1;k>0;k--,k1++){ Tama.Tangle[Tama.n][k]=angle-anglespan*(k1-0.5); // for(int k=n/2+1,k1=1;k<n+1;k++,k1++){ Tama.Tangle[Tama.n][k]=angle+anglespan*(k1-0.5); // Tama.n++; fill(c,150); for(int k=0;k<tama.n;k++){ for(int k1=1;k1<n+1;k1++){ if(tama.out[k][k1]==true){ TamaT.display(Tama.Tx[k][k1],Tama.Ty[k][k1]); Tama.Tx[k][k1]=Tama.Tx[k][k1]+cos(Tama.Tangle[k][k1])*Tama.Tspeed[k]; Tama.Ty[k][k1]=Tama.Ty[k][k1]+sin(Tama.Tangle[k][k1])*Tama.Tspeed[k]; // x y 10
75 if(life_flag==true)check2(tama,n,tamat); Tama.time++;,, N ,,. N,,,,, anglespan( ),,, anglespan 0.5, 1.5, 2.5,. 2.4.,.,,, Tama set,,.,,., 1 1,. // void check1(tama_set1 T,Tama_type t){ for(int k=0;k<t.n;k++){ // if(sqrt(pow(t.tx[k]-x,2)+pow(t.ty[k]-y,2))<t.r&&t.out[k]==true){ life--; life_flag=false; 11
76 // if(t.out[k]==true){ if(t.tx[k]<=playzonexs-300 T.Tx[k]>=playZoneXe+300 T.Ty[k]<=playZoneYs-300 T.Ty[k]>=playZoneYe+300)T.out[k]=false; // if(life_flag==true)check1(tama,tamat);// check(), Tama set, Tama type., Tama type, r, r, 1. 5 r,.,,, PC,, Tama set out boolean, true( ). 12
77 2.5,,. check() 60,.,,,,,,. // void Zmuteki(){ if(life_flag==false)i_life++; // muteki_time if(i_life>=muteki_time){//muteki_time life_flag=true; i_life=0; // if(life_flag==false){// if((framecount/10)%2==0){ fill(255,100,100); ellipse(x,y,20,20);// life flag, boolean, false, check().,,,. 13
78 2.6,, retry.,,.,, 1,, mystage.stage=1, 1.,., mystage.stage=1, stage time, Enemy flag false.,,. // int retry=0;// Stage[] mystage=new Stage[20];// Stage. //mousepressed() // if(status==2&¢erx+20<mousex&&mousex<centerx+180&¢ery+60<mousey&& mousey<centery+105){ score=0; life=initiallife; status=1; retry++;// mystage[retry]=new Stage(); X=centerX; Y=centerY+150;// life_flag=true; //draw() 14
79 mystage[retry].stage_play();, Stage, retry., draw() mystage[retry], retry 1, mystage[retry],.,.,, Boss Enemy, (,.), 1., Java,.,.,. ([1, Chapter22,P.487] ). Boos Enemy, Boss1, Enemy1. class Boss1 extends Boss{\\class extends Boss1(){ super(centerx,playzoneys+50,4600,-1,0,250,10,blue); //Boss, super(),,,.,. 15
80 2.8,.,,,,,., Stage. Stage, stage time, stage status, if(stage time>=100)" ", if(stage status=2)" ",.,, Enemy Eflag false, Eflag true. \\Stage ( ) class Stage{ int stage;// int stage_time;// int stage_status;//1, 2 Stage(){ stage=1; stage_time=0; stage_status=1; void stage_play(){ if(stage==1){ if(stage_status==1){ for(int n=0;n<e1.length;n++){ if(stage_time>=60+60*n&&e1.eflag==true)e1.edisplay(); if(stage_status==2){ B1.Bdisplay(); 16
81 if(stage==2){ stage_time++; Zdisplay();// 2.9 Boss,,.. Boss-n n.,. Boss. Enemy,. Enemy-n. Enemy. Shooting,, Stage1 Enemy. Stage Boss-n Enemy-n,,. Tama set1,,.,,. Tama set2 Tama set1, N-way, Tama set2. Tama type,,. 17
82 . 3, 3.1,. Processing Shooting,,, Stage Practice, RETR TITLE, OutOfMemoryError Processing, ([ 6] ). 6 OutOfMemoryError,,., Processing,, PC,, 700MB,, RETRY TITLE 500MB., CPU ([ 7] ). PC, 16GB PC,, 18
83 7., 2. 1 Tama set,. Tama set1, 5000 float 5. float, 1 4byte, 1, [B] = 200[KB]., Tama set2, float 4, [B] = 6.4[MB].,., 2.6, RETRY,, RETRY.,, Tama set.,,. 2,.,,. 19
84 ,, null ([7] )., Tama set,, 7,,.,,.,. // /*void GCTs1(Tama_set1 T){ T.Tx=null; T.Ty=null; T.Tspeed=null; T.Tangle=null; T.out=null; */ /*void GCTs2(Tama_set2 T){ T.Tx=null; T.Ty=null; T.Tspeed=null; /T.Tangle=null; T.out=null; */,.,.,.,,,,.,,, 20
85 ,.,,,.,,,.,,,,,.,,,.,,,. 3.2,,,,,,,,,.,,.,.,,.,,,,,.,,,., 1 x, y 21
86 ,.,,,,,.,,, 8,,. 8 UI,, 0.,,.,, 22
87 ,,, Processing,,,.,,.,,,,.,,. 4.2,.,,,,,..,,,, Shooting Game. 23
88 5 5.1 Shooting( ) int keymove=0; // ( ) int keystat=0; // ( ) int X,Y;// int speed;// float beamdamage=0;// int score=0;// int hiscore=0;// int initiallife=8;// int life=initiallife;// boolean life_flag=true;//false= int i_life=0;//, int muteki_time=180;// 180 (3 ) int status=0;// 0,1,2 GAMEOVER, //3 Practice,4 Practice int prestatus=1;// int retry=0;// int playzonexs=200;// int playzonexe=800;// int playzoneys=10;// int playzoneye=600;// int centerx=(playzonexs+playzonexe)/2;// x int centery=(playzoneys+playzoneye)/2;// y Stage[] mystage=new Stage[20]; // Stage. //20 24
89 void setup(){ size(840,620); rectmode(center); ellipsemode(center); X=centerX;// X Y=centerY+150;// Y speed=5;// mystage[0]=new Stage();// //, 2. // 2. void keypressed(){ if (key == CODED){ switch(keycode){ case UP: keymove =0x1; break; case DOWN: keymove =0x2; break; case LEFT: keymove =0x4; break; case RIGHT: keymove =0x8; break; case SHIFT: keystat =0x1; break; 25
90 // 2. void keyreleased() { if (key == CODED) { switch(keycode) { case UP: keymove^=0x1; break; case DOWN: keymove^=0x2; break; case LEFT: keymove^=0x4; break; case RIGHT: keymove^=0x8; break; case SHIFT: keystat^=0x1; break; // void Zmove(){ if((keymove&0x1)!=0)y-=speed;// if((keymove&0x2)!=0)y+=speed;// if((keymove&0x4)!=0)x-=speed;// if((keymove&0x8)!=0)x+=speed;// // X=constrain(X,playZoneXs,playZoneXe); Y=constrain(Y,playZoneYs,playZoneYe); 26
91 // void Zspeed(){ if((keystat&0x1)!=0)speed=2;// 2 else if((keystat&0x1)==0)speed=5;// 5 //, void Zbeam(){ // if((keystat&0x1)!=0){ stroke(random(100,255),random(0,100),random(0,100)); beamdamage=20; // else if((keystat&0x1)==0){ stroke(random(0,100),random(0,100),random(100,255)); beamdamage=30; line(x, Y - 10, X, 0);// nostroke(); // float z_angle(float Ex,float Ey){ float angle; angle=atan((y-ey)/(x-ex)); if(x-ex<0)angle=pi+angle;//arctan return angle; //Shoot 27
92 void Shoot(float Sx,float Sy,int Sspan,float Sangle,float Eangle,float Sspeed, float Espeed,Tama_set1 Tama,Tama_type TamaT,color c){ // X, Y,, 1, 2, 1, // 2,Tama_set ( ), // Tama_type (, ), // 1 2 // 1 2 if(tama.flag==true){ if(tama.time%sspan==0){//sspan Tama.Tx[Tama.n]=Sx; Tama.Ty[Tama.n]=Sy; Tama.Tangle[Tama.n]=random(Sangle,Eangle); Tama.Tspeed[Tama.n]=random(Sspeed,Espeed); Tama.out[Tama.n]=true; Tama.n++; fill(c,150); for(int k=0;k<tama.n;k++){ if(tama.out[k]==true){ TamaT.display(Tama.Tx[k],Tama.Ty[k]); Tama.Tx[k]=Tama.Tx[k]+cos(Tama.Tangle[k])*Tama.Tspeed[k]; Tama.Ty[k]=Tama.Ty[k]+sin(Tama.Tangle[k])*Tama.Tspeed[k]; // x y if(life_flag==true)check1(tama,tamat);// Tama.time++; 28
93 // void zikishoot(float x,float y,float speed,int span, Tama_set1 Tama,Tama_type TamaT,color c){ //( X, Y,,, // Tama_set ( ),Tama_type (, ), ) if(tama.flag==true){ if(tama.time%span==0){//sspan Tama.Tx[Tama.n]=x; Tama.Ty[Tama.n]=y; Tama.Tangle[Tama.n]=z_angle(x,y);// Tama.Tspeed[Tama.n]=speed; Tama.out[Tama.n]=true; Tama.n++; fill(c,150); for(int k=0;k<tama.n;k++){ if(tama.out[k]==true){ TamaT.display(Tama.Tx[k],Tama.Ty[k]); Tama.Tx[k]=Tama.Tx[k]+cos(Tama.Tangle[k])*Tama.Tspeed[k]; Tama.Ty[k]=Tama.Ty[k]+sin(Tama.Tangle[k])*Tama.Tspeed[k]; // x y if(life_flag==true)check1(tama,tamat);// Tama.time++; // Tama_set1 void check1(tama_set1 T,Tama_type t){ for(int k=0;k<t.n;k++){ // if(sqrt(pow(t.tx[k]-x,2)+pow(t.ty[k]-y,2))<t.r&&t.out[k]==true){ life--; 29
94 life_flag=false; // if(t.out[k]==true){ if(t.tx[k]<=playzonexs-300 T.Tx[k]>=playZoneXe+300 T.Ty[k]<=playZoneYs-300 T.Ty[k]>=playZoneYe+300)T.out[k]=false; void N_way(float x,float y,float speed,int span,int N,float angle, float anglespan,tama_set2 Tama,Tama_type TamaT,color c){ //( X, Y,,,way,, //,Tama_set ( ),Tama_type (, ), ) if(tama.flag==true){ if(tama.time%span==0){//sspan Tama.Tspeed[Tama.n]=speed; for(int k=1;k<n+1;k++){ Tama.Tx[Tama.n][k]=x; Tama.Ty[Tama.n][k]=y; Tama.out[Tama.n][k]=true; if(n%2!=0){// for(int k=n/2,k1=1;k>0;k--,k1++){ Tama.Tangle[Tama.n][k]=angle-anglespan*k1; // for(int k=n/2+1,k1=0;k<n+1;k++,k1++){ Tama.Tangle[Tama.n][k]=angle+anglespan*k1; // if(n%2==0){// 30
95 for(int k=n/2,k1=1;k>0;k--,k1++){ Tama.Tangle[Tama.n][k]=angle-anglespan*(k1-0.5); // for(int k=n/2+1,k1=1;k<n+1;k++,k1++){ Tama.Tangle[Tama.n][k]=angle+anglespan*(k1-0.5); // Tama.n++; fill(c,150); for(int k=0;k<tama.n;k++){ for(int k1=1;k1<n+1;k1++){ if(tama.out[k][k1]==true){ TamaT.display(Tama.Tx[k][k1],Tama.Ty[k][k1]); Tama.Tx[k][k1]=Tama.Tx[k][k1]+cos(Tama.Tangle[k][k1])*Tama.Tspeed[k]; Tama.Ty[k][k1]=Tama.Ty[k][k1]+sin(Tama.Tangle[k][k1])*Tama.Tspeed[k]; // x y if(life_flag==true)check2(tama,n,tamat); Tama.time++; // Tama_set2 void check2(tama_set2 T,int N,Tama_type t){ for(int k=0;k<t.n;k++){ for(int k1=1;k1<n+1;k1++){ if(sqrt(pow(t.tx[k][k1]-x,2)+pow(t.ty[k][k1]-y,2))<t.r&& T.out[k][k1]==true){// 31
96 life--; life_flag=false; // if(t.out[k][k1]==true){ if(t.tx[k][k1]<=playzonexs-300 T.Tx[k][k1]>=playZoneXe+300 T.Ty[k][k1]<=playZoneYs-300 T.Ty[k][k1]>=playZoneYe+300) T.out[k][k1]=false; // void Zmuteki(){ if(life_flag==false)i_life++; if(i_life>=muteki_time){ life_flag=true; i_life=0; // void outdisplay(){ rectmode(corner); fill(0); rect(0,0,playzonexs,height); rect(playzonexe,0,width,height); rect(0,0,width,playzoneys); rect(0,playzoneye,width,height); textsize(40); fill(240); textalign(right); text("hiscore",playzonexs-10,50); text("score",playzonexs-10,150); 32
97 text("life",playzonexs-10,280); textsize(30); text(hiscore,playzonexs-10,100); text(score,playzonexs-10,200); ellipsemode(center); //life10 if(life>5){ for(int k=0;k<life-5;k++)ellipse(playzonexs-20-40*k,360,30,30); for(int k=0;k<life;k++)ellipse(playzonexs-20-40*k,310,30,30); textalign(left); textsize(50); text("stage",10,playzoneye); text(mystage[retry].stage,150,playzoneye); mystage[retry].marker();// void Zdisplay(){ Zspeed();// Zmove();// Zbeam();// Zmuteki();// nostroke(); if(life_flag==false){// if((framecount/10)%2==0){ fill(255,100,100); ellipse(x,y,20,20);// else{ fill(255); ellipse(x,y,20,20);// 33
98 void gameover(){ //status 1 4 if(status==1 status==4)prestatus=status; status=2; fill(255); textsize(72); textalign(center); text("game OVER",centerX,centerY-120); textsize(50); if(prestatus==1){ if(centerx+20<mousex&&mousex<centerx+180&¢ery+60<mousey&& mousey<centery+105)fill(255,0,0,200); text("retry",centerx+100,centery+100); fill(255); if(centerx+30<mousex&&mousex<centerx+165&¢ery-10<mousey&& mousey<centery+30)fill(255,0,0,200); text("title",centerx+100,centery+30); void mousepressed(){ // if(status==2&¢erx+20<mousex&&mousex<centerx+180&¢ery+60<mousey&& mousey<centery+105){ score=0; life=initiallife; status=1; retry++;// mystage[retry]=new Stage(); X=centerX; Y=centerY+150;// 34
99 life_flag=true; // if((status==2 prestatus==5)&¢erx+30<mousex&&mousex<centerx+165&& centery-10<mousey&&mousey<centery+30){ score=0; life=initiallife; status=0; retry++;// mystage[retry]=new Stage(); X=centerX; Y=centerY+150;// life_flag=true; //GAME PLAY if(status==0&&width/2-200<mousex&&mousex<width/2+200&& height/2-160<mousey&&mousey<height/2-95)status=1; //STAGE Practice if(status==0&&width/2-260<mousex&&mousex<width/2+260&&height/2+40<mousey&& mousey<height/2+105)status=3; //Stage Practice Stage if(status==3){ if(width/2-245<mousex&&mousex<width/2-60&&height/2-290<mousey&& mousey<height/2-245){ mystage[retry].stage=1; mystage[retry].stage_status=1; status=4; if(width/2-245<mousex&&mousex<width/2-60&&height/2-190<mousey&& mousey<height/2-145){ mystage[retry].stage=2; mystage[retry].stage_status=1; status=4; 35
100 if(width/2-245<mousex&&mousex<width/2-60&&height/2-90<mousey&& mousey<height/2-45){ mystage[retry].stage=3; mystage[retry].stage_status=1; status=4; if(width/2-245<mousex&&mousex<width/2-60&&height/2-+10<mousey&& mousey<height/2+55){ mystage[retry].stage=4; mystage[retry].stage_status=1; status=4; if(width/2-245<mousex&&mousex<width/2-60&&height/2+110<mousey&& mousey<height/2+155){ mystage[retry].stage=5; mystage[retry].stage_status=1; status=4; if(width/2-245<mousex&&mousex<width/2-60&&height/2+210<mousey&& mousey<height/2+255){ mystage[retry].stage=6; mystage[retry].stage_status=1; status=4; if(width/2+75<mousex&&mousex<width/2+220&&height/2-290<mousey&& mousey<height/2-245){ mystage[retry].stage=1; mystage[retry].stage_status=2; status=4; if(width/2+75<mousex&&mousex<width/2+220&&height/2-190<mousey&& mousey<height/2-145){ 36
101 mystage[retry].stage=2; mystage[retry].stage_status=2; status=4; if(width/2+75<mousex&&mousex<width/2+220&&height/2-90<mousey&& mousey<height/2-45){ mystage[retry].stage=3; mystage[retry].stage_status=2; status=4; if(width/2+75<mousex&&mousex<width/2+220&&height/2+10<mousey&& mousey<height/2+55){ mystage[retry].stage=4; mystage[retry].stage_status=2; status=4; if(width/2+75<mousex&&mousex<width/2+220&&height/2+110<mousey&& mousey<height/2+155){ mystage[retry].stage=5; mystage[retry].stage_status=2; status=4; if(width/2+75<mousex&&mousex<width/2+220&&height/2+210<mousey&& mousey<height/2+255){ mystage[retry].stage=6; mystage[retry].stage_status=2; status=4; //title if(width-105<mousex&&mousex<width-35&&height-40<mousey&& mousey<height-20)status=0; 37
102 // void score(){ if(score>hiscore)hiscore=score; // void title(){ background(150); fill(255); textsize(72); textalign(center); if(width/2-200<mousex&&mousex<width/2+200&&height/2-160<mousey&& mousey<height/2-95)fill(255,0,0,200); text("game PLAY",width/2,height/2-100); fill(255); if(width/2-260<mousex&&mousex<width/2+260&&height/2+40<mousey&& mousey<height/2+105)fill(255,0,0,200); text("stage Practice",width/2,height/2+100); //STAGE Practice void stage_practice(){ background(150); fill(255); textsize(50); textalign(center); if(width/2-245<mousex&&mousex<width/2-60&&height/2-290<mousey&& mousey<height/2-245)fill(255,0,0,200); text("stage1",width/2-150,height/2-250); fill(255); if(width/2-245<mousex&&mousex<width/2-60&&height/2-190<mousey&& mousey<height/2-145)fill(255,0,0,200); text("stage2",width/2-150,height/2-150); 38
103 fill(255); if(width/2-245<mousex&&mousex<width/2-60&&height/2-90<mousey&& mousey<height/2-45)fill(255,0,0,200); text("stage3",width/2-150,height/2-50); fill(255); if(width/2-245<mousex&&mousex<width/2-60&&height/2-+10<mousey&& mousey<height/2+55)fill(255,0,0,200); text("stage4",width/2-150,height/2+50); fill(255); if(width/2-245<mousex&&mousex<width/2-60&&height/2+110<mousey&& mousey<height/2+155)fill(255,0,0,200); text("stage5",width/2-150,height/2+150); fill(255); if(width/2-245<mousex&&mousex<width/2-60&&height/2+210<mousey&& mousey<height/2+255)fill(255,0,0,200); text("stage6",width/2-150,height/2+250); fill(255); if(width/2+75<mousex&&mousex<width/2+220&&height/2-290<mousey&& mousey<height/2-245)fill(255,0,0,200); text("boss1",width/2+150,height/2-250); fill(255); if(width/2+75<mousex&&mousex<width/2+220&&height/2-190<mousey&& mousey<height/2-145)fill(255,0,0,200); text("boss2",width/2+150,height/2-150); fill(255); if(width/2+75<mousex&&mousex<width/2+220&&height/2-90<mousey&& mousey<height/2-45)fill(255,0,0,200); text("boss3",width/2+150,height/2-50); fill(255); if(width/2+75<mousex&&mousex<width/2+220&&height/2+10<mousey&& mousey<height/2+55)fill(255,0,0,200); text("boss4",width/2+150,height/2+50); fill(255); 39
104 if(width/2+75<mousex&&mousex<width/2+220&&height/2+110<mousey&& mousey<height/2+155)fill(255,0,0,200); text("boss5",width/2+150,height/2+150); fill(255); if(width/2+75<mousex&&mousex<width/2+220&&height/2+210<mousey&& mousey<height/2+255)fill(255,0,0,200); text("boss6",width/2+150,height/2+250); fill(255); if(width-105<mousex&&mousex<width-35&&height-40<mousey&& mousey<height-20)fill(255,0,0,200); textsize(25); text("title",width-70,height-20); void draw(){ if(life==-1)gameover();//0 1 else if(status==1 status==4){// 1 4 background(150); mystage[retry].stage_play();// outdisplay();// score();// else if(status==0)title();// else if(status==3)stage_practice();//stagepractice 5.2 Boss class Boss{ float Bx;float By;//Boss float BHP;//Boss HP float BHP0;//Boss HP 40
105 float BspeedX;//X float BspeedY;//Y float BmaxY;//Y max int Bstatus;//0 int timeout;// int movetype;//1,2 int time;//boss int movetime;// (movetype2) int movespan;// (movetype2) int movetimecounter;//movetype2 float movemax;// float size;// color Bc;// Boss(float x,float y,float HP,float sx,float sy,float my, float Bsize,color c){ movetype=1; Bx=x;By=y; BHP=HP;BHP0=HP; BspeedX=sX;BspeedY=sY; BmaxY=mY; size=bsize; Bc=c; Bstatus=1; timeout=0; time=0; Boss(float x,float y,float HP,int Mtime,int Mspan,float Mmax, float my,float Bsize,color c){ movetype=2; Bx=x;By=y; BHP=HP;BHP0=HP; BspeedX=0;BspeedY=0; movetime=mtime; 41
106 movespan=mspan; movemax=mmax; BmaxY=mY; size=bsize; Bc=c; Bstatus=1; timeout=0; time=0; void Bmove(){ if(movetype==1)bmove1(); if(movetype==2)bmove2(); // void Bmove1(){ Bx=Bx+BspeedX;// if((bx<playzonexs) (Bx+10>playZoneXe))BspeedX=-BspeedX; // By=By-BspeedY;// if((by<playzoneys) (By+10>BmaxY))BspeedY=-BspeedY; // void Bmove2(){ if(movetimecounter>=movetime+movespan){ // movetime movetime BspeedX=random(-movemax,movemax)/movetime; BspeedY=random(-movemax,movemax)/movetime; movetimecounter=0; //movetime if(movetimecounter>=movetime){ BspeedX=0;BspeedY=0; 42
107 Bmove1(); movetimecounter++; void Bdisplay(){ if(bstatus!=0){ Bmove();// Bdamage();// Bshoot();// time++; if(bhp>=0){ Bshape();//HP if(bstatus==0){ textsize(72); textalign(center); fill(255); if(mystage[retry].stage==6)text("game CLEAR",centerX,centerY-120); else text("stage CLEAR",centerX,centerY-120); textsize(36); if(mystage[retry].stage==6) text("game CLEAR BONUS +"+10000*myStage[retry].stage,centerX,centerY-80); else text("stage CLEAR BONUS +"+10000*myStage[retry].stage, centerx,centery-80);//10000* if(status==1&&mystage[retry].stage!=6)timeout++; // 6 if(timeout>=300){ mystage[retry].stage++; mystage[retry].stage_status=1; mystage[retry].stage_time=0; timeout=0; life++; 43
108 // if(status==4){ prestatus=5; textsize(50); fill(255); if(centerx+30<mousex&&mousex<centerx+165&¢ery-10<mousey&& mousey<centery+30)fill(255,0,0,200); text("title",centerx+100,centery+30); //Boss HP movetype=1 void Breset(float HP,float sx,float sy){ BHP=HP;BHP0=BHP; time=0; BspeedX=sX;BspeedY=sY; Bstatus++; movetype=1; //Boss HP movetype=2 void Breset2(float HP,int Mtime,int Mspan,float Mmax){ BHP=HP;BHP0=BHP; time=0; movetime=mtime; movespan=mspan; movemax=mmax; BspeedX=0;BspeedY=0; Bstatus++; movetype=2; // void Bdamage(){ 44
109 if(bx-size/2<=x&&x<=bx+size/2){// BHP=BHP-beamDamage; // score=score+(int)beamdamage/5; // HP fill(red); rectmode(corner); if(bhp>0)rect(playzonexs+5,playzoneys+5, (playzonexe-playzonexs)*bhp/bhp0-10,10); rectmode(center); // void Bcrush(){ Bstatus=0; score=score+10000*mystage[retry].stage; // void enemy_marker(){ fill(150,150,250,100); ellipse(bx,playzoneye+(height-playzoneye)/2,80,15); textsize(10); textalign(center); fill(255,200); text(" ",Bx,playZoneYe+(height-playZoneYe)/2); text("enemy",bx,playzoneye+(height-playzoneye)/2+5); // void Bshoot(){ // void Bshape(){ fill(bc); ellipse(bx,by,size,size);// 45
110 5.3 Enemy class Enemy{ float Ex;// X float Ey;// Y float Espeed;// float EspeedX;// X float EspeedY;// Y float Eangle;// float EHP;// boolean Eflag;// int Escore;// float Esize;// int movetype;// 1= 2 float xstop;// X float ystop;// Y int timestop;// int time;// // Enemy(float x,float y,float speed,float angle,float HP,int score,float size){ //( X, Y,,, HP,, ) movetype=0; Ex=x;Ey=y; Espeed=speed; Eangle=angle; EHP=HP; Eflag=true; Escore=score; Esize=size; 46
111 time=0; // Enemy(float x,float y,int t,float xs,float ys,float HP,int score,float size){ //( X, Y,, X,Y, // HP,, movetype=1; Ex=x;Ey=y; EHP=HP; Eflag=true; Escore=score; Esize=size; xstop=xs;ystop=ys; timestop=t; // speed, t EspeedX=(xS-x)/t;EspeedY=(yS-y)/t; time=0; void Emove(){ if(movetype==0){ // X, Ex=Ex+Espeed*cos(Eangle); Ey=Ey+Espeed*sin(Eangle); else if(movetype==1){ if(time<=timestop){ // Ex=Ex+EspeedX; Ey=Ey+EspeedY; // 47
112 if((ex+esize<playzonexs) (Ex-Esize>playZoneXe))Eflag=false; if((ey+esize<playzoneys) (Ey-Esize>playZoneYe))Eflag=false; void Edisplay(){ Emove();// Edamage();// Eshoot();// Eshape();// time++; void Edamage(){ // if(ex-esize/2<=x&&x<=ex+esize/2){ EHP=EHP-beamDamage; if(ehp<=0){ //, Eflag=false; score=score+escore; // void Eshoot(){ // void Eshape(){ 5.4 Stage class Stage{ int stage;// int stage_time;// 48
113 int stage_status;//1, 2 // Boss1 B1=new Boss1(); Boss2 B2=new Boss2(); Boss3 B3=new Boss3(); Boss4 B4=new Boss4(); Boss5 B5=new Boss5(); Boss6 B6=new Boss6(); // 1 Enemy1[] E1=new Enemy1[3]; Enemy2[] E2=new Enemy2[3]; Enemy3[] E3=new Enemy3[3]; Enemy4 E4=new Enemy4(); Enemy5 E5=new Enemy5(); Enemy6[] E6=new Enemy6[4]; Enemy7[] E7=new Enemy7[4]; Enemy8 E8=new Enemy8(); Enemy9 E9=new Enemy9(); // 2 Enemy10[] E10=new Enemy10[6]; Enemy11[] E11=new Enemy11[6]; Enemy12 E12=new Enemy12(); Enemy13 E13=new Enemy13(); Enemy14 E14=new Enemy14(); Enemy15[] E15=new Enemy15[4]; Enemy16[] E16=new Enemy16[4]; // 3 Enemy17[] E17=new Enemy17[8]; Enemy18[] E18=new Enemy18[8]; Enemy19[] E19=new Enemy19[80]; 49
114 Enemy20[] E20=new Enemy20[4]; // 4 Enemy21[] E21=new Enemy21[8]; Enemy22[] E22=new Enemy22[8]; Enemy23[] E23=new Enemy23[6]; Enemy24 E24_1=new Enemy24(); Enemy25 E25_1=new Enemy25(); Enemy26 E26_1=new Enemy26(); Enemy24 E24_2=new Enemy24(); Enemy25 E25_2=new Enemy25(); Enemy26 E26_2=new Enemy26(); // 5 Enemy27[] E27=new Enemy27[4]; Enemy28[] E28=new Enemy28[4]; Enemy29[] E29=new Enemy29[4]; Enemy30[] E30=new Enemy30[4]; Enemy31 E31=new Enemy31(); Enemy32[] E32=new Enemy32[4]; Enemy33[] E33=new Enemy33[4]; // 6 Enemy34 E34=new Enemy34(); Enemy35 E35=new Enemy35(); Enemy36 E36=new Enemy36(); Enemy37 E37=new Enemy37(); Enemy38 E38=new Enemy38(); Enemy39 E39=new Enemy39(); Stage(){ stage=1; stage_time=0; stage_status=1; 50
115 // 1 for(int n=0;n<e1.length;n++){ E1[n]=new Enemy1(); for(int n=0;n<e2.length;n++){ E2[n]=new Enemy2(); for(int n=0;n<e3.length;n++){ E3[n]=new Enemy3(); for(int n=0;n<e6.length;n++){ E6[n]=new Enemy6(); for(int n=0;n<e7.length;n++){ E7[n]=new Enemy7(); // 2 for(int n=0;n<e10.length;n++){ E10[n]=new Enemy10(); for(int n=0;n<e11.length;n++){ E11[n]=new Enemy11(); for(int n=0;n<e15.length;n++){ E15[n]=new Enemy15(); for(int n=0;n<e16.length;n++){ E16[n]=new Enemy16(); // 3 for(int n=0;n<e17.length;n++){ 51
116 E17[n]=new Enemy17(); for(int n=0;n<e18.length;n++){ E18[n]=new Enemy18(); for(int n=0;n<e19.length;n++){ E19[n]=new Enemy19(); for(int n=0;n<e20.length;n++){ E20[n]=new Enemy20(); // 4 for(int n=0;n<e21.length;n++){ E21[n]=new Enemy21(); for(int n=0;n<e22.length;n++){ E22[n]=new Enemy22(); for(int n=0;n<e23.length;n++){ E23[n]=new Enemy23(); // 5 for(int n=0;n<e27.length;n++){ E27[n]=new Enemy27(); for(int n=0;n<e28.length;n++){ E28[n]=new Enemy28(); for(int n=0;n<e29.length;n++){ E29[n]=new Enemy29(); 52
117 for(int n=0;n<e30.length;n++){ E30[n]=new Enemy30(); for(int n=0;n<e32.length;n++){ E32[n]=new Enemy32(); for(int n=0;n<e33.length;n++){ E33[n]=new Enemy33(); void stage_play(){ rectmode(center); ellipsemode(center); // if(stage==1){ if(stage_status==1){ for(int n=0;n<e1.length;n++){ if(stage_time>=60+60*n&&e1[n].eflag==true)e1[n].edisplay(); for(int n=0;n<e2.length;n++){ if(stage_time>=60+60*n&&e2[n].eflag==true)e2[n].edisplay(); for(int n=0;n<e3.length;n++){ if(stage_time>=60+60*n&&e3[n].eflag==true)e3[n].edisplay(); if(stage_time>=320&&e4.eflag==true)e4.edisplay(); if(stage_time>=400&&e5.eflag==true)e5.edisplay(); for(int n=0;n<e7.length;n++){ if(stage_time>=600+40*n&&e7[n].eflag==true)e7[n].edisplay(); for(int n=0;n<e6.length;n++){ if(stage_time>=800+40*n&&e6[n].eflag==true)e6[n].edisplay(); 53
118 if(stage_time>=1000&&e8.eflag==true)e8.edisplay(); if(stage_time>=1000&&e9.eflag==true)e9.edisplay(); if(stage_time>=1500&&e8.eflag==false&&e9.eflag==false)stage_status=2; if(stage_status==2){ B1.Bdisplay(); if(stage==2){ if(stage_status==1){ for(int n=0;n<e10.length;n++){ if(stage_time>=60+20*n&&e10[n].eflag==true)e10[n].edisplay(); for(int n=0;n<e11.length;n++){ if(stage_time>=220+20*n&&e11[n].eflag==true)e11[n].edisplay(); if(stage_time>=600&&e12.eflag==true)e12.edisplay(); for(int n=0;n<e15.length;n++){ if(stage_time>= *n&&e15[n].eflag==true)e15[n].edisplay(); if(stage_time>= *n&&e16[n].eflag==true)e16[n].edisplay(); if(stage_time>=1500&&e13.eflag==true)e13.edisplay(); if(stage_time>=1500&&e14.eflag==true)e14.edisplay(); if(stage_time>=2000&&e14.eflag==false&&e13.eflag==false)stage_status=2; if(stage_status==2){ B2.Bdisplay(); if(stage==3){ if(stage_status==1){ 54
119 for(int n=0;n<e17.length;n++){ if(stage_time>=60+20*n&&e17[n].eflag==true)e17[n].edisplay(); if(stage_time>=60+20*n&&e18[n].eflag==true)e18[n].edisplay(); for(int n=0;n<e19.length;n++){ if(stage_time>=320+25*n&&e19[n].eflag==true)e19[n].edisplay(); for(int n=0;n<e20.length;n++){ if(stage_time>= *n&&e20[n].eflag==true)e20[n].edisplay(); if(stage_time>=2800)stage_status=2; if(stage_status==2){ B3.Bdisplay(); if(stage==4){ if(stage_status==1){ for(int n=0;n<e21.length;n++){ if(stage_time>=50+30*n&&e21[n].eflag==true)e21[n].edisplay(); if(stage_time>=110+30*n&&e22[n].eflag==true)e22[n].edisplay(); for(int n=0;n<e23.length;n++){ if(stage_time>=300+40*n&&e23[n].eflag==true)e23[n].edisplay(); if(stage_time>=800&&e24_1.eflag==true)e24_1.edisplay(); if(stage_time>=1200&&e25_1.eflag==true)e25_1.edisplay(); if(stage_time>=1600&&e26_1.eflag==true)e26_1.edisplay(); if(stage_time>=2000&&e24_2.eflag==true)e24_2.edisplay(); if(stage_time>=2200&&e25_2.eflag==true)e25_2.edisplay(); if(stage_time>=2600&&e26_2.eflag==true)e26_2.edisplay(); if(stage_time>=3600&&e24_2.eflag==false&& E25_2.Eflag==false&&E26_2.Eflag==false)stage_status=2; 55
120 if(stage_status==2){ B4.Bdisplay(); if(stage==5){ if(stage_status==1){ for(int n=0;n<e27.length;n++){ if(stage_time>=60+60*n&&e27[n].eflag==true)e27[n].edisplay(); if(stage_time>=90+60*n&&e28[n].eflag==true)e28[n].edisplay(); for(int n=0;n<e29.length;n++){ if(stage_time>=670+80*n&&e29[n].eflag==true)e29[n].edisplay(); if(stage_time>=710+80*n&&e30[n].eflag==true)e30[n].edisplay(); if(stage_time>=670&&e31.eflag==true)e31.edisplay(); for(int n=0;n<e32.length;n++){ if(stage_time>= *n&&e32[n].eflag==true)e32[n].edisplay(); if(stage_time>= *n&&e33[n].eflag==true)e33[n].edisplay(); if(stage_time>=1800&&e31.eflag==false)stage_status=2; if(stage_status==2){ B5.Bdisplay(); if(stage==6){ if(stage_status==1){ if(stage_time>=60&&e34.eflag==true)e34.edisplay(); if(stage_time>=300&&e35.eflag==true)e35.edisplay(); if(stage_time>=600&&e36.eflag==true)e36.edisplay(); if(stage_time>=900&&e37.eflag==true)e37.edisplay(); if(stage_time>=1200&&e38.eflag==true)e38.edisplay(); 56
121 if(stage_time>=1800&&e39.eflag==true&& E38.Eflag==false&&E37.Eflag==false)E39.Edisplay(); if(e39.eflag==false)stage_status=2; if(stage_status==2){ B6.Bdisplay(); stage_time++; Zdisplay();// void Marker(){ // //(, outdisplay ) if(stage_status==2){ if(stage==1)b1.enemy_marker(); if(stage==2)b2.enemy_marker(); if(stage==3)b3.enemy_marker(); if(stage==4)b4.enemy_marker(); if(stage==5)b5.enemy_marker(); if(stage==6)b6.enemy_marker(); 5.5 Tama set1 class Tama_set1{ float[] Tx;// X float[] Ty;// Y float[] Tspeed;// float[] Tangle;// 57
122 int n;// boolean[] out;// boolean flag;// int time;// Tama_set1(){ Tx=new float[5000]; Ty=new float[5000]; Tspeed=new float[5000]; Tangle=new float[5000]; out=new boolean[5000]; n=0; flag=true; time=1; 5.6 Tama set2 class Tama_set2{ float[][] Tx;// X float[][] Ty;// Y float[] Tspeed;// float[][] Tangle;// int n;// boolean[][] out;// boolean flag;// int time;// Tama_set2(){ Tx=new float[2000][100]; Ty=new float[2000][100]; Tspeed=new float[2000]; Tangle=new float[2000][100]; 58
123 out=new boolean[2000][100]; n=0; flag=true; time=1; 5.7 Tama type class Tama_type{ int shape;// 1=, 2= float xsize;// X float ysize;// Y float r;// Tama_type(int s,float x,float y,float r0){ shape=s; xsize=x; ysize=y; r=r0; void display(float x,float y){ if(shape==1){ ellipsemode(center); ellipse(x,y,xsize,ysize); else if(shape==2){ rectmode(center); rect(x,y,xsize,ysize); Tama_type Tama1=new Tama_type(1,10,10,7); 59
124 Tama_type Tama2=new Tama_type(2,15,15,10); Tama_type Tama3=new Tama_type(1,20,20,10); Tama_type Tama4=new Tama_type(1,50,50,20); Tama_type Tama5=new Tama_type(1,25,20,15); Tama_type Tama6=new Tama_type(1,12,14,10); Tama_type Tama7=new Tama_type(1,7,7,7); Tama_type Tama8=new Tama_type(1,35,35,20); Tama_type Tama9=new Tama_type(1,15,15,9); Tama_type Tama10=new Tama_type(1,50,50,20); Tama_type Tama11=new Tama_type(1,80,80,20); Tama_type Tama12=new Tama_type(1,250,250,80); Tama_type Tama13=new Tama_type(1,120,120,45); 5.8 color color black = #000000; color gray = #808080; color silver = #c0c0c0; color white = #ffffff; color maroon = #800000; color red = #ff0000; color olive = #808000; color yellow = #ffff00; color green = #008000; color lime = #00ff00; color teal = #008080; color aqua = #00ffff; color navy = #000080; color blue = #0000ff; color purple = #800080; color fuchsia = #ff00ff; 60
125 5.9 Boss1 class Boss1 extends Boss{ Tama_set1[] T1=new Tama_set1[10]; Tama_set1 T2; Tama_set2 T3; Tama_set2 T4; Boss1(){ super(centerx,playzoneys+50,4600,-1,0,250,10,blue); for(int n=0;n<t1.length;n++){ T1[n]=new Tama_set1(); T2=new Tama_set1(); T3=new Tama_set2(); T4=new Tama_set2(); time=-12; void Bshoot(){ if(bstatus==1){ for(int n=0;n<t1.length;n++){ if(time>=n*7)shoot(bx,by,17,n*2*pi/15-pi/6,n*2*pi/15,4,4,t1[n], Tama1,aqua); zikishoot(bx,by,4,120,t2,tama4,navy); if(bhp<=0)breset(4000,0.75,-2); if(bstatus==2){ if(time>=20)n_way(bx,by,4,40,16,z_angle(bx,by),pi/8,t3,tama5,red); N_way(Bx,By,2,40,16,z_angle(Bx,By),PI/8,T4,Tama5,purple); if(bhp<=0) 61
126 Bcrush(); 5.10 Boss2 class Boss2 extends Boss{ Tama_set1 T1; Tama_set2 T2; Tama_set1 T3; Tama_set2 T4; Tama_set2 T5; Tama_set2 T6; Tama_set2 T7; Boss2(){ super(centerx,playzoneys+50,4000,1,0,250,15,silver); T1=new Tama_set1(); T2=new Tama_set2(); T3=new Tama_set1(); T4=new Tama_set2(); T5=new Tama_set2(); T6=new Tama_set2(); T7=new Tama_set2(); void Bshoot(){ if(bstatus==1){ N_way(Bx,By,4,12,11,z_angle(Bx,By),PI/6,T2,Tama3,aqua); Shoot(Bx,By,4,0,2*PI,5,8,T1,Tama1,red); if(bhp<=0)breset(3800,1.1,-0.3); 62
127 if(bstatus==2){ N_way(Bx,By,3,10,7,PI*frameCount/8,PI/18,T4,Tama1,green); N_way(Bx,By,2,53,4,z_angle(Bx,By),PI/6,T5,Tama4,red); if(bhp<=0)breset2(4000,60,30,200); if(bstatus==3){ N_way(Bx,By,2,34,12,z_angle(Bx,By),PI/6,T6,Tama7,maroon); if(time>=17)n_way(bx,by,2,34,12,z_angle(bx,by)+pi/12,pi/6,t7,tama7,blue); if(bhp<=0)bcrush(); 5.11 Boss3 class Boss3 extends Boss{ Tama_set2 T1; Tama_set2 T2; Tama_set1 T3[]=new Tama_set1[20]; Tama_set2 T4; Tama_set1 T5[]=new Tama_set1[2]; int B3n; Boss3(){ super(centerx+70,playzoneys+50,7500,50,50,100,250,20,yellow); T1=new Tama_set2(); T2=new Tama_set2(); for(int n=0;n<t3.length;n++){ T3[n]=new Tama_set1(); T4=new Tama_set2(); T5[0]=new Tama_set1(); T5[1]=new Tama_set1(); 63
128 B3n=0; void Bshoot(){ if(bstatus==1){ if(time>=50)n_way(bx,by,2,100,60,z_angle(bx,by),pi/30,t1,tama1,green); if(time>=80)n_way(bx,by,2,100,61,z_angle(bx,by),2*pi/61,t2,tama1,lime); if(bhp<=0)breset(7000,(centerx-bx)/30,(by-playzoneys-60)/30); //30, 30 if(bstatus==2){ for(int n=0;n<t3.length;n++){ if(time>=n)shoot(bx,by,90,z_angle(bx,by)-pi/12,z_angle(bx,by)+pi/12, 6,7,T3[n],Tama9,purple); N_way(Bx,By,2.5,31,4,time,PI/2,T4,Tama4,black); if(time==30){ //30 0 BspeedX=0; BspeedY=0; if(bhp<=0)breset2(7500,40,60,130); if(bstatus==3){ Shoot(Bx,By,3,0,2*PI,3,5,T5[0],Tama3,navy); Shoot(Bx,By,3,0,2*PI,3,5,T5[1],Tama3,fuchsia); if(time%500==300){ B3n++; // 0 for(int n=0;n<b3n*(500/3);n++){ T5[0].Tspeed[n]=0; T5[1].Tspeed[n]=0; 64
129 if(time%500==100){ for(int n=0;n<b3n*(500/3);n++){ // 0 1 T5[0].Tspeed[n]=1; T5[1].Tspeed[n]=1; if(bhp<=0)bcrush(); 5.12 Boss4 class Boss4 extends Boss{ Tama_set1 T1; Tama_set1 T2; Tama_set1 T3[]=new Tama_set1[8]; Tama_set1 T4; Tama_set2 T5[]=new Tama_set2[5]; float x1,x2; float ang; float angp; Boss4(){ super(centerx+150,playzoneys+50,10000,0,0,250,25,red); T1=new Tama_set1(); T2=new Tama_set1(); for(int n=0;n<t3.length;n++){ T3[n]=new Tama_set1(); T4=new Tama_set1(); for(int n=0;n<t5.length;n++){ 65
130 T5[n]=new Tama_set2(); ang=pi/2; angp=radians(1); void Bshoot(){ if(bstatus==1){ // x x1=random(playzonexe-200,playzonexe+200); Shoot(x1,x1-playZoneXe+playZoneYs,10,radians(125),radians(150), 4,7,T1,Tama10,black); if(bhp<=bhp0/2){ // x x2=random(playzonexs-200,playzonexs+200); Shoot(x2,-x2-playZoneXs+playZoneYs,14,radians(30),radians(55), 4,7,T2,Tama10,black); if(bhp<=0)breset2(8500,60,30,60); if(bstatus==2){ ang=ang+pi/8; for(int n=0;n<t3.length;n++){ Shoot(Bx,By,5,ang+n*PI/4,ang+n*PI/4,3,3,T3[n],Tama3,green); ang=ang+angp-pi/8;//angp, ang if(ang>=9*pi/16 ang<=7*pi/16)angp=-angp; zikishoot(bx,by,2,90,t4,tama11,lime); if(bhp<=0)breset(30000,(centerx-bx)/40,(by-playzoneys-60)/40); //40, 40 if(bstatus==3){ N_way(Bx,By,2,40,8,z_angle(Bx,By),PI/4,T5[0],Tama3,aqua); if(bhp<=7*bhp0/8) 66
131 N_way(playZoneXs,playZoneYs,2,70,5,z_angle(playZoneXs,playZoneYs), PI/5,T5[1],Tama3,navy); if(bhp<=6*bhp0/8) N_way(playZoneXe,playZoneYs,2,70,5,z_angle(playZoneXe,playZoneYs), PI/5,T5[2],Tama3,blue); if(bhp<=5*bhp0/8) N_way(playZoneXs,playZoneYe,2,70,5,z_angle(playZoneXs,playZoneYe), PI/5,T5[3],Tama3, purple); if(bhp<=4*bhp0/8) N_way(playZoneXe,playZoneYe,2,70,5,z_angle(playZoneXe,playZoneYe), PI/5,T5[4],Tama3,fuchsia); if(time==40){ //40 0 BspeedX=0;BspeedY=0; if(bhp<=0)bcrush(); 5.13 Boss5 class Boss5 extends Boss{ Tama_set2 T1; Tama_set2 T2; Tama_set2 T3; Tama_set1 T4; Tama_set2[] T5=new Tama_set2[2];; Tama_set1[][] T6=new Tama_set1[5][2]; Tama_set1 T7; Tama_set1 T8; Tama_set2 T9; 67
132 int n1=0; int span1=60; int Mtime1=50; int time1=0; boolean Mswitch=false;//Bstatus3. true=, false= Boss5(){ super(centerx,playzoneys+50,10000,60,30,50,250,30,black); T1=new Tama_set2(); T2=new Tama_set2(); T3=new Tama_set2(); T4=new Tama_set1(); for(int n=0;n<t5.length;n++){ T5[n]=new Tama_set2(); for(int n=0;n<5;n++){ for(int m=0;m<2;m++){ T6[n][m]=new Tama_set1(); T6[n][m].time=0; T7=new Tama_set1(); T7.time=0; T8=new Tama_set1(); T9=new Tama_set2(); void Bshoot(){ if(bstatus==1){ N_way(Bx,By,3,90,5,z_angle(Bx,By)-PI/8,PI/2.5,T1,Tama13,purple); if(time>=15)n_way(bx,by,3,90,5,z_angle(bx,by),pi/2.5,t2,tama13,purple); if(time>=30)n_way(bx,by,3,90,5,z_angle(bx,by)+pi/8,pi/2.5, T3,Tama13,purple); Shoot(Bx,By,2,0,2*PI,1,2,T4,Tama7,red); if(bhp<=0)breset(10000,(centerx-bx)/40,(by-playzoneys-100)/40); 68
133 //40, 40 if(bstatus==2){ N_way(Bx,By-100,3,120,5,z_angle(Bx,By),PI/2.5,T5[0],Tama12,blue); N_way(Bx,By-100,3,120,5,z_angle(Bx,By),PI/2.5,T5[1],Tama10,fuchsia); if(time>=180){ for(int n=0;n<5;n++){ // Shoot(T5[0].Tx[n1][n+1],T5[0].Ty[n1][n+1],120,z_angle(Bx,By)-PI/6, z_angle(bx,by)+pi/3,4,6,t6[n][0],tama10,red); Shoot(T5[0].Tx[n1][n+1],T5[0].Ty[n1][n+1],120,z_angle(Bx,By)-PI/3, z_angle(bx,by)+pi/6,4,6,t6[n][1],tama10,red);; if(n==4&&time%120==0)n1++; if(time==40){ //40 0 BspeedX=0; BspeedY=0; if(bhp<=0){ Breset(8000,0,0); BmaxY=playZoneYe; if(bstatus==3){ Shoot(Bx,By, ,0,0,0,0,T7,Tama12,green); N_way(Bx,By,2,90,7,z_angle(Bx,By),PI/3.5,T9,Tama1,red); if(!mswitch&&time1==span1){ //Mtime1 BspeedX=(X-Bx)/Mtime1; BspeedY=(By-Y)/Mtime1; Mswitch=!Mswitch; 69
134 time1=0;//time1 if(mswitch&&time1==mtime1){ // BspeedX=0;BspeedY=0; Mswitch=!Mswitch; // T8.Tx[T8.n]=Bx; T8.Ty[T8.n]=By; T8.out[T8.n]=true; T8.n++; time1=0;//time1 if(mtime1>=30){ // span1--; Mtime1--; // T7 T7.Tx[0]=Bx; T7.Ty[0]=By; if(life_flag==true)check1(t8,tama10); for(int k=0;k<t8.n;k++){ fill(lime); Tama10.display(T8.Tx[k],T8.Ty[k]); time1++; if(bhp<=0){ Bcrush(); 70
135 5.14 Boss6 class Boss6 extends Boss{ Tama_set2 T1; Tama_set2 T2; Tama_set2 T3; Tama_set2 T4; Tama_set2 T5; Tama_set2 T6; Tama_set2 T7; Tama_set2 T8; Tama_set2 T9; Tama_set2 T10; Tama_set2 T11; Tama_set2 T12; Tama_set1 T13; Tama_set1 T14; Tama_set1 T15; Tama_set1 T16; Tama_set2 T17; Tama_set2 T18; Tama_set1 T19; Tama_set2 T20; Tama_set1 T21; Tama_set1 T22[]=new Tama_set1[11]; Tama_set2 T23; Tama_set2 T24; Tama_set1 T25; float angle=pi; int rank=1; Boss6(){ super(centerx+70,playzoneys+50,27000,50,50,100,250,40,white); 71
136 T1=new Tama_set2(); T2=new Tama_set2(); T3=new Tama_set2(); T4=new Tama_set2(); T5=new Tama_set2(); T6=new Tama_set2(); T7=new Tama_set2(); T8=new Tama_set2(); T9=new Tama_set2(); T10=new Tama_set2(); T11=new Tama_set2(); T12=new Tama_set2(); T13=new Tama_set1(); T14=new Tama_set1(); T15=new Tama_set1(); T16=new Tama_set1(); T17=new Tama_set2(); T18=new Tama_set2(); T19=new Tama_set1(); T20=new Tama_set2(); T21=new Tama_set1(); for(int n=0;n<t22.length;n++){ T22[n]=new Tama_set1(); T23=new Tama_set2(); T24=new Tama_set2(); T25=new Tama_set1(); void Bshoot(){ if(bstatus==1){ if(rank==1&&bhp<=2*bhp0/3){ // 2/3 rank=2; 72
137 time=0; if(rank==2&&bhp<=bhp0/3){ // 1/3 rank=3; time=0; if(rank==1){ N_way(Bx,By,5.5,120,37,z_angle(Bx,By),2*PI/37,T1,Tama1,blue); if(time>=45)n_way(bx+30,by,4,120,28,z_angle(bx,by),pi/14,t2,tama3,red); if(time>=60)n_way(bx-30,by,4,120,28,z_angle(bx,by),pi/14,t3,tama3,red); if(rank==2){ N_way(Bx,By,5.5,120,35,z_angle(Bx,By),2*PI/35,T4,Tama1,blue); if(time>=45)n_way(bx,by+30,4,120,26,z_angle(bx,by),pi/13,t5,tama3,red); if(time>=60)n_way(bx+30,by,4,120,26,z_angle(bx,by),pi/13,t6,tama3,red); if(time>=75)n_way(bx-30,by,4,120,26,z_angle(bx,by),pi/13,t7,tama3,red); if(rank==3){ N_way(Bx,By,5.5,120,31,z_angle(Bx,By),2*PI/31,T8,Tama1,blue); if(time>=45)n_way(bx,by+30,4,120,24,z_angle(bx,by),pi/12,t9,tama3,red); if(time>=60)n_way(bx+30,by,4,120,24,z_angle(bx,by),pi/12,t10,tama3,red); if(time>=75)n_way(bx-30,by,4,120,24,z_angle(bx,by),pi/12,t11,tama3,red); if(time>=90)n_way(bx,by-30,4,120,24,z_angle(bx,by),pi/12,t12,tama3,red); if(bhp<=0)breset(30000,(centerx-bx)/30,(by-playzoneys-90)/30); //30, 30 if(bstatus==2){ Shoot(random(playZoneXs,playZoneXe),playZoneYe+20,12,-PI/2,-PI/2, 0.5,0.8,T13,Tama3,navy);// zikishoot(playzonexs,playzoneys+100,4,200,t14,tama10,lime); if(time>=100)zikishoot(playzonexe,playzoneys+100,4,200,t15,tama10,lime); 73
138 if(bhp<=bhp0/2)shoot(random(playzonexs,playzonexe),playzoneys-20,12, PI/2,PI/2,0.5,0.8,T16,Tama3,blue); // N_way(Bx,By,4.5,100,20,z_angle(Bx,By),PI/10,T17,Tama9,red); if(time==30){ //30 0 BspeedX=0; BspeedY=0; if(bhp<=0)breset2(30000,60,30,20); if(bstatus==3){ N_way(Bx,By,5,60,20,z_angle(Bx,By),PI/10,T18,Tama9,green); if(bhp<=7*bhp0/8)shoot(bx,by,6,angle,angle,1,3,t19,tama5,blue); if(bhp<=6*bhp0/8)n_way(bx,by,2,160,9,z_angle(bx,by),pi/4.5,t20, Tama10,red); if(bhp<=5*bhp0/8)shoot(bx,by,6,-angle,-angle,1,3,t21,tama5,lime); angle=angle+pi/50; if(bhp<=4*bhp0/8){ for(int n=0;n<t22.length;n++){ if(time>=n)shoot(bx,by,140,z_angle(bx,by)-pi/8,z_angle(bx,by)+pi/8, 2.5,4.5,T22[n],Tama1,purple); if(bhp<=3*bhp0/8)n_way(bx,by,7,90,4,z_angle(bx,by),pi/2,t23,tama13,yellow); if(bhp<=2*bhp0/8)n_way(bx,by,10,100,18,z_angle(bx,by),pi/9,t24,tama2,black); stroke(0); strokeweight(2); if(bhp<=bhp0/8)shoot(bx,by,1,0,2*pi,2,6,t25,tama3,gray); strokeweight(1); nostroke(); if(bhp<=0){ 74
139 Bcrush(); 5.15 Stage1 Enemy class Enemy1 extends Enemy{ Tama_set2 T; Enemy1(){ super(400,playzoneys,1,pi/2,120,100,10); T=new Tama_set2(); void Eshoot(){ N_way(Ex,Ey,2,121,3,z_angle(Ex,Ey),PI/4,T,Tama1,lime); void Eshape(){ fill(blue); ellipse(ex,ey,esize,esize); class Enemy2 extends Enemy{ Tama_set2 T; Enemy2(){ super(380,playzoneys,1,1.7*pi/2,120,100,10); T=new Tama_set2(); void Eshoot(){ N_way(Ex,Ey,5,90,4,z_angle(Ex,Ey),PI/6,T,Tama1,green); 75
140 void Eshape(){ fill(blue); ellipse(ex,ey,esize,esize); class Enemy3 extends Enemy{ Tama_set2 T; Enemy3(){ super(420,playzoneys,1,0.3*pi/2,120,100,10); T=new Tama_set2(); void Eshoot(){ N_way(Ex,Ey,3,90,4,z_angle(Ex,Ey),PI/6,T,Tama1,green); void Eshape(){ fill(blue); ellipse(ex,ey,esize,esize); class Enemy4 extends Enemy{ Tama_set2 T; Enemy4(){ super(playzonexs,playzoneys+50,180,playzonexs+100,playzoneys+50,600,500,15); T=new Tama_set2(); void Eshoot(){ N_way(Ex,Ey,5,36,8,z_angle(Ex,Ey),PI/4,T,Tama2,red); void Eshape(){ fill(white); ellipse(ex,ey,esize,esize); 76
141 class Enemy5 extends Enemy{ Tama_set2 T; Enemy5(){ super(playzonexe,playzoneys+50,180,playzonexe-50,playzoneys+50,600,500,15); T=new Tama_set2(); void Eshoot(){ N_way(Ex,Ey,5,20,12,z_angle(Ex,Ey),PI/6,T,Tama2,yellow); void Eshape(){ fill(white); ellipse(ex,ey,esize,esize); class Enemy6 extends Enemy{ Tama_set1 T; int a=3; Enemy6(){ super(playzonexe,playzoneys+60,2,radians(165),50,200,20); T=new Tama_set1(); void Eshoot(){ a++; Shoot(Ex,Ey,23,a%12*PI/6,a%12*PI/6,6,6,T,Tama3,black); void Eshape(){ fill(olive); ellipse(ex,ey,esize,esize); 77
142 class Enemy7 extends Enemy{ Tama_set1 T; Enemy7(){ super(playzonexs,playzoneys+60,2,radians(15),50,200,20); T=new Tama_set1(); time=6; void Eshoot(){ Shoot(Ex,Ey,23,time%12*PI/12,time%12*PI/12,6,6,T,Tama3,black); void Eshape(){ fill(olive); ellipse(ex,ey,esize,esize); class Enemy8 extends Enemy{ Tama_set2 T1; Tama_set2 T2; Enemy8(){ super(playzonexs,playzoneys,50,playzonexs+100,playzoneys+80,600,500,15); T1=new Tama_set2(); T2=new Tama_set2(); void Eshoot(){ if(time>=40)n_way(ex,ey,5,80,8,z_angle(ex,ey),pi/4,t1,tama5,aqua); N_way(Ex,Ey,5,80,9,z_angle(Ex,Ey),PI/4.5,T2,Tama5,blue); void Eshape(){ fill(black); rect(ex,ey,esize,esize); 78
143 class Enemy9 extends Enemy{ Tama_set2 T1; Tama_set2 T2; Enemy9(){ super(playzonexe,playzoneys,50,playzonexe-100,playzoneys+80,600,500,15); T1=new Tama_set2(); T2=new Tama_set2(); void Eshoot(){ if(time>=40)n_way(ex,ey,5,80,8,z_angle(ex,ey),pi/4,t2,tama5,blue); N_way(Ex,Ey,5,80,9,z_angle(Ex,Ey),PI/4.5,T1,Tama5,aqua); void Eshape(){ fill(black); rect(ex,ey,esize,esize); 5.16 Stage2 Enemy class Enemy10 extends Enemy{ Tama_set2 T; float Ex1; float Ey1; float a; Enemy10(){ super(playzonexe-200,playzoneys,3,pi/2.5,320,125,12); T=new Tama_set2(); a=2*pi/120; void Eshoot(){ N_way(Ex,Ey,(int)random(2,3),85,2,random(z_angle(Ex,Ey)-PI/9, 79
144 z_angle(ex,ey)+pi/9),pi/4,t,tama3,fuchsia); void Eshape(){ fill(red); ellipse(ex,ey,esize,esize); void Emove(){ if(time==90){ Ex1=Ex-120; Ey1=Ey-120; if(time>=90){ //Ex1,Ey1 Ex=(Ex-Ex1)*cos(a)-(Ey-Ey1)*sin(a)+Ex1; Ey=(Ex-Ex1)*sin(a)+(Ey-Ey1)*cos(a)+Ey1; else{ Ex=Ex+Espeed*cos(Eangle); Ey=Ey+Espeed*sin(Eangle); class Enemy11 extends Enemy{ Tama_set2 T; float Ex1; float Ey1; float a; Enemy11(){ super(playzonexs+20,playzoneys,3,pi/5,320,125,12); T=new Tama_set2(); a=2*pi/120; 80
145 void Eshoot(){ N_way(Ex,Ey,(int)random(2,3),100,2,random(z_angle(Ex,Ey)-PI/9, z_angle(ex,ey)+pi/9),pi/4,t,tama3,purple); void Eshape(){ fill(blue); ellipse(ex,ey,esize,esize); void Emove(){ if(time==95){ Ex1=Ex; Ey1=Ey+120; if(time>=95){ Ex=(Ex-Ex1)*cos(a)-(Ey-Ey1)*sin(a)+Ex1; Ey=(Ex-Ex1)*sin(a)+(Ey-Ey1)*cos(a)+Ey1; else{ Ex=Ex+Espeed*cos(Eangle); Ey=Ey+Espeed*sin(Eangle); class Enemy12 extends Enemy{ Tama_set1 T1; Tama_set1 T2; Tama_set1 T3; float angle=pi/3; Enemy12(){ super(centerx+25,playzoneys,60,centerx+25,playzoneys+120,6000,4980,30); T1=new Tama_set1(); T2=new Tama_set1(); T3=new Tama_set1(); 81
146 void Eshoot(){ Shoot(Ex,Ey,3,angle,angle,3,3,T1,Tama6,green); angle=angle+2*pi/3; Shoot(Ex,Ey,3,angle,angle,3,3,T2,Tama6,green); angle=angle+2*pi/3; Shoot(Ex,Ey,3,angle,angle,3,3,T3,Tama6,green); angle=angle+2*pi/3+pi/80; void Eshape(){ fill(black); ellipse(ex,ey,esize,esize); class Enemy13 extends Enemy{ Tama_set1 T1; Tama_set1 T2; Tama_set1 T3; float angle=0; Enemy13(){ super(playzonexs+55,playzoneys,60,playzonexs+55,playzoneys+120,6000,2980,30); T1=new Tama_set1(); T2=new Tama_set1(); T3=new Tama_set1(); void Eshoot(){ Shoot(Ex,Ey,3,angle,angle,2,2,T1,Tama6,red); angle=angle+2*pi/3; Shoot(Ex,Ey,3,angle,angle,2,2,T2,Tama6,blue); angle=angle+2*pi/3; Shoot(Ex,Ey,3,angle,angle,2,2,T3,Tama6,green); angle=angle+2*pi/3+pi/80; 82
147 void Eshape(){ fill(black); ellipse(ex,ey,esize,esize); class Enemy14 extends Enemy{ Tama_set1 T1; Tama_set1 T2; Tama_set1 T3; float angle=pi; Enemy14(){ super(playzonexe-55,playzoneys,60,playzonexe-55,playzoneys+120,6000,2980,30); T1=new Tama_set1(); T2=new Tama_set1(); T3=new Tama_set1(); void Eshoot(){ Shoot(Ex,Ey,3,angle,angle,2,2,T1,Tama6,blue); angle=angle+2*pi/3; Shoot(Ex,Ey,3,angle,angle,2,2,T2,Tama6,green); angle=angle+2*pi/3; Shoot(Ex,Ey,3,angle,angle,2,2,T3,Tama6,red); angle=angle+2*pi/3+pi/80; void Eshape(){ fill(black); ellipse(ex,ey,esize,esize); class Enemy15 extends Enemy{ Tama_set1 T1; Tama_set1 T2; 83
148 Tama_set1 T3; Enemy15(){ super(playzonexs,playzoneys+50,1,0,320,200,18); T1=new Tama_set1(); T2=new Tama_set1(); T3=new Tama_set1(); void Eshoot(){ zikishoot(ex,ey,4,80,t1,tama1,aqua); Shoot(Ex,Ey,35,z_angle(Ex,Ey)-PI/4,z_angle(Ex,Ey),2,2,T2,Tama1,aqua); Shoot(Ex,Ey,35,z_angle(Ex,Ey),z_angle(Ex,Ey)+PI/4,2,2,T3,Tama1,aqua); void Eshape(){ fill(teal); ellipse(ex,ey,esize,esize); class Enemy16 extends Enemy{ Tama_set1 T1; Tama_set1 T2; Tama_set1 T3; Enemy16(){ super(playzonexe,playzoneys+60,1,pi,320,200,18); T1=new Tama_set1(); T2=new Tama_set1(); T3=new Tama_set1(); void Eshoot(){ zikishoot(ex,ey,4,80,t1,tama1,aqua); Shoot(Ex,Ey,35,z_angle(Ex,Ey)-PI/4,z_angle(Ex,Ey),2,2,T2,Tama1,aqua); Shoot(Ex,Ey,35,z_angle(Ex,Ey),z_angle(Ex,Ey)+PI/4,2,2,T3,Tama1,aqua); void Eshape(){ 84
149 fill(teal); ellipse(ex,ey,esize,esize); 5.17 Stage3 Enemy class Enemy17 extends Enemy{ Tama_set1 T1; Tama_set1 T2; Tama_set1 T3; Enemy17(){ super(playzonexe-60,playzoneys,2,pi/2,120,150,15); T1=new Tama_set1(); T2=new Tama_set1(); T3=new Tama_set1(); void Eshoot(){ Shoot(Ex,Ey,70,z_angle(Ex,Ey)-PI/4,z_angle(Ex,Ey),3,3,T1,Tama7,red); Shoot(Ex,Ey,70,z_angle(Ex,Ey)-PI/8,z_angle(Ex,Ey)+PI/8,3,3,T2,Tama7,red); Shoot(Ex,Ey,70,z_angle(Ex,Ey),z_angle(Ex,Ey)+PI/4,3,3,T3,Tama7,red); if(time==60)eangle=3*pi/4; if(time==120)eangle=pi; void Eshape(){ fill(black); ellipse(ex,ey,esize,esize); class Enemy18 extends Enemy{ Tama_set1 T1; Tama_set1 T2; 85
150 Tama_set1 T3; Enemy18(){ super(playzonexs+60,playzoneys,2,pi/2,190,200,15); T1=new Tama_set1(); T2=new Tama_set1(); T3=new Tama_set1(); void Eshoot(){ Shoot(Ex,Ey,70,z_angle(Ex,Ey)-PI/4,z_angle(Ex,Ey),3,3,T1,Tama7,blue); Shoot(Ex,Ey,70,z_angle(Ex,Ey)-PI/8,z_angle(Ex,Ey)+PI/8,3,3,T2,Tama7,blue); Shoot(Ex,Ey,70,z_angle(Ex,Ey),z_angle(Ex,Ey)+PI/4,3,3,T3,Tama7,blue); if(time==60)eangle=pi/4; if(time==120)eangle=0; void Eshape(){ fill(black); ellipse(ex,ey,esize,esize); class Enemy19 extends Enemy{ Tama_set2 T1; int outtime;// Enemy19(){ super(random(playzonexs,playzonexe),playzoneys,2,pi/2,100,100,15); T1=new Tama_set2(); outtime=(int)random(80,130); void Eshoot(){ N_way(Ex,Ey,3.2,70,5,z_angle(Ex,Ey),PI/10,T1,Tama1,maroon); if(time==outtime)eangle=-eangle; void Eshape(){ fill(yellow); 86
151 ellipse(ex,ey,esize,esize); class Enemy20 extends Enemy{ Tama_set2 T1; Tama_set2 T2; Enemy20(){ super(centerx,playzoneys,140,random(playzonexs+100,playzonexe-100), random(playzoneys+150,playzoneys+300),4000,2800,40); T1=new Tama_set2(); T2=new Tama_set2(); void Eshoot(){ N_way(Ex,Ey,1,60,8,z_angle(Ex,Ey),PI/4,T1,Tama8,blue); if(time>=20)n_way(ex,ey,2,60,7,z_angle(ex,ey),pi/3.5,t2,tama8,aqua); void Eshape(){ fill(white); ellipse(ex,ey,esize,esize); 5.18 Stage4 Enemy class Enemy21 extends Enemy{ Tama_set1 T1; Tama_set1 T2; Tama_set1 T3; Enemy21(){ super(random(playzonexe-120,playzonexe),playzoneys,3,2*pi/3,160,120,15); T1=new Tama_set1(); T2=new Tama_set1(); 87
152 T3=new Tama_set1(); void Eshoot(){ Shoot(Ex,Ey,80,z_angle(Ex,Ey)-PI/5,z_angle(Ex,Ey),3,4,T1,Tama1,blue); Shoot(Ex,Ey,80,z_angle(Ex,Ey)-PI/10,z_angle(Ex,Ey)+PI/10,3,4,T2,Tama1,red); Shoot(Ex,Ey,80,z_angle(Ex,Ey),z_angle(Ex,Ey)+PI/5,3,4,T3,Tama1,yellow); if(time>=80&&time<260)eangle=eangle+pi/120;// void Eshape(){ fill(green); ellipse(ex,ey,esize,esize); class Enemy22 extends Enemy{ Tama_set1 T1; Tama_set1 T2; Tama_set1 T3; Enemy22(){ super(random(playzonexs,playzonexs+120),playzoneys,3,pi/3,160,120,15); T1=new Tama_set1(); T2=new Tama_set1(); T3=new Tama_set1(); void Eshoot(){ Shoot(Ex,Ey,80,z_angle(Ex,Ey)-PI/5,z_angle(Ex,Ey),3,4,T1,Tama1,yellow); Shoot(Ex,Ey,80,z_angle(Ex,Ey)-PI/10,z_angle(Ex,Ey)+PI/10,3,4,T2,Tama1,red); Shoot(Ex,Ey,80,z_angle(Ex,Ey),z_angle(Ex,Ey)+PI/5,3,4,T3,Tama1,blue); if(time>=80&&time<260)eangle=eangle-pi/120; void Eshape(){ fill(green); ellipse(ex,ey,esize,esize); 88
153 class Enemy23 extends Enemy{ Tama_set1[] T1=new Tama_set1[5]; Enemy23(){ super(random(playzonexs,playzonexe),playzoneys,130,random(playzonexs, playzonexe),random(playzoneys,playzoneys+200),800,200,25); for(int n=0;n<t1.length;n++){ T1[n]=new Tama_set1(); void Eshoot(){ Shoot(Ex,Ey,111,z_angle(Ex,Ey),z_angle(Ex,Ey),5,5,T1[0],Tama3,green); if(time>=2){ Shoot(Ex+15,Ey,111,z_angle(Ex,Ey),z_angle(Ex,Ey),5,5,T1[1],Tama3,lime); Shoot(Ex-15,Ey,111,z_angle(Ex,Ey),z_angle(Ex,Ey),5,5,T1[2],Tama3,lime); if(time>=4){ Shoot(Ex+30,Ey,111,z_angle(Ex,Ey),z_angle(Ex,Ey),5,5,T1[3],Tama3,teal); Shoot(Ex-30,Ey,111,z_angle(Ex,Ey),z_angle(Ex,Ey),5,5,T1[4],Tama3,teal); void Eshape(){ fill(red); ellipse(ex,ey,esize,esize); class Enemy24 extends Enemy{ Tama_set1 T1; Enemy24(){ super(centerx,playzoneys,130,centerx,playzoneys+150,6000,2800,40); T1=new Tama_set1(); void Eshoot(){ 89
154 stroke(0); Shoot(Ex,Ey,1,time*PI/40,time*PI/40,2,2,T1,Tama7,silver); nostroke(); void Eshape(){ fill(blue); ellipse(ex,ey,esize,esize); class Enemy25 extends Enemy{ Tama_set1 T1; Enemy25(){ super(centerx+250,playzoneys,130,centerx+250,playzoneys+150,7000,3000,40); T1=new Tama_set1(); void Eshoot(){ stroke(0); Shoot(Ex,Ey,1,time*PI/40,time*PI/40,2,2,T1,Tama7,silver); nostroke(); void Eshape(){ fill(blue); ellipse(ex,ey,esize,esize); class Enemy26 extends Enemy{ Tama_set1 T1; Enemy26(){ super(centerx-250,playzoneys,130,centerx-250,playzoneys+150,8000,4000,40); T1=new Tama_set1(); void Eshoot(){ stroke(0); 90
155 Shoot(Ex,Ey,1,time*PI/30,time*PI/30,2,2,T1,Tama7,silver); nostroke(); void Eshape(){ fill(blue); ellipse(ex,ey,esize,esize); 5.19 Stage5 Enemy class Enemy27 extends Enemy{ Tama_set1 T1; Enemy27(){ super(playzonexs,playzoneys+70,1,0,520,300,30); T1=new Tama_set1(); void Eshoot(){ Shoot(Ex,Ey,35,z_angle(Ex,Ey)-PI/4,z_angle(Ex,Ey)+PI/4,2,4,T1,Tama11,aqua); void Eshape(){ fill(red); ellipse(ex,ey,esize,esize); class Enemy28 extends Enemy{ Tama_set1 T1; Enemy28(){ super(playzonexe,playzoneys+100,1,pi,520,300,30); T1=new Tama_set1(); void Eshoot(){ 91
156 Shoot(Ex,Ey,35,z_angle(Ex,Ey)-PI/4,z_angle(Ex,Ey)+PI/4,2,4,T1,Tama11,aqua); void Eshape(){ fill(red); ellipse(ex,ey,esize,esize); class Enemy29 extends Enemy{ Tama_set1 T1; Enemy29(){ super(playzonexs,random(playzoneys+10,playzoneys+100),1,random(0,pi/6), 420,300,30); T1=new Tama_set1(); void Eshoot(){ Shoot(Ex,Ey,55,z_angle(Ex,Ey)-PI/4,z_angle(Ex,Ey)+PI/4,2,4,T1,Tama11,purple); void Eshape(){ fill(maroon); ellipse(ex,ey,esize,esize); class Enemy30 extends Enemy{ Tama_set1 T1; Enemy30(){ super(playzonexe,random(playzoneys+10,playzoneys+100),1,random(5*pi/6,pi), 420,300,30); T1=new Tama_set1(); void Eshoot(){ Shoot(Ex,Ey,55,z_angle(Ex,Ey)-PI/4,z_angle(Ex,Ey)+PI/4,2,4,T1,Tama11,purple); 92
157 void Eshape(){ fill(maroon); ellipse(ex,ey,esize,esize); class Enemy31 extends Enemy{ Tama_set2 T1; int n1; Enemy31(){ super(centerx,playzoneys,60,random(centerx-50,centerx+50),playzoneys+120, 5000,9800,35); T1=new Tama_set2(); n1=0; void Eshoot(){ N_way(Ex,Ey,7,51,40,time*PI/60,PI/20,T1,Tama1,green); if((time-51)%51==30){ T1.Tspeed[n1]=3; n1++; void Eshape(){ fill(black); ellipse(ex,ey,esize,esize); class Enemy32 extends Enemy{ Tama_set1 T1; Enemy32(){ super(playzonexs+5,playzoneye,4,-pi/2,2000,19800,25); T1=new Tama_set1(); void Eshoot(){ 93
158 if(time>=60)zikishoot(ex,ey,6,12,t1,tama1,red); void Eshape(){ fill(fuchsia); ellipse(ex,ey,esize,esize); class Enemy33 extends Enemy{ Tama_set1 T1; Enemy33(){ super(playzonexe-5,playzoneye,4,-pi/2,2000,19800,25); T1=new Tama_set1(); void Eshoot(){ if(time>=60)zikishoot(ex,ey,6,12,t1,tama1,red); void Eshape(){ fill(fuchsia); ellipse(ex,ey,esize,esize); 5.20 Stage6 Enemy class Enemy34 extends Enemy{//Boss1 Tama_set2 T1; Tama_set2 T2; Enemy34(){ super(playzonexs,playzoneys,1,pi/8,4000,1000,30); T1=new Tama_set2(); T2=new Tama_set2(); 94
159 void Eshoot(){ if(time>=20)n_way(ex,ey,4,50,14,z_angle(ex,ey),pi/7,t1,tama5,red); N_way(Ex,Ey,2,50,14,z_angle(Ex,Ey),PI/7,T2,Tama5,purple); void Eshape(){ fill(blue); ellipse(ex,ey,esize,esize); class Enemy35 extends Enemy{//Boss2 Tama_set2 T1; Tama_set2 T2; Enemy35(){ super(playzonexe,playzoneys,1,7*pi/8,4500,2000,30); T1=new Tama_set2(); T2=new Tama_set2(); void Eshoot(){ N_way(Ex,Ey,3,18,6,PI*frameCount/8,PI/20,T1,Tama1,green); N_way(Ex,Ey,2,70,4,z_angle(Ex,Ey),PI/6,T2,Tama4,red); void Eshape(){ fill(silver); ellipse(ex,ey,esize,esize); class Enemy36 extends Enemy{//Boss3 Tama_set1[] T1=new Tama_set1[15]; Tama_set2 T2; Enemy36(){ super(playzonexs+50,playzoneys,0.9,pi/9,5000,3000,30); for(int n=0;n<t1.length;n++){ T1[n]=new Tama_set1(); 95
160 T2=new Tama_set2(); void Eshoot(){ for(int n=0;n<t1.length;n++){ if(time>=n)shoot(ex,ey,120,z_angle(ex,ey)-pi/12,z_angle(ex,ey)+pi/12, 4,5,T1[n],Tama9,purple); N_way(Ex,Ey,2,60,4,time,PI/2,T2,Tama4,black); void Eshape(){ fill(yellow); ellipse(ex,ey,esize,esize); class Enemy37 extends Enemy{//Boss4 Tama_set1 T1; float x1; Enemy37(){ super(playzonexe,playzoneys,60,playzonexe-80,playzoneys+80,5500,4000,30); T1=new Tama_set1(); void Eshoot(){ x1=random(playzonexe-200,playzonexe+200); Shoot(x1,x1-playZoneXe+playZoneYs,15,radians(125),radians(150), 5,7,T1,Tama10,olive); void Eshape(){ fill(red); ellipse(ex,ey,esize,esize); class Enemy38 extends Enemy{//Boss5 96
161 Tama_set2[] T1=new Tama_set2[2]; Tama_set1[] T2=new Tama_set1[7]; int n1=0; Enemy38(){ super(playzonexs,playzoneys+30,0.5,pi/12,6000,5000,30); for(int n=0;n<t1.length;n++){ T1[n]=new Tama_set2(); for(int n=0;n<t2.length;n++){ T2[n]=new Tama_set1(); T2[n].time=0; void Eshoot(){ N_way(Ex,Ey,3,120,7,z_angle(Ex,Ey),PI/3.5,T1[0],Tama13,blue); N_way(Ex,Ey,3,120,7,z_angle(Ex,Ey),PI/3.5,T1[1],Tama8,fuchsia); if(time>=180){ for(int n=0;n<7;n++){ Shoot(T1[0].Tx[n1][n+1],T1[0].Ty[n1][n+1],120,z_angle(Ex,Ey)-PI/6, z_angle(ex,ey)+pi/6,4,6,t2[n],tama8,red); if(n==4&&time%120==0)n1++; void Eshape(){ fill(black); ellipse(ex,ey,esize,esize); class Enemy39 extends Enemy{//Boss1 5 Tama_set2 T1; Tama_set2 T2; Tama_set1[] T3=new Tama_set1[15]; 97
162 Tama_set1[] T4=new Tama_set1[4]; Tama_set2[] T5_1=new Tama_set2[2]; Tama_set1[] T5_2=new Tama_set1[2]; float x1; int n1=0; int n2=-1; Enemy39(){ super(centerx,playzoneys,60,centerx,playzoneys+80,13000,6000,35); T1=new Tama_set2(); T2=new Tama_set2(); for(int n=0;n<t3.length;n++){ T3[n]=new Tama_set1(); for(int n=0;n<t4.length;n++){ T4[n]=new Tama_set1(); for(int n=0;n<t5_1.length;n++){ T5_1[n]=new Tama_set2(); for(int n=0;n<t5_2.length;n++){ T5_2[n]=new Tama_set1(); T5_2[n].time=0; void Eshoot(){ N_way(Ex,Ey,2,150,19,z_angle(Ex,Ey),PI/9.5,T1,Tama5,red); if(time>=30)n_way(ex,ey,4,150,8,pi*framecount/8,pi/20,t2,tama1,green); if(time>=60){ for(int n=0;n<t3.length;n++){ if(time>=n+60)shoot(ex,ey,150,z_angle(ex,ey)-pi/12, z_angle(ex,ey)+pi/12,4,5,t3[n],tama9,purple); 98
163 if(time>=90){ for(int n=0;n<t4.length;n++){ Shoot(random(playZoneXe-200,playZoneXe+200),random(playZoneXe-200, playzonexe+200)-playzonexe+playzoneys,150,radians(125), radians(150),5,7,t4[n],tama10,olive); if(time>=120){ N_way(Ex,Ey,3,150,2,z_angle(Ex,Ey),PI/3.5,T5_1[0],Tama13,blue); N_way(Ex,Ey,3,150,2,z_angle(Ex,Ey),PI/3.5,T5_1[1],Tama8,fuchsia); if(time>=300){ for(int n=0;n<t5_2.length;n++){ Shoot(T5_1[0].Tx[n1][n+1],T5_1[0].Ty[n1][n+1],150,z_angle(Ex,Ey)-PI/6, z_angle(ex,ey)+pi/6,4,6,t5_2[n],tama8,yellow); if(n==1&&time%150==0)n1++; if(time%150==0)n2++; void Eshape(){ // if(time-150*n2>=120)fill(black); else if(time-150*n2>=90)fill(red); else if(time-150*n2>=60)fill(yellow); else if(time-150*n2>=30)fill(silver); else if(time-150*n2>=0)fill(blue); ellipse(ex,ey,esize,esize); 99
164 HP Z600 Workstaion Memory 4GB CPU Xeon 2.67GHz OS: VineLinux 6.1 Processing ver.2.21 [1] D.shiffman,LEARNING PROCESSING 2nd ed.,elsevier(2015) [2] Wikipedia[ ], %B9%E3%82%A6%E3%82%A9%E3%83%BC!,(2016) [3] Wikipedia[ ], %E3%82%A3%E3%83%B3%E3%82%B0%E3%82%B2%E3%83%BC%E3%83%A0,(2016) [4] Wikipedia[ ], %E3%83%A5%E3%83%BC%E3%83%86%E3%82%A3%E3%83%B3%E3%82%B0,(2016) [5], dnh.html,(2012) [6] Java, (2006) [7] Wikipedia[ ], %E3%82%B3%E3%83%AC%E3%82%AF%E3%82%B7%E3%83%A7%E3%83%B3,(2017) 100
165 Processing Othello Othello Othello Othello Processing , Board Koma Mass
166 1 Othello 1.1 Othello, ,, 8 8 ([2] ). 1.2, n m (n, m), (4, 4) (5, 5), (4, 5) (5, 4). 2
167 ..,,.,,.., ([3] ). 2 Othello 2.1 Processing Processing,.,,,,., 3
168 ., Java C++.,. 2.2, Processing.,. Processing draw., draw. void draw(){ myboard.skip(); myboard.gameend(); myboard Board, myboard. Board. Board skip,. mousepressed., mousepressed. void mousepressed(){ if(myboard.mymass[myboard.checky()][myboard.checkx()].status==2){ if(button){ myboard.mymass[myboard.checky()][myboard.checkx()].status=0; button=!button; else{ myboard.mymass[myboard.checky()][myboard.checkx()].status=1; button=!button; if(myboard.hantei()==8){ 4
169 myboard.mymass[myboard.checky()][myboard.checkx()].status=2; button=!button; else{ myboard.komareverse(); else{ if(myboard.mymass[myboard.checky()][myboard.checkx()].status==0){ myboard.mymass[myboard.checky()][myboard.checkx()].status=0; if(myboard.mymass[myboard.checky()][myboard.checkx()].status==1){ myboard.mymass[myboard.checky()][myboard.checkx()].status=1; if(myboard.mymass[myboard.chacky()][myboard.chackx()].status==3){ /*, */ myboard.mymass[myboard.checky()][myboard.checkx()].status=3; myboard.show();// mousepressed, boolean button, Board hantei komareverse.. mymass[][] Mass., mymass[1][2], (2,1).myBoard.checkX(), myboard.checky(). 5
170 2.3 draw mousepressed Board Mass, Koma Koma, show setcolor setradius. void show(){ stroke(0); fill(c); ellipsemode(senter); ellipse(x,y,r,r); void setcolor(color c1){ c=c1; void setradius(float r1){ r=r1; Mass Mass,,,. (status=0), (status=1), (stats=2) show.status. void show(){ if(status==0){ stroke(0); fill(70,145,80); 6
171 rectmode(corner); rect(x,y,w,w); mykoma.setcolor(0); mykoma.show(); else if(status==1){ stroke(0); fill(70,145,80); rectmode(corner); rect(x,y,w,w); mykoma.setcolor(255); mykoma.show(); else if(status==2){ stroke(0); fill(70,145,80); rectmode(corner); rect(x,y,w,w); status=3, 1,. else if(status==3){ nostroke(); fill(70,145,80); rectmode(corner); rect(x,y,w,w); Board komareverse Board Board,, 7
172 ,. class Board{// PFont p=createfont("ume-ui-gothic",16);// Mass[][] mymass=new Mass[10][10];// int k,l,a,b,c,d,e,f,g,h,x,y,z,o,yk; /*k: x l: y a: b: c: d: e: f: g: h: */ Board,.. Board(){// for(int i=0;i<10;i++){ for(int j=0;j<10;j++){ mymass[i][j]=new Mass(k,l,25);/* */ k=k+25; l=l+25; k=0; // 8
173 mymass[4][4].status=1;// mymass[4][5].status=0;// mymass[5][5].status=1;// mymass[5][4].status=0;// for(int i=0;i<10;i++){ mymass[0][i].status=3;/*status=3 komareverse */ for(int i=0;i<10;i++){/* status=3) */ mymass[i][0].status=3; for(int i=1;i<10;i++){ mymass[9][i].status=3; for(int i=1;i<10;i++){ mymass[i][9].status=3; for(int i=1;i<9;i++){ mymass[8][i].status=2; for(int i=1;i<9;i++){ mymass[i][8].status=2;.. for. Mass(k,l,25) k x, l 9
174 y, 25. y l 0, x k 25. k 0, l 25. status=3(komareverse ). int checkx(){// return int(mousex/25); int checky(){// return int(mousey/25); checkx checky. x, y 25 ( ), int.. int komareversetime(int rl,int ud){// for(int k=1;k<=7;k++){ if(k==1){/* */ if(( myboard.mymass[myboard.chacky()][myboard.chackx()].getstatus() ==myboard.mymass[myboard.chacky()+ud*k][myboard.chackx()+rl*k].getstatus()) (myboard.mymass[myboard.chacky()+ud*k][myboard.chackx()+rl*k].getstatus()==2) myboard.mymass[myboard.chacky()+ud*k][myboard.chackx()+rl*k].status==3){ break; else if(// 10
175 myboard.mymass[myboard.chacky()+ud*k][myboard.chackx()+rl*k].status==2 myboard.mymass[myboard.chacky()+ud*k][myboard.chackx()+rl*k].status==3){ break; else if(// myboard.mymass[myboard.chacky()][myboard.chackx()].getstatus() ==myboard.mymass[myboard.chacky()+ud*k][myboard.chackx()+rl*k].getstatus()){ return k-1; return 0; komareverse , 7,, status=3 status=3. int hantei(){// x=0; if(komareversetime(1,0)==0){/* x 1 */ x++; if(komareversetime(-1,0)==0){/* x 1 */ x++; if(komareversetime(0,1)==0){/* 11
176 x 1 */ x++; if(komareversetime(0,-1)==0){/* x 1 */ x++; if(komareversetime(1,1)==0){/* x 1 */ x++; if(komareversetime(-1,1)==0){/* x 1 */ x++; if(komareversetime(1,-1)==0){/* x 1 */ x++; if(komareversetime(-1,-1)==0){/* x 1 */ x++; return x; hantei., 1, x 1, x 8 8,. skip, 12
177 , hantei. 3, 3.1 Prosessing.Koma,Board ( ),.,,..,.,.,, ,,.,,.. 4, 2016 VR(virtual reality) 3.,,,,.,,,, 13
178 ., Processing, draw(), Board myboard;// boolean button;// void setup(){ size(250,250);// myboard=new Board();// myboard.show();// button=true;//button k=0; void draw(){ myboard.skip();// void mousepressed(){ //// if(myboard.mymass[myboard.checky()][myboard.checkx()].status==2){ if(button){ myboard.mymass[myboard.checky()][myboard.checkx()].status=0; button=!button; else{ myboard.mymass[myboard.checky()][myboard.checkx()].status=1; 14
179 button=!button; if(myboard.hantei()==8){ myboard.mymass[myboard.checky()][myboard.checkx()].status=2; button=!button; else{ myboard.komareverse(); // else{ if(myboard.mymass[myboard.checky()][myboard.checkx()].status==0){ myboard.mymass[myboard.checky()][myboard.checkx()].status=0; if(myboard.mymass[myboard.checky()][myboard.checkx()].status==1){ myboard.mymass[myboard.checky()][myboard.checkx()].status=1; if(myboard.mymass[myboard.checky()][myboard.checkx()].status==3){ myboard.mymass[myboard.checky()][myboard.checkx()].status=3; myboard.show();// 5.2 Board class Board{// Mass[][] mymass=new Mass[10][10];// 15
180 int k,l,a,b,c,d,e,f,g,h,x,y,z,o,yk; Board(){// k=0; l=0; x=0; // for(int i=0;i<10;i++){ for(int j=0;j<10;j++){ mymass[i][j]=new Mass(k,l,25); k=k+25; l=l+25; k=0; // mymass[4][4].status=1; mymass[4][5].status=0; mymass[5][5].status=1; mymass[5][4].status=0; for(int i=0;i<10;i++){ mymass[0][i].status=3; for(int i=0;i<10;i++){ mymass[i][0].status=3; for(int i=1;i<10;i++){ mymass[9][i].status=3; for(int i=1;i<10;i++){ mymass[i][9].status=3; 16
181 void show(){// for(int i=0;i<10;i++){ for(int j=0;j<10;j++){ mymass[i][j].show(); int checkx(){// return int(mousex/25); int checky(){// return int(mousey/25); int komareversetime(int rl,int ud){// for(int k=1;k<=7;k++){ if(k==1){ if(( myboard.mymass[myboard.checky()][myboard.checkx()].getstatus() ==myboard.mymass[myboard.checky()+ud*k][myboard.checkx()+rl*k].getstatus()) (myboard.mymass[myboard.checky()+ud*k][myboard.checkx()+rl*k].getstatus()==2) myboard.mymass[myboard.checky()+ud*k][myboard.checkx()+rl*k].status==3){ break; else if(myboard.mymass[myboard.checky()+ud*k][myboard.checkx()+rl*k].status==2 myboard.mymass[myboard.checky()+ud*k][myboard.checkx()+rl*k].status==3){ break; else if(myboard.mymass[myboard.checky()][myboard.checkx()].getstatus() 17
182 ==myboard.mymass[myboard.checky()+ud*k][myboard.checkx()+rl*k].getstatus()){ return k-1; return 0; void komareverse(){// a=komareversetime(1,0);// b=komareversetime(-1,0);// c=komareversetime(0,1);// d=komareversetime(0,-1);// e=komareversetime(1,1);// f=komareversetime(-1,1);// g=komareversetime(1,-1);// h=komareversetime(-1,-1);// for(int n=1;n<=a;n++){ myboard.mymass[myboard.checky()][myboard.checkx()+n].status= myboard.mymass[myboard.checky()][myboard.checkx()].status; for(int n=1;n<=b;n++){ myboard.mymass[myboard.checky()][myboard.checkx()-n].status= myboard.mymass[myboard.checky()][myboard.checkx()].status; for(int n=1;n<=c;n++){ myboard.mymass[myboard.checky()+n][myboard.checkx()].status= myboard.mymass[myboard.checky()][myboard.checkx()].status; for(int n=1;n<=d;n++){ myboard.mymass[myboard.chacky()-n][myboard.chackx()].status= myboard.mymass[myboard.chacky()][myboard.chackx()].status; for(int n=1;n<=e;n++){ 18
183 myboard.mymass[myboard.checky()+n][myboard.checkx()+n].status= myboard.mymass[myboard.checky()][myboard.checkx()].status; for(int n=1;n<=f;n++){ myboard.mymass[myboard.checky()+n][myboard.checkx()-n].status= myboard.mymass[myboard.checky()][myboard.checkx()].status; for(int n=1;n<=g;n++){ myboard.mymass[myboard.checky()-n][myboard.checkx()+n].status= myboard.mymass[myboard.checky()][myboard.checkx()].status; for(int n=1;n<=h;n++){ myboard.mymass[myboard.checky()-n][myboard.checkx()-n].status= myboard.mymass[myboard.checky()][myboard.checkx()].status; int hantei(){// x=0; if(komareversetime(1,0)==0){ x++; if(komareversetime(-1,0)==0){ x++; if(komareversetime(0,1)==0){ x++; if(komareversetime(0,-1)==0){ x++; if(komareversetime(1,1)==0){ x++; 19
184 if(komareversetime(-1,1)==0){ x++; if(komareversetime(1,-1)==0){ x++; if(komareversetime(-1,-1)==0){ x++; return x; int finalcheck(int rl,int ud){// // x=0; for(int i=0;i<10;i++){ for(int j=0;j<10;j++){ if(mymass[i][j].status==2){ if(button){ mymass[i][j].status=0; else{ mymass[i][j].status=1; for(int k=1;k<=7;k++){ if(k==1){ if(( myboard.mymass[i][j].status== myboard.mymass[i+ud*k][j+rl*k].status) (myboard.mymass[i+ud*k][j+rl*k].getstatus()==2) myboard.mymass[i+ud*k][j+rl*k].status==3){ x++; 20
185 break; else if(myboard.mymass[i+ud*k][j+rl*k].status==2 myboard.mymass[i+ud*k][j+rl*k].status==3){ x++; break; else if(myboard.mymass[i][j].getstatus()== myboard.mymass[i+ud*k][j+rl*k].getstatus()){ mymass[i][j].status=2; return 0; mymass[i][j].status=2; return x; int finaltime(){ yk=0; yk=finalcheck(1,0)+finalcheck(0,1)+finalcheck(1,1)+finalcheck(-1,0)+ finalcheck(0,-1)+finalcheck(1,-1)+finalcheck(-1,1)+finalcheck(-1,-1); return yk; int status2time(){// y=0; 21
186 for(int i=0;i<10;i++){ for(int j=0;j<10;j++){ if(mymass[i][j].status==2){ y++; return y; void skip(){// if(finaltime()==8*status2time()){ button=!button; 5.3 Koma class Koma{// float x,y,r;//x: x, y: y, r: color c;// Koma(int x0, int y0){// x=x0; y=y0; void show(){// stroke(0); fill(c); ellipsemode(center); 22
187 ellipse(x,y,r,r); void setcolor(color c1){// c=c1; void setradius( float r1 ) {// r=r1; 5.4 Mass class Mass{// Koma mykoma;// int x,y,w,status;/*x: x,y: y w:,status; */ Mass( int x1,int y1,int w1){/* status, x, y,, x, y,, */ status=2; x=x1; y=y1; w=w1; mykoma=new Koma(x+w/2,y+w/2); mykoma.setradius(w*4/5); mykoma.setcolor(0); 23
188 int getstatus(){//status return status; void show(){// if(status==0){ stroke(0); fill(70,145,80); rectmode(corner); rect(x,y,w,w); mykoma.setcolor(0); mykoma.show(); else if(status==1){ stroke(0); fill(70,145,80); rectmode(corner); rect(x,y,w,w); mykoma.setcolor(255); mykoma.show(); else if(status==2){ stroke(0); fill(70,145,80); rectmode(corner); rect(x,y,w,w); else if(status==3){ nostroke(); fill(70,145,80); rectmode(corner); rect(x,y,w,w); 24
189 . HP Z600 Workstation Memory 4GB CPU Xeon 2.67GHz OS VineLinux 6.1 Processing ver2.2.1 [1] D.Shiffman,LEARNING PROCESSING (2nd ed.),elsevier(2015) [2],,,(2011) [3] 1( ), (2017) 25
課題
size(300,120); void drawrect(float x,float y,float w,float h,color c){ rectmode(corner); stroke( (a) ); fill( (b) ); rect( (c), (d), (e), (f) ); float x = map(hour(), (g), (h), (i), (j) ); drawrect(0,0,x,height/3,color(
line(x1, y1, x2, y2); (x1, y1) rect(x, y, width, height); (x, y) (x1, y1) (x2, y2) height width (x2, y2) ellipse(x, y, width, height); rectmode(corners); rect(x1, y1, x2, y2); (x,y) width height strokeweight(4);
課題
int starttime_msec; boolean counting = false; size(400,200); smooth(); //font は各自のものに変更してください font = loadfont("serif-48.vlw"); void mouseclicked(){ counting = true; starttime_msec = millis(); int t=0;
課題
float xball;// 円の中心の X 座標 float yball; // 円の中心の Y 座標 float rball; // 円の半径 color cball; // 円の色 // 円を移動させる void updateball(){ yball -= 1; if(yball+rball< 0){ yball = height+rball; // 円を描く void drawball(){
スライド 1
グラフィックスの世界第 3 回 サイバーメディアセンター サイバーコミュニティ研究部門安福健祐 Processing によるアニメーション setup と draw void setup() size(400, 400); void draw() ellipse( mousex,mousey,100,100); void とか setup とか draw とかはじめて見る が出てきてややこしい ellipseは円描く関数でした
2009 T
T060061 Wii Visual C++ 2008 Express Edition Visual C++ 2008 Express Edition ++ ++ Paint.net ++ 1 2009 T060061 2 1 4 2 4 2.1 Visual C++ 2008 Express Edition.......................... 4 2.2.....................................
課題
float[] xball; float[] yball; int numberofballs = (a) ; int radius=10; size(400,400); xball = (b) (c) [numberofballs]; yball = (d) (e) [numberofballs]; xball[i] = random(radius,width-radius); yball[i]
<4D F736F F D B B83578B6594BB2D834A836F815B82D082C88C60202E646F63>
デザイン言語 Processing 入門 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます. http://www.morikita.co.jp/books/mid/084931 このサンプルページの内容は, 初版 1 刷発行当時のものです. Processing Ben Fry Casey Reas Windows Mac Linux Lesson 1 Processing
Processingをはじめよう
Processing をはじめよう 第 5 章 反応 目次 繰り返されるdrawと一度だけのsetup 追いかける クリック カーソルの位置 キーボードからの入力 マッピング Robot 3: Response 繰り返される draw と一度だけの setup Example 5-1 draw() 関数 println("i'm drawing"); println(framecount); draw()
課題
2018 6 22 2. float[] y = new float[5]; void setup() { size(400, 200); for (int i=0;i< (a) ;i++) { y[i] = random(0.3*width, width); void draw() { y[ (b) ] = mousex; int minpos = findminpos( (c) ); for (int
プログラミング演習 Ⅰ 第 14 回 2017/6/5( 月 ) ゲームを作る クイズ 担当 : 紅林林
プログラミング演習 Ⅰ 第 14 回 2017/6/5( 月 ) ゲームを作る クイズ 担当 : 紅林林 クイズゲーム概要 o 画 面に問題 文と選択肢 3 つを表 示 o 1, 2, 3 のキーで答える o 正解の場合は 不不正解の場合は を重ねて表 示 o 1 つの問題が終わったら次の問題へ移動 o 最後に正解した数を表 示 解答後の画 面 ( 正解の場合 ) 解答前の画 面 解答後の画 面 (
r3.dvi
00 3 2000.6.10 0 Java ( 7 1 7 1 GSSM 1? 1 1.1 4 4a 4b / / 0 255 HTML X 0 255 16 (0,32,255 #0020FF Java xclock -bg #0020FF xclock ^C (Control C xclock 4c 1 import java.applet.applet; import java.awt.*;
Processingをはじめよう
Processing をはじめよう 第 7 章 動きその 2 目次 フレームレート スピードと方向 移動 回転 拡大 縮小 2 点間の移動 乱数 タイマー 円運動 今回はここまで 2 2 点間の移動 Example 7-6 (EX_08_06) 始点 (startx, starty) から終点 (stopx, stopy) まで移動する 座標更新の計算方法は後述 始点と終点を変更しても動作する 変更して確認
情報システム設計論II ユーザインタフェース(1)
プログラミング演習 (5) 条件分岐 (2) 中村, 高橋 小林, 橋本 1 目標 Processing で当たり判定に挑戦! 条件分岐を理解する 何らかの条件を満たした時に色を変える! マウスカーソルと動いている円がぶつかったら終了 シューティングゲームやもぐらたたきに挑戦! 課題 : Processing でゲームを作ろう! 占いを作ってみよう フローチャートと条件分岐 プログラムの流れ 年齢確認
19 3!! (+) (>) (++) (+=) for while 3.1!! (20, 20) (1)(Blocks1.java) import javax.swing.japplet; import java.awt.graphics;
19 3!!...... (+) (>) (++) (+=) for while 3.1!! 3.1.1 50 20 20 5 (20, 20) 3.1.1 (1)(Blocks1.java) public class Blocks1 extends JApplet { public void paint(graphics g){ 5 g.drawrect( 20, 20, 50, 20); g.drawrect(
課題
colormode(hsb,359,99,99); background(0,0,99); s = 99; x = mousex; y = mousey; nostroke(); while(s >= 0 && (0
JavaScript の使い方
JavaScript Release10.5 JavaScript NXJ JavaScript JavaScript JavaScript 2 JavaScript JavaScript JavaScript NXJ JavaScript 1: JavaScript 2: JavaScript 3: JavaScript 4: 1 1: JavaScript JavaScript NXJ Static
2 1 Web Java Android Java 1.2 6) Java Java 7) 6) Java Java (Swing, JavaFX) (JDBC) 7) OS 1.3 Java Java
1 Java Java 1.1 Java 1) 2) 3) Java OS Java 1.3 4) Java Web Start Web / 5) Java C C++ Java JSP(Java Server Pages) 1) OS 2) 3) 4) Java Write Once, Run Anywhere 5) Java Web Java 2 1 Web Java Android Java
KeyListener init addkeylistener addactionlistener addkeylistener addkeylistener( this ); this.addkeylistener( this ); KeyListener public void keytyped
KeyListener keypressed(keyevent e) keyreleased(keyevent e) keytyped(keyevent e) MouseListener mouseclicked(mouseevent e) mousepressed(mouseevent e) mousereleased(mouseevent e) mouseentered(mouseevent e)
Chapter JDK KeyListener keypressed(keyevent e ) keyreleased(keyevent e ) keytyped(keyevent e ) MouseListener mouseclicked(mouseeven
Chapter 11. 11.1. JDK1.1 11.2. KeyListener keypressed(keyevent e ) keyreleased(keyevent e ) keytyped(keyevent e ) MouseListener mouseclicked(mouseevent e ) mousepressed(mouseevent e ) mousereleased(mouseevent
Java Java Java Java Java 4 p * *** ***** *** * Unix p a,b,c,d 100,200,250,500 a*b = a*b+c = a*b+c*d = (a+b)*(c+d) = 225
Java Java Java Java Java 4 p35 4-2 * *** ***** *** * Unix p36 4-3 a,b,c,d 100,200,250,500 a*b = 20000 a*b+c = 20250 a*b+c*d = 145000 (a+b)*(c+d) = 225000 a+b*c+d = 50600 b/a+d/c = 4 p38 4-4 (1) mul = 1
CG
Grahics with Processig 2016-05 複雑な図形の描画 htt://vilab.org 塩澤秀和 1 2006-2016 H. SHIOZAWA htt://vilab.org 5.1 頂点列による図形描画 複雑な図形描画 begishae( 図形 ) 頂点列モードの開始 図形が空欄なら頂点を線で結ぶ ( 折れ線か多角形になる ) その他, 下記図形を指定できる POINTS,
untitled
Ajax Web Ajax http://www.openspc2.org/javascript/ajax/ajax_stu dy/index.html Life is beautiful Ajax http://satoshi.blogs.com/life/2005/06/ajax.html Ajax Ajax Asynchronous JavaScript + XML JavaScript XML
Java演習(4) -- 変数と型 --
50 20 20 5 (20, 20) O 50 100 150 200 250 300 350 x (reserved 50 100 y 50 20 20 5 (20, 20) (1)(Blocks1.java) import javax.swing.japplet; import java.awt.graphics; (reserved public class Blocks1 extends
paper.pdf
Cop: Web 1,a) 1,b) GUI, UI,,., GUI, Java Swing., Web HTML CSS,. CSS,, CSS,.,, HTML CSS Cop. Cop, JavaScript,,. Cop, Web,. Web, HTML, CSS, JavaScript, 1., GUI, Web., HTML CSS (UI), JavaScript, Web GUI.
もう少し数学っぽい関数もあります 関数名 abs(x) sqrt(x) sq(x) pow(x,n) exp(x) log(x) dist(x1, y1, x2, y2) constrain(v, m0, m1) lerp(v0,v1,t) map(v, low1, high1, low2, hig
情報メディア基盤ユニット用資料 (2012 年 6 月 12 日分 ) Processing 言語による情報メディア入門 組み込み関数 関数 ( その 2) 2012 年 6 月 12 日修正 神奈川工科大学情報メディア学科 までにも いくつか使ってきましたが Processing では沢山の今関数が用意されています その中でよく使いそうなものを以下に挙げておきます ここで紹介する関数は 呼び出すと何らかの値
SVG資料第10回目(その2) Ajaxによる同期通信と非同期通信の違い
10 ( SVG 10 ( Ajax Ajax I(SVG) 2017/6/27 10 ( Ajax 10 ( Ajax 100 10 HTML 1 2 3 4 5 6
Java学習教材
Java 2016/4/17 Java 1 Java1 : 280 : (2010/1/29) ISBN-10: 4798120987 ISBN-13: 978-4798120980 2010/1/29 1 Java 1 Java Java Java class FirstExample { public static void main(string[] args) { System.out.println("
JavaScript 1.! DOM Ajax Shelley Powers,, JavaScript David Flanagan, JavaScript 2
JavaScript (2) 1 JavaScript 1.! 1. 2. 3. DOM 4. 2. 3. Ajax Shelley Powers,, JavaScript David Flanagan, JavaScript 2 (1) var a; a = 8; a = 3 + 4; a = 8 3; a = 8 * 2; a = 8 / 2; a = 8 % 3; 1 a++; ++a; (++
ch31.dvi
1 1 1.1 1.1.1 ( ) ( 1.1 ): [ ] [ ] CPU[ + ] [ ] CPU( ) ( 1 2 1 1.1: ( 1.1 ): ( ) [ ] ( )[ ] + ( ) (+ ) ( ) ( ) 1.1. 3 1.2: ( ) ( ) ( 1.2) 4 1 1.3: 120m/ (432km/h) 0.5 2m/ 1 ( 1 ) ( ) ( ) ( 1.3) 1.1. 5
Processing入門マニュアル17
20. 連続したベジェ曲線を描く beginshape(); beziervertex(x座標, y座標); endshape(); ベジェ曲線を連続して描くためにはbezierVertex命令をbeginShapeとendShape命令の間に記述します ( C1x, C1y ) ( V1x, V1y ) ( V2x, V2y ) ( C2x, C2y ) ( C3x, C3y ) ( C6x, C6y
アルゴリズムとデータ構造1
1 2005 7 22 22 (sakai.keiichi@kochi [email protected]) http://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/2005/index.html tech.ac.jp/k1sakai/lecture/alg/2005/index.html f(0) = 1, f(x) =
やさしいJavaプログラミング -Great Ideas for Java Programming サンプルPDF
pref : 2004/6/5 (11:8) pref : 2004/6/5 (11:8) pref : 2004/6/5 (11:8) 3 5 14 18 21 23 23 24 28 29 29 31 32 34 35 35 36 38 40 44 44 45 46 49 49 50 pref : 2004/6/5 (11:8) 50 51 52 54 55 56 57 58 59 60 61
( )$("canvas").drawarc({strokestyle:"red", x:100, y:100, radius:20, start:0, end:360); drawline(x1:, y1:,... xn:, yn:) drawline n 2 n 3 x1: y1: xn: yn
0.1. jquaery jcanvas jquery John Resig OSS JavaScript Web JavaScript jquery jquery 1 0.2. jcanvas jcanvas 0.3. jcanvas HTML5 Canvas Canvas jcanvas jcanvas jquery Canvas API jcanvas Grouping Layer jcanvas
07_経営論集2010 小松先生.indd
19 1 2009 105 123 Web Web Web Web World Wide Web WWW OS 1990 WWW Web HTML CSS JavaScript Web 1 WWW 2 Web Web 3 Web 4 HTML5 5 Web Web 3 1970 WWW HTML Web WWW WWW WWW WWW WWW 105 Web WWW 2 Web 1 1 NTT NTT
解きながら学ぶJava入門編
44 // class Negative { System.out.print(""); int n = stdin.nextint(); if (n < 0) System.out.println(""); -10 Ÿ 35 Ÿ 0 n if statement if ( ) if i f ( ) if n < 0 < true false true false boolean literalboolean
EQUIUM EQUIUM S5010 1
EQUIUM EQUIUM S5010 1 1 1 2 3 4 2 1 2 3 2 3 1 2 3 4 5 6 7 4 1 2 5 1 2 6 1 7 1 2 3 4 5 6 7 1 2 3 4 5 6 3 7 8 9 1 2 3 4 4 5 6 7 8 1 1 2 3 4 10 1 11 12 1 13 14 1 15 16 1 1 2 3 17 1 2 3 18 4 5 6 1 19 1 2 3
class IntCell { private int value ; int getvalue() {return value; private IntCell next; IntCell next() {return next; IntCell(int value) {this.value =
Part2-1-3 Java (*) (*).class Java public static final 1 class IntCell { private int value ; int getvalue() {return value; private IntCell next; IntCell next() {return next; IntCell(int value) {this.value
2016 IP 1 1 1 1.1............................................. 1 1.2.............................................. 1 1.3............................................. 1 1.4.............................................
class IntCell { private int value ; int getvalue() {return value; private IntCell next; IntCell next() {return next; IntCell(int value) {this.value =
Part2-1-3 Java (*) (*).class Java public static final 1 class IntCell { private int value ; int getvalue() {return value; private IntCell next; IntCell next() {return next; IntCell(int value) {this.value
Java updated
Java 2003.07.14 updated 3 1 Java 5 1.1 Java................................. 5 1.2 Java..................................... 5 1.3 Java................................ 6 1.3.1 Java.......................
5 1 2 3 4 5 6 7 8 9 10 1 Quick Boot 1st Boot Device 2nd Boot Device 3rd Boot Device Network Boot Initial Display Mode S.M.A.R.T. for Hard Disks BootUp Num-Lock Password Check CPU Serial Number System BIOS
SGML HTML XML Markup Language Web HTML HTML SGML Standard Generalized Markup Language Markup Language DTD Document Type Definition XML SGML Markup Language HTML XML HTML XML JavaScript JAVA CGI HTML Web
# let st1 = {name = "Taro Yamada"; id = };; val st1 : student = {name="taro Yamada"; id=123456} { 1 = 1 ;...; n = n } # let string_of_student {n
II 6 / : 2001 11 21 (OCaml ) 1 (field) name id type # type student = {name : string; id : int};; type student = { name : string; id : int; } student {} type = { 1 : 1 ;...; n : n } { 1 = 1 ;...; n = n
「Android Studioではじめる 簡単Androidアプリ開発」正誤表
Android Studio Android 2016/04/19 Android Studio Android *1 Android Studio Android Studio Android Studio Android Studio Android PDF : Android Studio Android Android Studio Android *2 c R TM *1 Android
ORCA (Online Research Control system Architecture)
ORCA (Online Research Control system Architecture) ORCA Editor Ver.1.2 1 9 10 ORCA EDITOR 10 10 10 Java 10 11 ORCA Editor Setup 11 ORCA Editor 12 15 15 ORCA EDITOR 16 16 16 16 17 17 ORCA EDITOR 18 ORCA
untitled
JavaScript HP JavaScript JavaScript Web JavaScript Web JavaScript JavaScript JavaScript HTML HTML HTML JavaScript 1. JavaScript ON/OFF 2. JavaScript 3. 4. 5. 6. 7. 8. 9. 10. if 11. if 12. switch 13. 14.
新・明解Java入門
537,... 224,... 224,... 32, 35,... 188, 216, 312 -... 38 -... 38 --... 102 --... 103 -=... 111 -classpath... 379 '... 106, 474!... 57, 97!=... 56 "... 14, 476 %... 38 %=... 111 &... 240, 247 &&... 66,
K227 Java 2
1 K227 Java 2 3 4 5 6 Java 7 class Sample1 { public static void main (String args[]) { System.out.println( Java! ); } } 8 > javac Sample1.java 9 10 > java Sample1 Java 11 12 13 http://java.sun.com/j2se/1.5.0/ja/download.html
I 4 p.2 4 GUI java.awt.event.* import /* 1 */ import mouseclicked MouseListener implement /* 2 */ init addmouselistener(this) this /* 3 */ this mousec
I 4 p.1 4 GUI GUI GUI 4.1 4.1.1 MouseTest.java /* 1 */ public class MouseTest extends JApplet implements MouseListener /* 2 */ { int x=50, y=20; addmouselistener(this); /* 3 */ public void mouseclicked(mouseevent
cards.gif from Tkinter import * root = Tk() c0 = Canvas(root, width = 400, height = 300) c0.pack() image_data = PhotoImage(file = c1.gif ) c0.create_i
(Python ) Python Python 2 1. 2 2. 52 3. A, K, Q, J, 10, 9, 8, 7, 6, 5, 4, 3, 2 4. 13 5. 6. 7. 8. 9. 13 10. 11. 12. Python http://www.jftz.com/cards/ 1 cards.gif from Tkinter import * root = Tk() c0 = Canvas(root,
r3.dvi
10 3 2010.9.21 1 1) 1 ( 1) 1: 1) 1.0.1 : Java 1 import java.awt.*; import javax.swing.*; public class Sample21 extends JPanel { public void paintcomponent(graphics g) { g.setcolor(new Color(255, 180, 99));
Java演習(9) -- クラスとメソッド --
Java (9) Java (9) Java (9) 3 (x, y) x 1 30 10 (0, 50) 1 2 10 10 (width - 10, 80) -2 3 50 10 (width / 2, 110) 2 width 3 (RectMove4-1.java) import javax.swing.japplet; import javax.swing.timer; import java.awt.graphics;
programmingII2019-v01
II 2019 2Q A 6/11 6/18 6/25 7/2 7/9 7/16 7/23 B 6/12 6/19 6/24 7/3 7/10 7/17 7/24 x = 0 dv(t) dt = g Z t2 t 1 dv(t) dt dt = Z t2 t 1 gdt g v(t 2 ) = v(t 1 ) + g(t 2 t 1 ) v v(t) x g(t 2 t 1 ) t 1 t 2
from Tkinter import * root = Tk() c0 = Canvas(root, width = 400, height = 300) c0.pack() image_data = PhotoImage(file = c1.gif ) c0.create_image(200,
(Python ) Python Python 2 1. 2 2. 52 3. A, K, Q, J, 10, 9, 8, 7, 6, 5, 4, 3, 2 4. 13 5. 6. 7. 8. 9. 13 10. 11. 12. Python.gif 1 from Tkinter import * root = Tk() c0 = Canvas(root, width = 400, height =
インターネットマガジン1999年7月号―INTERNET magazine No.54
A MagnaviIp9907Htmltips +CD-ROM 3 3 A N S W E R HTML TIPS&TRICKS A N S W E R function Init() { block.style.setexpression("left",
GIMP import javafx.application.application; import javafx.scene.scene; import javafx.scene.canvas.canvas; import javafx.scene.canvas.graphicscontext;
(JavaFX ) JavaFX 2 1. 2 2. 52 3. A, K, Q, J, 10, 9, 8, 7, 6, 5, 4, 3, 2 4. 13 5. 6. 7. 8. 9. 13 10. 11. 12. Java.gif 1 GIMP import javafx.application.application; import javafx.scene.scene; import javafx.scene.canvas.canvas;
Local variable x y i paint public class Sample extends Applet { public void paint( Graphics gc ) { int x, y;... int i=10 ; while ( i < 100 ) {... i +=
Safari AppletViewer Web HTML Netscape Web Web 13-1 Applet Web Applet init Web paint Web start Web HTML stop destroy update init Web paint start Web update Event Driven paint Signature Overwriting Overriding
~/WWW-local/compIID (WWW IID ) $ mkdir WWW-local $ cd WWW-local $ mkdir compiid 3. Emacs index.html n (a) $ cd ~/WWW/compIID
10 10 10.1 1. 2. 3. HTML(HyperText Markup Language) Web [ ][ ] HTML Web HTML HTML Web HTML ~b08a001/www/ ( ) ~b08a001/www-local/ ( ) html ( ) 10.2 WWW WWW-local b08a001 ~b08a001/www/ ~b08a001/www-local/
Processing による ポーカーゲームについて 八神孝嗣
Processing による ポーカーゲームについて 110429085 八神孝嗣 Processing によるポーカーゲームについて 1. はじめに Processing でポーカーをつくったきっかけとしては, 指導教員が持ってきた資料の中でトランプを使ったゲームが多かったので, その中でも簡単だと思ったポーカーを選んだ. 2. ポーカーの歴史 ポーカーはトランプを使うゲームである 主にアメリカでプレイされているゲームで,
r07.dvi
19 7 ( ) 2019.4.20 1 1.1 (data structure ( (dynamic data structure 1 malloc C free C (garbage collection GC C GC(conservative GC 2 1.2 data next p 3 5 7 9 p 3 5 7 9 p 3 5 7 9 1 1: (single linked list 1
ohp07.dvi
19 7 ( ) 2019.4.20 1 (data structure) ( ) (dynamic data structure) 1 malloc C free 1 (static data structure) 2 (2) C (garbage collection GC) C GC(conservative GC) 2 2 conservative GC 3 data next p 3 5
WebGL WebGL DOM Kageyama (Kobe Univ.) Visualization / 39
WebGL DOM API 2014.05.27 X021 2014 Kageyama (Kobe Univ.) Visualization 2014.05.27 1 / 39 WebGL WebGL DOM Kageyama (Kobe Univ.) Visualization 2014.05.27 2 / 39 WebGL WebGL Kageyama (Kobe Univ.) Visualization
Exam : 1z1-809-JPN Title : Java SE 8 Programmer II Vendor : Oracle Version : DEMO Get Latest & Valid 1z1-809-JPN Exam's Question and Answers 1 from Ac
Actual4Test http://www.actual4test.com Actual4test - actual test exam dumps-pass for IT exams Exam : 1z1-809-JPN Title : Java SE 8 Programmer II Vendor : Oracle Version : DEMO Get Latest & Valid 1z1-809-JPN
e10s におけるプロセス間通信の基本 219 HACK #34 Components.manager.removeBootstrappedManifestLocati on() function shutdown(adata, areason) { const IOService =
e10s におけるプロセス間通信の基本 219 Components.manager.removeBootstrappedManifestLocati on() function shutdown(adata, areason) { const IOService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
アプレットの作成
- 1 - import java.applet.applet; import java.awt.graphics; public class HelloWorld extends Applet { public void init() { resize(150,60) ; public void paint ( Graphics g ) { g.drawstring("hello, world!",
