# Why does it get stuck 'up'

**URL:** <https://discourse.processing.org/t/why-does-it-get-stuck-up/43707>\
**Category:** Coding Questions\
**Created:** [January 17, 2024, 4:18pm UTC](https://discourse.processing.org/t/why-does-it-get-stuck-up/43707 "2024-01-17T16:18:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![WillyGrz](https://avatars.discourse-cdn.com/v4/letter/w/c77e96/32.png) [@WillyGrz](https://discourse.processing.org/u/WillyGrz)\
**Post date:** [January 17, 2024, 4:18pm UTC](https://discourse.processing.org/t/why-does-it-get-stuck-up/43707/1 "2024-01-17T16:18:05Z")

</div>

Trying to make a SUPER _rudamentary_ Geometry dash. When I jump though, it stays up. i don’t know why.

float playerY;  
float truePY;  
boolean playerJump;  
boolean cube;  
boolean ship;

void setup() {  
fullScreen();  
playerY = height_11/15;  
truePY = (height_11/15)+height/17;  
cube = true;  
ship = false;  
playerJump = false;

// COPY EVERYWHERE:

background(65, 45, 250);  
stroke(54, 40, 188);  
strokeWeight(width/100);  
fill(39, 28, 152);  
rectMode(CORNER);  
rect(-width/50, height_4/5, width+width/50, height+height/50);  
line(width/7, height_4/5, width/7, height);  
line(width/7, (height_4/5)+width/15, width/3, (height_4/5)+width/15);  
line(width/3, height_4/5, width/3, height);  
line(width/3+width/13, height_4/5, width/3+width/13, height);  
line(width/3+width/6.5, height_4/5, width/3+width/6.5, height);  
line(width/2+width/7, height_4/5, width/2+width/7, height);  
line(width/2+width/7, (height_4/5)+width/15, width/2+width/3, (height_4/5)+width/15);  
line(width/2+width/3, height_4/5, width/2+width/3, height);  
line(width/2+width/3+width/13, height_4/5, width/2+width/3+width/13, height);  
line(width/2+width/3+width/6.5, height\*4/5, width/2+width/3+width/6.5, height);  
rectMode(CENTER);  
fill(246, 255, 3);  
stroke(3, 255, 21);  
strokeWeight(5);  
square(width/6, playerY, width/16);

}  
void draw() {

// COPY EVERYWHERE!!!

background(65, 45, 250);  
stroke(54, 40, 188);  
strokeWeight(width/100);  
fill(39, 28, 152);  
rectMode(CORNER);  
rect(-width/50, height_4/5, width+width/50, height+height/50);  
line(width/7, height_4/5, width/7, height);  
line(width/7, (height_4/5)+width/15, width/3, (height_4/5)+width/15);  
line(width/3, height_4/5, width/3, height);  
line(width/3+width/13, height_4/5, width/3+width/13, height);  
line(width/3+width/6.5, height_4/5, width/3+width/6.5, height);  
line(width/2+width/7, height_4/5, width/2+width/7, height);  
line(width/2+width/7, (height_4/5)+width/15, width/2+width/3, (height_4/5)+width/15);  
line(width/2+width/3, height_4/5, width/2+width/3, height);  
line(width/2+width/3+width/13, height_4/5, width/2+width/3+width/13, height);  
line(width/2+width/3+width/6.5, height\*4/5, width/2+width/3+width/6.5, height);  
rectMode(CENTER);  
fill(246, 255, 3);  
stroke(3, 255, 21);  
strokeWeight(5);  
square(width/6, playerY, width/16);  
line(width, truePY, 0, truePY);

if (keyPressed); {  
if(keyCode == 32 || keyCode == 38 || keyCode == 40) {  
if (cube == true) {  
playerJump = true;  
}  
}  
}

if (playerY \<= truePY - width/6 && playerJump == true) {  
playerJump = false;  
}

if (playerJump == true) {  
playerY = playerY - width/100;  
} else {  
playerY = playerY + width/100;  
}

if (playerY \>= truePY - width/32) {  
playerY = truePY - width/32;  
}  
}

---

<div class="post-metadata">

**Author:** ![WillyGrz](https://avatars.discourse-cdn.com/v4/letter/w/c77e96/32.png) [@WillyGrz](https://discourse.processing.org/u/WillyGrz)\
**Post date:** [January 17, 2024, 4:18pm UTC](https://discourse.processing.org/t/why-does-it-get-stuck-up/43707/2 "2024-01-17T16:18:36Z")

</div>

Ignore the “// COPY EVERYWHERE”

---

<div class="post-metadata">

**Author:** ![scudly](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/scudly/32/5597_2.png) [@scudly](https://discourse.processing.org/u/scudly)\
**Post date:** [January 17, 2024, 5:17pm UTC](https://discourse.processing.org/t/why-does-it-get-stuck-up/43707/3 "2024-01-17T17:17:26Z")

</div>

`if (keyPressed); {` should not have a `;` in the middle of it.

---

<div class="post-metadata">

**Author:** ![WillyGrz](https://avatars.discourse-cdn.com/v4/letter/w/c77e96/32.png) [@WillyGrz](https://discourse.processing.org/u/WillyGrz)\
**Post date:** [January 17, 2024, 5:25pm UTC](https://discourse.processing.org/t/why-does-it-get-stuck-up/43707/4 "2024-01-17T17:25:38Z")

</div>

I tried removing it, but when I did nothing moved at all

---

<div class="post-metadata">

**Author:** ![WillyGrz](https://avatars.discourse-cdn.com/v4/letter/w/c77e96/32.png) [@WillyGrz](https://discourse.processing.org/u/WillyGrz)\
**Post date:** [January 17, 2024, 5:26pm UTC](https://discourse.processing.org/t/why-does-it-get-stuck-up/43707/5 "2024-01-17T17:26:17Z")

</div>

Wait nevermind the spacebar just didnt work when i removed it. Thank you!
