平成 28 年度 数学講究録 題目 p5.js によるテトリスプログラム Processing による Shooting Game の作成 Processing の Othello のプログラム作成 指導教員 冨田耕史 120429030 熊澤龍佑 130440071 堀部達也 130440087 矢野稜也 130440058 城裕太 130440076 丸山慎椰 130440090 山本幸司 提出日平成 29 年 1 月 30 日 差替日平成 29 年 3 月 6 日
p5.js 120429030 130440071 130440087 2017 3 4 1 p5.js 2 1.1 p5.js..................................... 2 2 Tetris 2 2.1 Tetris................................. 2 2.2.................................... 3 2.3................................... 3 3 Tetris 3 3.1............................. 3 3.2 p5.js......................... 4 3.3 Tetris........................... 5 3.4 Tetris........................... 6 4 13 4.1,................ 13 4.2.................................. 14 5 15 5.1............................ 15 1
6 15 6.1 test.html................................... 15 6.2 map1.js................................... 17 6.3 Tetorimino.js................................ 33 1 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.. 1984,,.,.,. ([2] ). 2
2.2 7. 4. 7., 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
.. 2. 3.2 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
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
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
(11) initmino. (12) down. (13) display. (14) down w = 1. clear clear i, j, g 1 5. i, j,q 1. 1. j 19 0 ( ). 2. q. 3. i 0 10 ( ). 4. q 1. 5. 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
; change change i, k 1, 2. i, k,. 1.. 2. i 0 10 1. 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, 4.. 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
), 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
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 = 3. 2.. 3. w = 1( ). 4. 1. 10
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
; 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
4 4.1,,. o0-down search,,.,, o-,..,,,., p5.js, if., if if, &&. 13
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
,. 5 5.1,,.,.,.,,. 6 6.1 test.html <!doctype html> <html> <head> <meta charset="utf-8"> <script src="http://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.2/p5.js"></script> <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
//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
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
; 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
; //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
; //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
(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
; // 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
; 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
; 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
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
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
; 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
; 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
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
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
// 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
; 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
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
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
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
; 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
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
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
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
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
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
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
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
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
//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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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: version0.5.2 62
[1] L.McCarthy, C.Reas,and B.Fry,Getting Started with p5.js,maker Media books (2015) [2], http://ongame-tetris.net/tetris toha.html (2010) 63
Processing Shooting Game 130440058 2017 3 4 1 2 1.1 Shooting Game.......................... 2 1.2................................... 3 1.3................................... 3 2 5 2.1................................... 5 2.2 Processing............................ 7 2.3 N-way............................... 8 2.4......................... 11 2.5............................ 13 2.6.............................. 14 2.7.............................. 15 2.8............................. 16 2.9............................... 17 3, 18 3.1.................................... 18 3.2.................................. 21 4 23 4.1.................................... 23 1
4.2..................................... 23 5 24 5.1 Shooting( ).............................. 24 5.2 Boss................................. 40 5.3 Enemy................................ 46 5.4 Stage................................. 48 5.5 Tama set1.............................. 57 5.6 Tama set2.............................. 58 5.7 Tama type.............................. 59 5.8 color..................................... 60 5.9 Boss1................................. 61 5.10 Boss2................................. 62 5.11 Boss3................................. 63 5.12 Boss4................................. 65 5.13 Boss5................................. 67 5.14 Boss6................................. 71 5.15 Stage1 Enemy................................ 75 5.16 Stage2 Enemy................................ 79 5.17 Stage3 Enemy................................ 85 5.18 Stage4 Enemy................................ 87 5.19 Stage5 Enemy................................ 91 5.20 Stage6 Enemy................................ 94 1 1.1 Shooting Game,, STG SHT., 1962,, ([2] ). 1978,, 2
,. 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. 1.3. 3
. 6. 1, ( ).. 10, 1 1.,,..,, Shift.,. Shift 2,. ( ).. ( )..., 4
.,.,.,. 2 2.1, 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
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
1, keymove 0001 keymove., 1., keymove 0010 keymove 0011.. 0100, 1000.,., keymove=0011, keymove 0001, keymove 0010. 0,. 0010, 0100, 1000. keymove 0001,0010,0100,1000,,,,,,. keystat Shift. 2.2 Processing Processing, y, 2 x 0., Processing 1,,.. 1 z angle(). 7
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
. 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
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
if(life_flag==true)check2(tama,n,tamat); Tama.time++;,, N 2 0 1.,,. 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
// 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
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
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
mystage[retry].stage_play();, Stage, retry., draw() mystage[retry], retry 1, mystage[retry],.,.,, 3.1. 2.7 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
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
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
. 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
7., 2. 1 Tama set,. Tama set1, 5000 float 5. float, 1 4byte, 1, 8 5000 5 200000[B] = 200[KB]., Tama set2, 2000 100 float 4, 8 2000 100 4 6400000[B] = 6.4[MB].,., 2.6, RETRY,, RETRY.,, Tama set.,,. 2,.,,. 19
,, 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
,.,,,.,,,.,,,,,.,,,.,,,. 3.2,,,,,,,,,.,,.,.,,.,,,,,.,,,., 1 x, y 21
,.,,,,,.,,, 8,,. 8 UI,, 0.,,.,, 22
,,,. 4 4.1 Processing,,,.,,.,,,,.,,. 4.2,.,,,,,..,,,, Shooting Game. 23
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
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
// 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
// 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
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
// 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
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
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
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
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
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
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
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
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
// 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
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
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
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
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
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
// 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
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
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
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
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
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
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
// 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
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
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
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>=1000+30*n&&e15[n].eflag==true)e15[n].edisplay(); if(stage_time>=1000+30*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
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>=1200+200*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
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>=1400+30*n&&e32[n].eflag==true)e32[n].edisplay(); if(stage_time>=1400+30*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
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
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
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
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
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
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
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
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
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
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
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
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
//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,1000000,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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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[ ], https://ja.wikipedia.org/wiki/%e3%82%b9%e3%83%9a%e3%83%bc%e3%82 %B9%E3%82%A6%E3%82%A9%E3%83%BC!,(2016) [3] Wikipedia[ ], https://ja.wikipedia.org/wiki/%e3%82%b7%e3%83%a5%e3%83%bc%e3%83%86 %E3%82%A3%E3%83%B3%E3%82%B0%E3%82%B2%E3%83%BC%E3%83%A0,(2016) [4] Wikipedia[ ], https://ja.wikipedia.org/wiki/%e5%bc%be%e5%b9%95%e7%b3%bb%e3%82%b7 %E3%83%A5%E3%83%BC%E3%83%86%E3%82%A3%E3%83%B3%E3%82%B0,(2016) [5], http://www.geocities.co.jp/siliconvalley-oakland/9951/products/th dnh.html,(2012) [6] Java, http://www.geocities.jp/jq2hpl2000/old/prog/java/multipleinput/multipleinput.html, (2006) [7] Wikipedia[ ], https://ja.wikipedia.org/wiki/%e3%82%ac%e3%83%99%e3%83%bc%e3%82%b8 %E3%82%B3%E3%83%AC%E3%82%AF%E3%82%B7%E3%83%A7%E3%83%B3,(2017) 100
Processing Othello 130440076 130440090 2017 3 5 1 Othello 2 1.1 Othello................................ 2 1.2.................................... 2 2 Othello 3 2.1 Processing............................... 3 2.2........................... 4 2.3............................... 6 3, 13 3.1.................... 13 3.2.................................. 13 4 13 5 14 5.1.............................. 14 5.2 Board................................ 15 5.3 Koma................................ 22 5.4 Mass................................. 23 1
1 Othello 1.1 Othello, 1945. 1945...,, 8 8 ([2] ). 1.2,. 8 8. n m (n, m), (4, 4) (5, 5), (4, 5) (5, 4). 2
..,,.,,.., ([3] ). 2 Othello 2.1 Processing Processing,.,,,,., 3