function scene1() { background(0); image(img1, width / 2, height / 2);//场景背景1 if…
- User
function scene1() { background(0); image(img1, width / 2, height / 2);//场景背景1
if (showImage1) {//左右键控制的变量,具体控制小人运动 if (isMoving) { animateZoulu(); let nextX = cRen.x + vRen.x; if (nextX >= 250 && nextX <= 1670) {//限制小人不走出画外 cRen.x = nextX; } } image(zoulu[img7FrameIndex], cRen.x, cRen.y); } else if (showImage2) { if (isMoving) { animateZoulu2(); let nextX = cRen.x + vRen2.x; if (nextX >= 250 && nextX <= 1670) { cRen.x = nextX; } } image(zoulu2[img7FrameIndex], cRen.x, cRen.y);//一直到这里,作用同上 } if (showImage3) { text(currentText, width / 2, height * 0.8);//墙上提示词,不按时 }else if(showImage4){ image(img2, width / 2, height / 2); text(text2, width / 2, height * 0.8);//放大图,和缩小提示词 } if (showImg8) { //激活显示图片的开关 image(img8, width / 2, height / 2); } img7X = cRen.x; img7Y = cRen.y;//有关小人走路的变量,不动
fill(255); text(text3, 1720, 350);//门上提示词
//对白字幕 if (T1 === 0 && showSecondText){ T2 = 240; showSecondText = false; // 第二段文字只出现一次 } else if (T1 > 0) { textFont("Simsun"); textSize(40); text(dialogue1,width * 0.5, height * 0.7); T1--; } else if (T2 > 0) { textFont("Simsun"); textSize(40); text(dialogue2, width * 0.5, height * 0.7); T2--; } else if (T3 > 0) { textFont("Simsun"); textSize(40); text(dialogue3, width * 0.5, height * 0.7); T3--; }
} //对话框出现与否 function mouseClicked() { showImg8 = !showImg8;// 每次点击开关状态取反 } //字幕出现的时长 function mousePressed(){ if (T1 === -1) { textIndex = 0; textLoading = true; T1 = 240; } else if (T1 === 0) { T2 = 240; } else if (T2 === -1){ T3 = 240; } }帮我完善这段p5.js代码,使得在第二段文字不再出现后直接出现第三段文字"几岁时的一棵树、一株草、一片天、一条街,或许就是你心灵的栖息地和灵魂的中转站。",并且第三句话可以持续出现4秒
- Assistant
function scene1() { background(0); image(img1, width / 2, height / 2);//场景背景1
if (showImage1) {//左右键控制的变量,具体控制小人运动 if (isMoving) { animateZoulu(); let nextX = cRen.x + vRen.x; if (nextX >= 250 && nextX <= 1670) {//限制小人不走出画外 cRen.x = nextX; } } image(zoulu[img7FrameIndex], cRen.x, cRen.y); } else if (showImage2) { if (isMoving) { animateZoulu2(); let nextX = cRen.x + vRen2.x; if (nextX >= 250 && nextX <= 1670) { cRen.x = nextX; } } image(zoulu2[img7FrameIndex], cRen.x, cRen.y);//一直到这里,作用同上 } if (showImage3) { text(currentText, width / 2, height * 0.8);//墙上提示词,不按时 }else if(showImage4){ image(img2, width / 2, height / 2); text(text2, width / 2, height * 0.8);//放大图,和缩小提示词 } if (showImg8) { //激活显示图片的开关 image(img8, width / 2, height / 2); } img7X = cRen.x; img7Y = cRen.y;//有关小人走路的变量,不动
- User
let dialogue1 ="哈喽,还记得你的童年是什么样子的嘛?" let dialogue2 = "童年所经历的一切,都会在时光里发酵成甜蜜的回忆。" let dialogue3 = "几岁时的一棵树、一株草、一片天、一条街,或许就是你心灵的栖息地和灵魂的中转站。" let dialogue4 = "希望你的一生都可以被童年治愈。" let T1 = -1; let T2 = 0; let T3 = 0; let T4 = 0; let showImgClick = false; // 点击开关 let showSecondText = true; // 新增变量控制第二段文字是否显示过
function scene1() { background(0); image(img1, width / 2, height / 2);//场景背景1
if (showImage1) {//左右键控制的变量,具体控制小人运动 if (isMoving) { animateZoulu(); let nextX = cRen.x + vRen.x; if (nextX >= 250 && nextX <= 1670) {//限制小人不走出画外 cRen.x = nextX; } } image(zoulu[img7FrameIndex], cRen.x, cRen.y); } else if (showImage2) { if (isMoving) { animateZoulu2(); let nextX = cRen.x + vRen2.x; if (nextX >= 250 && nextX <= 1670) { cRen.x = nextX; } } image(zoulu2[img7FrameIndex], cRen.x, cRen.y);//一直到这里,作用同上 } if (showImage3) { text(currentText, width / 2, height * 0.8);//墙上提示词,不按时 }else if(showImage4){ image(img2, width / 2, height / 2); text(text2, width / 2, height * 0.8);//放大图,和缩小提示词 } if (showImg8) { //激活显示图片的开关 image(img8, width / 2, height / 2); } img7X = cRen.x; img7Y = cRen.y;//有关小人走路的变量,不动
- Assistant
let dialogue1 ="哈喽,还记得你的童年是什么样子的嘛?" let dialogue2 = "童年所经历的一切,都会在时光里发酵成甜蜜的回忆。" let dialogue3 = "几岁时的一棵树、一株草、一片天、一条街,或许就是你心灵的栖息地和灵魂的中转站。" let dialogue4 = "希望你的一生都可以被童年治愈。" let T1 = -1; let T2 = 0; let T3 = 0; let T4 = 0; let showImgClick = false; // 点击开关 let showSecondText = true; // 新增变量控制第二段文字是否显示过 let showThirdText = true; // 新增变量控制第三段文字是否显示过