Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| steve-wang-generative [2021/06/20 18:37] – steve.wang | steve-wang-generative [2021/08/18 00:47] (current) – scott.chen | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ===== Steve' | + | ====== Steve Wang's crazyDog.js |
| + | Made by [[steve-wang|Steve]]. | ||
| < | < | ||
| - | <iframe src=" | + | <iframe src=" |
| </ | </ | ||
| - | I worked on this code for about a school term. I am also new to p5.js so it might not be that good. I think I have also improved in my programming skills. The first thing I made was the dog then the grenades, the clouds and the stars an, the sun I think I have improved for every step of the way. However, it may not show because I went back to improve the older things I made. Overall, I think I did fine and I am very to have learnt programming. | + | ===== about my crazyDog.js ===== |
| + | |||
| + | I worked on this code for about a school term. I am also new to p5.js so it might not be that good. I think I have also improved in my programming skills. The first thing I made was the dog then the grenades, the clouds and the stars, | ||
| + | |||
| + | The animation code is released under the [[https:// | ||
| + | |||
| + | ===== The code for my crazyDog.js ===== | ||
| < | < | ||
| Line 288: | Line 295: | ||
| let b=0 | let b=0 | ||
| let DrawCloudX =0 | let DrawCloudX =0 | ||
| - | let DrawCloudY =0 | + | let DrawCloudY =[] |
| let cloudc =100 | let cloudc =100 | ||
| let sunOut=[] | let sunOut=[] | ||
| let rown=0 | let rown=0 | ||
| let DrawCloudX2 =0 | let DrawCloudX2 =0 | ||
| + | let cSpeed=[] | ||
| + | let cSpeed2=[] | ||
| - | | + | |
| - | | + | |
| if (DrawCloudX> | if (DrawCloudX> | ||
| if (option> | if (option> | ||
| - | if (option==0){ let cloud= new Clouds (DrawCloudX+DrawCloudX*i, | + | if (option==0){ let cloud= new Clouds (DrawCloudX+DrawCloudX*i, |
| cloud.draw(); | cloud.draw(); | ||
| - | if (option==1) { let cloud= new BigCloud(DrawCloudX+DrawCloudX*i, | + | if (option==1) { let cloud= new BigCloud(DrawCloudX+DrawCloudX*i, |
| cloud.draw(); | cloud.draw(); | ||
| - | if (option==2){ let cloud= new FlatBottomCloud (DrawCloudX+DrawCloudX*i, | + | if (option==2){ let cloud= new FlatBottomCloud (DrawCloudX+DrawCloudX*i, |
| cloud.draw(); | cloud.draw(); | ||
| } | } | ||
| - | | + | |
| - | | + | |
| if (DrawCloudX2> | if (DrawCloudX2> | ||
| if (option> | if (option> | ||
| - | if (option==0){ let cloud= new Clouds (DrawCloudX2+DrawCloudX2*i, | + | if (option==0){ let cloud= new Clouds (DrawCloudX2+DrawCloudX2*i, |
| cloud.draw(); | cloud.draw(); | ||
| - | if (option==1) { let cloud= new BigCloud(DrawCloudX2+DrawCloudX2*i, | + | if (option==1) { let cloud= new BigCloud(DrawCloudX2+DrawCloudX2*i, |
| cloud.draw(); | cloud.draw(); | ||
| - | if (option==2){ let cloud= new FlatBottomCloud (DrawCloudX2+DrawCloudX2*i, | + | if (option==2){ let cloud= new FlatBottomCloud (DrawCloudX2+DrawCloudX2*i, |
| cloud.draw(); | cloud.draw(); | ||
| } | } | ||
| Line 373: | Line 382: | ||
| star3.draw(); | star3.draw(); | ||
| } | } | ||
| + | let lengthofCInfo=0 | ||
| + | let makingCloudInfo=[] | ||
| + | |||
| + | function makeCloudInfo(lengthofCInfo){ | ||
| + | for (let c = 0; c < lengthofCInfo; | ||
| + | makingCloudInfo.push(random(0, | ||
| + | } | ||
| + | return makingCloudInfo} | ||
| + | |||
| + | let makingCloudSpeed=[] | ||
| + | |||
| + | function cloudSpeedCreator (lengthofCInfo){ | ||
| + | for (let c = 0; c < lengthofCInfo; | ||
| + | makingCloudSpeed.push(random(1, | ||
| + | } | ||
| + | return makingCloudSpeed} | ||
| + | |||
| let starArray=[]; | let starArray=[]; | ||
| Line 388: | Line 414: | ||
| drawingarray.push(0) | drawingarray.push(0) | ||
| } | } | ||
| + | |||
| + | let cloudInfo=[]; | ||
| + | let cloudInfo2 =[]; | ||
| + | let cloudSpeed =[] | ||
| + | let cloudSpeed2 =[] | ||
| Line 395: | Line 426: | ||
| | | ||
| c1=Math.floor(random() * 3) | c1=Math.floor(random() * 3) | ||
| - | // (x, | ||
| greenb=sun(1) | greenb=sun(1) | ||
| cloudc=sun(2) | cloudc=sun(2) | ||
| - | | + | cloudInfo=makeCloudInfo(cloudarray.length); |
| - | cloudarray.forEach((x, | + | cloudInfo2=makeCloudInfo(cloudarray.length); |
| + | cloudSpeed=cloudSpeedCreator(cloudarray.length); | ||
| + | cloudSpeed2=cloudSpeedCreator(cloudarray.length); | ||
| + | |||
| + | |||
| + | | ||
| + | cloudarray.forEach((x, | ||
| if (greenb> | if (greenb> | ||