我很难在js,jQuery中为我的游戏进行碰撞。我希望这个角色能够从平台跳到平台。另外,我想要一个console.log('hit');当其中一个角色用一个镜头触碰另一个角色时。过去两天我一直在努力。我被卡住了。
这是我的代码:
setInterval(bougerPersonnages, 8); //Vitesse de déplacement.
var touche = {}
var batmanp = document.getElementById('batman');
var jumping = false;
var jumpingChomel = false;
var barpos = $("#batman");
var browserHeight = parseInt(document.documentElement.clientHeight);
var iHeight = window.innerHeight;
var batmanPosX = $("#batman").offset().left;
var batmanPosY = $("#batman").offset().top;
var batmanWidth = $("#batman").width();
var batmanHeigth = $("#batman").height();
var ballePosX = $('#arrow1').offset().left;
var ballePosY = $('#arrow1').offset().top;
var balleWidth = $('#arrow1').width();
var balleHeight = $('#arrow1').height();
$(document).keydown(function(e) { //Fonctionne
touche[e.keyCode] = true;
});
$(document).keyup(function(e) { //Fonctionne
delete touche[e.keyCode];
});
function bougerPersonnages() {
for (var direction in touche) {
if (direction == 37) { //Fonctionne
batman.className = 'dirGauche';
$("#batman").css('left','-=5px');
}
if (direction == 81) { //Fonctionne
chomel.className = 'dirGauche';
$("#chomel").css('left', '-=5');
}
if (direction == 39) { //Fonctionne
batman.className = 'dirDroite';
$("#batman").css('left', '+=5');
}
if (direction == 68) { //Fonctionne
chomel.className = 'dirDroite';
$("#chomel").css('left', '+=5');
}
if (direction == 38) { //Fonctionne
if (!jumping) {
jumping = true;
$("#batman").animate({ bottom: 300 +"px" }, 300);
$("#batman").animate({ bottom: 10 + "px" }, 300);
setTimeout(land, 650);
}
}
if (direction == 90) { //Fonctionne
if (!jumpingChomel) {
jumpingChomel = true;
$("#chomel").animate({ bottom: 300 +"px" }, 300);
$("#chomel").animate({ bottom: 10 + "px" }, 300);
setTimeout(landChomel, 650);
}
}
}
}
//Fonctionne
function land() {
jumping = false;
}
function landChomel() {
jumpingChomel = false;
}
//Fonctionne
document.addEventListener('keydown', function(e) { // Déclenche la fonction fire
switch (e.keyCode) {
case 76:
console.log('ok');
fire_batman();
break;
case 32:
console.log('ok');
fire_chomel();
break;
}
});
function fire_chomel() { //Fonctionne
var posTop = parseInt($(chomel).offset().top);
var posLeft = parseInt($(chomel).offset().left);
var bullets = $('#arrow1');
var bulletElement = $('<div class="arrow1" style="top: '+ (posTop + 50) +'px; left: '+ posLeft +'px"></div>');
bullets.append(bulletElement);
if (chomel.className == 'dirGauche') {
var options = {left: browserHeight * -15};
}
else {
var options = {left: browserHeight * 15};
}
bulletElement.animate(options, 0.5, "linear");
}
function fire_batman() { //Fonctionne
var posTop = parseInt($(batman).offset().top);
var posLeft = parseInt($(batman).offset().left);
var bullets = $('#arrow1');
var bulletElement = $('<div class="arrow1" style="top: '+ (posTop + 50) +'px; left: '+ posLeft +'px"></div>');
bullets.append(bulletElement);
if (batman.className == 'dirGauche') {
var options = {left: browserHeight * -15};
}
else {
var options = {left: browserHeight * 15};
}
bulletElement.animate(options, 0.5, "linear");
var rect1 = {x: batmanPosX, y: batmanPosY, width: batmanWidth, height: batmanHeigth}
var rect2 = {x: ballePosX, y: ballePosY, width: balleWidth, height: balleHeight}
if (rect1.x < rect2.x + rect2.width &&
rect1.x + rect1.width > rect2.x &&
rect1.y < rect2.y + rect2.height &&
rect1.height + rect1.y > rect2.y) {
// collision detected!
console.log('TOUCHER FDP')
}
// filling in the values =>
if (5 < 30 &&
55 > 20 &&
5 < 20 &&
55 > 10) {
// collision detected!
}
}
body {
padding: 0;
margin: 0;
background: url('http://image.noelshack.com/fichiers/2015/16/1429119282-bg.png');
background-color: #B4381F;
background-repeat: no-repeat;
background-attachment: fixed;
background-size: 100%;
background-position: 50% 30%;
overflow: hidden;
}
#batman{
background-image:url('http://image.noelshack.com/fichiers/2015/16/1429119282-batman.png');
width:90px;
height:90px;
display:block;
background-repeat: no-repeat;
position:absolute;
}
#chomel{
background-image:url('http://image.noelshack.com/fichiers/2015/16/1429119282-chomel.png');
width:90px;
height:90px;
display:block;
background-repeat: no-repeat;
position:absolute;
}
.dirDroite{
background-position: -95px 0px;
}
.dirGauche{
background-position: 0px 0px;
}
#fullbody {
margin: auto;
width: 100%;
height: 100%;
}
#floor {
position: absolute;
right: 0;
bottom: 0;
left: 0;
background: url("http://image.noelshack.com/fichiers/2015/16/1429119282-thefloor.png");
background-repeat: repeat-x;
background-size: 100% 100%;
height: 126px;
}
#base {
position: absolute;
right: 0;
bottom: 100px;
left: 0;
z-index: 200;
margin: auto;
background: url('http://image.noelshack.com/fichiers/2015/16/1429119282-platform5.png');
background-size: cover;
width: 600px;
height: 30px;
}
#perspectiveGauche{
margin-top : 22vh;
-webkit-perspective: 4vh;
perspective: 4vh;
position: absolute;
width: 45vw;
perspective-origin: 50% 0%;
}
#rectangleHautGaucheH{
margin-left: 13.22vh;
width: 28.87vw;
height: 2vh;
background-color: #854305;
-webkit-transform: rotateX(2deg);
transform: rotateX(2deg);
}
#rectangleBasGaucheH{
width: 29.1vw;
margin-left: 13vh;
height: 3vh;
background-color: #663303;
}
#perspectiveGaucheBasse{
margin-top : 22vh;
-webkit-perspective: 0.1vh;
perspective: 0.1vw;
position: absolute;
width: 45vw;
perspective-origin: 50% 0%;
}
#rectangleHautGaucheB{
margin-top: 38vh;
margin-left: 28vh;
width: 15vw;
height: 0.25vh;
background-color: #854305;
-webkit-transform: rotateX(2deg);
transform: rotateX(2deg);
}
#rectangleBasGaucheB{
margin-top: 0.6vh;
width: 15.3vw;
margin-left: 27.75vh;
height: 3vh;
background-color: #663303;
}
#perspectiveDroite{
-webkit-perspective: 4vh;
perspective: 4wh;
position: absolute;
width: 39.6vw;
height: 2vh;
margin-top: 22vh;
perspective-origin: 200% 0%;
}
#rectangleHautDroitH{
margin-left: 125vh;
width: 28.7vw;
height: 2vh;
background-color: #854305;
-webkit-transform: rotateX(2deg);
transform: rotateX(2deg);
}
#rectangleBasDroitH{
width: 28.9vw;
margin-left: 124.8vh;
height: 3vh;
background-color: #663303;
}
#rectangleHautDroiteB{
margin-top: 32vh;
margin-left: 133vh;
width: 22vw;
height: 2vh;
background-color: #854305;
-webkit-transform: rotateX(2deg);
transform: rotateX(2deg);
}
#rectangleBasDroiteB{
margin-top: 0.2vh;
width: 22.18vw;
margin-left: 132.8vh;
height: 3vh;
background-color: #663303;
}
#perspectiveMilieu{
-webkit-perspective: 4vh;
perspective: 4wh;
position: absolute;
width: 39.6vw;
height: 2vh;
margin-top: 22vh;
perspective-origin: 130% 0%;
}
#rectangleHautMilieu{
margin-top: 21vh;
margin-left: 68.95vh;
width: 34.5vw;
height: 2vh;
background-color: #854305;
-webkit-transform: rotateX(2deg);
transform: rotateX(2deg);
}
#rectangleBasMilieu{
margin-top: 0.1vh;
width: 34.77vw;
margin-left: 68.7vh;
height: 3vh;
background-color: #663303;
}
.arrow1 {
position: absolute;
z-index: 3;
transition-duration: 3s;
width: 50px;
height: 11px;
background: url('http://image.noelshack.com/fichiers/2015/16/1429119282-bullet.png') 43px 19px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>LEVEL 1</title>
<link rel="stylesheet" type="text/css" href="style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
</head>
<body>
<div id="fullbody">
<div id="perspectiveGauche">
<div id="rectangleHautGaucheH"></div>
<div id="rectangleBasGaucheH"></div>
</div>
<div id="perspectiveGaucheBasse">
<div id="rectangleHautGaucheB"></div>
<div id="rectangleBasGaucheB"></div>
</div>
<div id="perspectiveDroite">
<div id="rectangleHautDroitH"></div>
<div id="rectangleBasDroitH"></div>
<div id="rectangleHautDroiteB"></div>
<div id="rectangleBasDroiteB"></div>
</div>
<div id="perspectiveMilieu">
<div id="rectangleHautMilieu"></div>
<div id="rectangleBasMilieu"></div>
</div>
<div id="base"></div>
<div id="arrow1"></div>
<div id="floor"></div>
<span style="margin-left:50px;" id="result">false</span>
<div id="batman" name="batman" class="dirGauche" style="left: 1100px; bottom: 580px;"></div>
<div id="chomel" name="chomel" class="dirGauche" style="left: 900px; bottom: 580px;"></div>
</div>
<script src="scripts/script.js" ></script>
同时加入jsfiddle:https://jsfiddle.net/b6hq4xqr/
先谢谢你的回复。 干杯!
答案 0 :(得分:2)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>LEVEL 1</title>
<link rel="stylesheet" type="text/css" href="style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
</head>
<body>
<div id="fullbody">
<div id="perspectiveGauche">
<div id="rectangleHautGaucheH"></div>
<div id="rectangleBasGaucheH" class="collidableRectangle"></div>
</div>
<div id="perspectiveGaucheBasse">
<div id="rectangleHautGaucheB"></div>
<div id="rectangleBasGaucheB" class="collidableRectangle"></div>
</div>
<div id="perspectiveDroite">
<div id="rectangleHautDroitH"></div>
<div id="rectangleBasDroitH" class="collidableRectangle"></div>
<div id="rectangleHautDroiteB"></div>
<div id="rectangleBasDroiteB" class="collidableRectangle"></div>
</div>
<div id="perspectiveMilieu">
<div id="rectangleHautMilieu"></div>
<div id="rectangleBasMilieu" class="collidableRectangle"></div>
</div>
<div id="base"></div>
<div id="arrow1"></div>
<div id="floor"></div>
<span style="margin-left:50px;" id="result">false</span>
<div id="batman" class="dirGauche" style="left: 1100px; bottom: 580px;"></div>
<div id="chomel" class="dirGauche" style="left: 900px; bottom: 580px;"></div>
</div>
<script src="javascript.js" ></script>
</body>
</html>
休息
function bougerPersonnages() {
for (var direction in touche) {
if (direction == 37) { //Fonctionne
batman.className = 'dirGauche';
$("#batman").css('left', '-=5px');
} else if (direction == 81) { //Fonctionne
chomel.className = 'dirGauche';
$("#chomel").css('left', '-=5');
} else if (direction == 39) { //Fonctionne
batman.className = 'dirDroite';
$("#batman").css('left', '+=5');
} else if (direction == 68) { //Fonctionne
chomel.className = 'dirDroite';
$("#chomel").css('left', '+=5');
} else if (direction == 38) { //Fonctionne
if (!jumping) {
jumping = true;
$("#batman").animate({bottom: 300 + "px"}, 300);
$("#batman").animate({bottom: 10 + "px"}, 300);
setTimeout(land, 650);
}
}
else if (direction == 90) { //Fonctionne
if (!jumpingChomel) {
jumpingChomel = true;
$("#chomel").animate({bottom: 300 + "px"}, 300);
$("#chomel").animate({bottom: 10 + "px"}, 300);
setTimeout(landChomel, 650);
}
}
}
var batmanRect = getRectangle($("#batman"));
$(".arrow1").each(function () {
var rect = getRectangle($(this));
if (intersectingRectangles(batmanRect, rect)) {
console.log("batman has been shot!");
}
});
$(".collidableRectangle").each(function () {
var rect = getRectangle($(this));
if (intersectingRectangles(batmanRect, rect)) {
console.log("batman has hit a platform!");
}
});
}
function fire_chomel() { //Fonctionne
var posTop = parseInt($(chomel).offset().top);
var posLeft = parseInt($(chomel).offset().left);
var bullets = $('#arrow1');
var bulletElement = $('<div class="arrow1" style="top: ' + (posTop + 50) + 'px; left: ' + posLeft + 'px"></div>');
bullets.append(bulletElement);
if (chomel.className == 'dirGauche') {
var options = {left: browserHeight * -15};
}
else {
var options = {left: browserHeight * 15};
}
bulletElement.animate(options, 2000, "linear", function () {
$(this).remove();
});
}
function intersectingRectangles(r1, r2) {
return !(r2.left > r1.right ||
r2.right < r1.left ||
r2.top > r1.bottom ||
r2.bottom < r1.top);
}
function getRectangle(figure) {
var rect = {};
rect.left = figure.offset().left;
rect.top = figure.offset().top;
rect.right = rect.left + figure.width();
rect.bottom = rect.top + figure.height();
return rect;
}
我也删除了
.arrow1 {
transition-duration: 3s;
}
您遇到的大多数问题都是由于您(ab)使用全局变量。每个有经验的程序员都会告诉你全局变量应该谨慎使用,甚至尽可能避免使用。这是有充分理由的。
这只实现了第一个火力函数,但另一个是模拟的,你应该能够自己做。 碰撞现在登录到控制台。 我试图通过对代码的最小更改来完成此操作。我建议你在继续之前考虑最小化你对全局变量的使用。
答案 1 :(得分:0)
以下是我的代码:
setInterval(bougerPersonnages, 8); //Vitesse de déplacement.
var touche = {}
var jumping = false;
var jumpingChomel = false;
var browserHeight = parseInt(document.documentElement.clientHeight);
var batmanPosX = $("#batman").offset().left;
var chomelPosX = $("#chomel").offset().left;
$(document).keydown(function(e) { //Fonctionne
touche[e.keyCode] = true;
});
$(document).keyup(function(e) { //Fonctionne
delete touche[e.keyCode];
});
function bougerPersonnages() {
for (var direction in touche) {
if (direction == 37) { //Fonctionne
batman.className = 'dirGauche';
$("#batman").css('left', '-=5px');
} else if (direction == 81) { //Fonctionne
chomel.className = 'dirGauche';
$("#chomel").css('left', '-=5');
} else if (direction == 39) { //Fonctionne
batman.className = 'dirDroite';
$("#batman").css('left', '+=5');
} else if (direction == 68) { //Fonctionne
chomel.className = 'dirDroite';
$("#chomel").css('left', '+=5');
} else if (direction == 38) { //Fonctionne
if (!jumping) {
jumping = true;
$("#batman").animate({bottom: 300 + "px"}, 300);
$("#batman").animate({bottom: 10 + "px"}, 300);
setTimeout(land, 650);
}
}
else if (direction == 90) { //Fonctionne
if (!jumpingChomel) {
jumpingChomel = true;
$("#chomel").animate({bottom: 300 + "px"}, 300);
$("#chomel").animate({bottom: 10 + "px"}, 300);
setTimeout(landChomel, 650);
}
}
}
var batmanRect = getRectangle($("#batman"));
$(".arrow1").each(function () {
var rect = getRectangle($(this));
if (intersectingRectangles(batmanRect, rect)) {
console.log("batman has been shot!");
$("#batman").animate({left: "+=50px"}, 40);
}
});
var chomelRect = getRectangle($("#chomel"));
$(".arrow1").each(function () {
var rect = getRectangle($(this));
if (intersectingRectangles(chomelRect, rect)) {
console.log("chomel has been shot!");
$("#batman").animate({left: "+=50px"}, 40);
}
});
$(".collidableRectangle").each(function () {
var rect = getRectangle($(this));
if (intersectingRectangles(batmanRect, rect)) {
console.log("batman has hit a platform!");
}
});
}
function land() {
jumping = false;
}
function landChomel() {
jumpingChomel = false;
}
document.addEventListener('keydown', function(e) { // Déclenche la fonction fire
switch (e.keyCode) {
case 76:
fire_batman();
break;
case 32:
fire_chomel();
break;
}
});
function fire_chomel() { //Fonctionne
var posTop = parseInt($(chomel).offset().top);
var posLeft = parseInt($(chomel).offset().left);
var bullets = $('#arrow1');
var bulletElement = $('<div class="arrow1" style="top: ' + (posTop + 50) + 'px; left: ' + posLeft + 'px"></div>');
bullets.append(bulletElement);
if (chomel.className == 'dirGauche') {
var options = {left: browserHeight * -15};
}
else {
var options = {left: browserHeight * 15};
}
bulletElement.animate(options, 2000, "linear", function () {
$(this).remove();
});
}
function fire_batman() { //Fonctionne
var posTop = parseInt($(batman).offset().top);
var posLeft = parseInt($(batman).offset().left);
var bullets = $('#arrow1');
var bulletElement = $('<div class="arrow1" style="top: ' + (posTop + 50) + 'px; left: ' + posLeft + 'px"></div>');
bullets.append(bulletElement);
if (batman.className == 'dirGauche') {
var options = {left: browserHeight * -15};
}
else {
var options = {left: browserHeight * 15};
}
bulletElement.animate(options, 2000, "linear", function () {
$(this).remove();
});
}
function intersectingRectangles(r1, r2) {
return !(r2.left > r1.right ||
r2.right < r1.left ||
r2.top > r1.bottom ||
r2.bottom < r1.top);
}
function getRectangle(figure) {
var rect = {};
rect.left = figure.offset().left;
rect.top = figure.offset().top;
rect.right = rect.left + figure.width();
rect.bottom = rect.top + figure.height();
return rect;
}
body {
padding: 0;
margin: 0;
background: url('img/bg.png');
background-color: #B4381F;
background-repeat: no-repeat;
background-attachment: fixed;
background-size: 100%;
background-position: 50% 30%;
overflow: hidden;
}
#batman{
background-image:url(img/batman.png);
width:90px;
height:90px;
display:block;
background-repeat: no-repeat;
position:absolute;
}
#chomel{
background-image:url(img/chomel.png);
width:90px;
height:90px;
display:block;
background-repeat: no-repeat;
position:absolute;
}
.dirDroite{
background-position: -95px 0px;
}
.dirGauche{
background-position: 0px 0px;
}
#fullbody {
margin: auto;
width: 100%;
height: 100%;
}
#floor {
position: absolute;
right: 0;
bottom: 0;
left: 0;
background: url("img/thefloor.png");
background-repeat: repeat-x;
background-size: 100% 100%;
height: 126px;
}
#base {
position: absolute;
right: 0;
bottom: 100px;
left: 0;
z-index: 200;
margin: auto;
background: url('img/platform5.png');
background-size: cover;
width: 600px;
height: 30px;
}
#perspectiveGauche{
margin-top : 22vh;
-webkit-perspective: 4vh;
perspective: 4vh;
position: absolute;
width: 45vw;
perspective-origin: 50% 0%;
}
#rectangleHautGaucheH{
margin-left: 13.22vh;
width: 28.87vw;
height: 2vh;
background-color: #854305;
-webkit-transform: rotateX(2deg);
transform: rotateX(2deg);
}
#rectangleBasGaucheH{
width: 29.1vw;
margin-left: 13vh;
height: 3vh;
background-color: #663303;
}
#perspectiveGaucheBasse{
margin-top : 22vh;
-webkit-perspective: 0.1vh;
perspective: 0.1vw;
position: absolute;
width: 45vw;
perspective-origin: 50% 0%;
}
#rectangleHautGaucheB{
margin-top: 38vh;
margin-left: 28vh;
width: 15vw;
height: 0.25vh;
background-color: #854305;
-webkit-transform: rotateX(2deg);
transform: rotateX(2deg);
}
#rectangleBasGaucheB{
margin-top: 0.6vh;
width: 15.3vw;
margin-left: 27.75vh;
height: 3vh;
background-color: #663303;
}
#perspectiveDroite{
-webkit-perspective: 4vh;
perspective: 4wh;
position: absolute;
width: 39.6vw;
height: 2vh;
margin-top: 22vh;
perspective-origin: 200% 0%;
}
#rectangleHautDroitH{
margin-left: 125vh;
width: 28.7vw;
height: 2vh;
background-color: #854305;
-webkit-transform: rotateX(2deg);
transform: rotateX(2deg);
}
#rectangleBasDroitH{
width: 28.9vw;
margin-left: 124.8vh;
height: 3vh;
background-color: #663303;
}
#rectangleHautDroiteB{
margin-top: 32vh;
margin-left: 133vh;
width: 22vw;
height: 2vh;
background-color: #854305;
-webkit-transform: rotateX(2deg);
transform: rotateX(2deg);
}
#rectangleBasDroiteB{
margin-top: 0.2vh;
width: 22.18vw;
margin-left: 132.8vh;
height: 3vh;
background-color: #663303;
}
#perspectiveMilieu{
-webkit-perspective: 4vh;
perspective: 4wh;
position: absolute;
width: 39.6vw;
height: 2vh;
margin-top: 22vh;
perspective-origin: 130% 0%;
}
#rectangleHautMilieu{
margin-top: 21vh;
margin-left: 68.95vh;
width: 34.5vw;
height: 2vh;
background-color: #854305;
-webkit-transform: rotateX(2deg);
transform: rotateX(2deg);
}
#rectangleBasMilieu{
margin-top: 0.1vh;
width: 34.77vw;
margin-left: 68.7vh;
height: 3vh;
background-color: #663303;
}
.arrow1 {
position: absolute;
z-index: 3;
width: 50px;
height: 11px;
background: url('img/bullet.png') 43px 19px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>LEVEL 1</title>
<link rel="stylesheet" type="text/css" href="style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
</head>
<body>
<div id="fullbody">
<div id="perspectiveGauche">
<div id="rectangleHautGaucheH"></div>
<div id="rectangleBasGaucheH" class="collidableRectangle"></div>
</div>
<div id="perspectiveGaucheBasse">
<div id="rectangleHautGaucheB"></div>
<div id="rectangleBasGaucheB" class="collidableRectangle"></div>
</div>
<div id="perspectiveDroite">
<div id="rectangleHautDroitH"></div>
<div id="rectangleBasDroitH" class="collidableRectangle"></div>
<div id="rectangleHautDroiteB"></div>
<div id="rectangleBasDroiteB" class="collidableRectangle"></div>
</div>
<div id="perspectiveMilieu">
<div id="rectangleHautMilieu"></div>
<div id="rectangleBasMilieu" class="collidableRectangle"></div>
</div>
<div id="base"></div>
<div id="arrow1"></div>
<div id="floor"></div>
<span style="margin-left:50px;" id="result">false</span>
<div id="batman" class="dirGauche" style="left: 1100px; bottom: 580px;"></div>
<div id="chomel" class="dirGauche" style="left: 900px; bottom: 580px;"></div>
</div>
<script src="scripts/script.js" ></script>
</body>
</html>
@Soronbe你可以看到,我有完美的console.logs当蝙蝠侠被击中时,我希望他被推回50px的位置(我可以自己做),但当他被推,我想要移动它,在他再次移动之前,他会“冻结”一段时间。关于如何解决它的任何想法?
编辑:我只需要降低动画时间。现在我正在努力与蝙蝠侠做同样的事情。当我尝试这样做时,在拍摄时,它们都会移动。我还更新了脚本。
谢谢你的伴侣!