Making Sprite go up on y axis

Game lab–My students and I have been trying to make a sprite go in a square/rectangle. We have the code for 3 of the sides but have tried numerous times to get it to finish the last leg. No success. Any advice is greatly appreciated. Here is the code we have so far:

background(“green”);
var corgi_1 = createSprite(5, 200);
corgi_1.setAnimation(“corgi_1”);
corgi_1.height = 50;
corgi_1.width = 70;
function draw() {
if (corgi_1.x < 215) {
corgi_1.x = corgi_1.x + 5;
}
if (corgi_1.x >= 215) {
corgi_1.y = corgi_1.y + 5;
}
if (corgi_1.y >= 315) {
corgi_1.x = corgi_1.x + 78654;
}
if (corgi_1.y > 300) {
corgi_1.x = corgi_1.x - 10;
}
if ((corgi_1.x) <= 25) {
corgi_1.x = corgi_1.x + 5;
}
drawSprites();
}
Thank you,
Marla

Here’s my attempt . . .

var corgi_1 = createSprite(10, 200);
corgi_1.setAnimation(“corgi_1”);
corgi_1.height = 50;
corgi_1.width = 70;
function draw() {
background(“white”);
if (corgi_1.x<250 && corgi_1.y==200) {
corgi_1.x = corgi_1.x + 5;
}
if (corgi_1.x==250 && corgi_1.y<350) {
corgi_1.y = corgi_1.y + 5;
}
if (corgi_1.x>10 && corgi_1.y==350) {
corgi_1.x = corgi_1.x - 5;
}
if (corgi_1.x==10 && corgi_1.y<=350) {
corgi_1.y = corgi_1.y - 5;
}
drawSprites();
}

Marla,

Lana answered - but is that what you’re looking for? Lana used complex conditionals (&&) to make it so when true conditions are true - in this case an x and y value - it would execute the code.

Hope that helps and thank you @lana.shea!

Brad