Discuss Scratch

F4LL0U7
Scratcher
4 posts

Unintended infinite jump?

I am working on my platformer game engine, and with my jumping / Y velocity script, it keeps allowing infinite jumps. I have tried many things to try and fix this, but none of them work.

THE CODE IS:
if up arrow key pressed
repeat until touching color (yellow) or touching color (black) or not up arrow key pressed
set Yv to 12
repeat until Yv = 0
change Yv by -1
repeat until touching color (black)
change Yv by -1

Does anyone know how to fix this? The project link is https://scratch.mit.edu/projects/115591312 if anyone needs to see it for further information.
Thanks.

- F4LL0U7
Greatguy123
Scratcher
500+ posts

Unintended infinite jump?

Your script is a bit weird. I don't think it's doing what you think it's doing. I would suggest looking through it more carefully. Maybe this script will do what you want:
whenup arrowkeypressedsetYvto12repeatuntiltouchingcolorortouchingcolorchangeYvby-1setYvto0
Methanatos
Scratcher
100+ posts

Unintended infinite jump?

The apple should only jump if it's touching yellow or black and if its y velocity is 0 (stopped) or negative (falling). If the apple is touching yellow or black but it is rising, then it has hit a ceiling and should stop rising/start falling.

F4LL0U7
Scratcher
4 posts

Unintended infinite jump?

Greatguy123 wrote:

Your script is a bit weird. I don't think it's doing what you think it's doing. I would suggest looking through it more carefully. Maybe this script will do what you want:
whenup arrowkeypressedsetYvto12repeatuntiltouchingcolorortouchingcolorchangeYvby-1setYvto0

It still didn't solve my issue, but it did make the jump quite smoother. I need a way to get it to not be able to double jump…

EDIT: It did actually, there was something added onto my script which made it a bit weird (the not pressed block). Thanks

Last edited by F4LL0U7 (July 6, 2016 05:05:46)

Tenzinmishti_test
Scratcher
27 posts

Unintended infinite jump?

I have an infinite jump problem in https://scratch.mit.edu/projects/145863636/. Here is my code:
whenclickedforeverifnotMovementtype=DeadtheniftouchingLevel?andnottouchingcolor?thensetmidair?to0setyto0ifnottouchingLevel?orkeyup arrowpressed?andmidair?=0andnottouchingcolor?thensetyto10ifkeyup arrowpressed?andnotMovementtype=Fallandmidair?=0thenplaysound05_jump.aifsetmidair?to1repeat5changeyby-10setmidair?to0
NOTE: The project that this code comes from SCROLLS.
asivi
Scratcher
1000+ posts

Unintended infinite jump?

Tenzinmishti_test wrote:

I have an infinite jump problem.
Please start creating your own topic and give details about what is the problem with.
Tenzinmishti_test
Scratcher
27 posts

Unintended infinite jump?

asivi wrote:

Tenzinmishti_test wrote:

I have an infinite jump problem.
Please start creating your own topic and give details about what is the problem with.
?
Plumjet09
New Scratcher
1 post

Unintended infinite jump?

yeah same
chegamer902
Scratcher
6 posts

Unintended infinite jump?

this script allows infinite jumps. does anyone know a fix because I need it to allow only one jump at a time?
when spacekeypressedrepeat5changexby5foreverifnottouching ground?thenchangexby-10

Last edited by chegamer902 (Aug. 17, 2021 17:33:48)

amazingscratchcoder
Scratcher
100+ posts

Unintended infinite jump?

Op was on 2016. Pls read guidelines before posting and don’t necropost
chegamer902
Scratcher
6 posts

Unintended infinite jump?

amazingscratchcoder wrote:

Op was on 2016. Pls read guidelines before posting and don’t necropost
what do you mean
orangetheory
Scratcher
500+ posts

Unintended infinite jump?

chegamer902 wrote:

amazingscratchcoder wrote:

Op was on 2016. Pls read guidelines before posting and don’t necropost
what do you mean

chegamer902 wrote:

this script allows infinite jumps. does anyone know a fix because I need it to allow only one jump at a time?
when spacekeypressedrepeat5changexby5foreverifnottouching ground?thenchangexby-10

Plumjet09 wrote:

yeah same

Tenzinmishti_test wrote:

I have an infinite jump problem in https://scratch.mit.edu/projects/145863636/. Here is my code:

NOTE: The project that this code comes from SCROLLS.
Necroposting is when post on an old topic or posting something irrelevent to the OP (original post.) If you want to get help please make your own topic. Thank you.
Paddle2See
Scratch Team
1000+ posts

Unintended infinite jump?

chegamer902 wrote:

amazingscratchcoder wrote:

Op was on 2016. Pls read guidelines before posting and don’t necropost
what do you mean
What they are saying is that it is best to make a new topic in this area rather than reviving an old dead topic. It's easier to follow the discussion and doesn't send annoying notifications to the person that originally started the topic.

Powered by DjangoBB