I need help with this code

My student would want the planes to crash and an explosion appear if the planes come in contact. This is his code. Any help is very much appreciated!

var backround = createSprite(200, 200);
backround.setAnimation(“desk_1”);
var spotlight = createSprite(0, 200);
spotlight.setAnimation(“spotlight”);
spotlight.visible = false;
var gift = createSprite(125, 202);
gift.setAnimation(“xmasemoji_12_1”);
gift.scale = 0.3;
var laptop = createSprite(125, -100);
laptop.setAnimation(“laptop_2”);
laptop.scale = 0.3;
var game = createSprite(200, 200);
game.setAnimation(“background_landscape07_1”);
game.visible = false;
var plane = createSprite(0, 200);
plane.setAnimation(“planeGreen1”);
plane.visible = false;
var red = createSprite(512, randomNumber(20, 390));
red.setAnimation(“planeRed”);
red.visible = false;
var red2 = createSprite(-40, randomNumber(20, 390));
red2.setAnimation(“planeRed2”);
red2.visible = false;
var red3 = createSprite(490, randomNumber(20, 390));
red3.setAnimation(“planeRed3”);
red3.visible = false;
function draw() {
if (mousePressedOver(gift)) {
laptop.y = laptop.y + 2;
gift.setAnimation(“open”);
gift.scale = 1;
gift.x = 50;
gift.y = 214;
spotlight.visible = true;
spotlight.x = 200;
spotlight.y = 66;
}
if (laptop.y >= -98) {
laptop.y = laptop.y + 2;
}
if (laptop.y >= 216) {
laptop.y = 216;
}
if (mousePressedOver(laptop)) {
laptop.visible = false;
gift.visible = false;
backround.visible = false;
game.visible = true;
plane.visible = true;
red.visible = true;
red2.visible = true;
red3.visible = true;
}
if (keyDown(“right”)) {
plane.x = plane.x + 3;
plane.setAnimation(“planeGreen1”);
}
if (keyDown(“left”)) {
plane.x = plane.x - 3;
plane.setAnimation(“left”);
}
if (keyDown(“up”)) {
plane.y = plane.y - 3;
plane.setAnimation(“up”);
}
if (keyDown(“down”)) {
plane.y = plane.y + 3;
plane.setAnimation(“down”);
}
if (keyDown(“up”) && keyDown(“right”)) {
plane.setAnimation(“ne”);
}
if (keyDown(“right”) && keyDown(“down”)) {
plane.setAnimation(“ew”);
}
if (keyDown(“left”) && keyDown(“up”)) {
plane.setAnimation(“leftup”);
}
if (keyDown(“left”) && keyDown(“down”)) {
plane.setAnimation(“leftdown”);
}
if (plane.y > 369) {
plane.setAnimation(“explosion”);
plane.scale = 0.4;
}
if ((keyWentDown(“up”) || keyWentDown(“down”)) || (keyWentDown(“left”) || keyWentDown(“right”))) {
red.x = red.x - 3;
}
if (red.x <= 510) {
red.x = red.x - 2;
red3.x = red3.x - 5;
red2.x = red2.x + 7;
}
if (plane.x == (((red.x - 41.5) <= plane.x && red.x + 41.5 >= plane.x) && ((red.y - 35) <= plane.y && red.y + 35 >= plane.y))) {
plane.setAnimation(“explosion”);
plane.x = 0.4;
}
drawSprites();
}

This is probably where you need to focus. Have you considered using the sprite.isTouching(target) block? It might be easier to use in this case.

if(plane.isTouching(red)){
   plane.setAnimation(“explosion”);
   plane.x = 0.4;
}

Thank you!! Very much appreciated. I will try it today.