Discuss Scratch
- Discussion Forums
- » Bugs and Glitches
- » Mysterious Input Problems
- Connor-Hayes
- Scratcher
40 posts
Mysterious Input Problems
My browser / operating system: IPad iOS 17.2, ChromeiOS 123.0.6312.52, No Flash version detected
So I’ve been working on this scrolling tile map project. (Link: https://scratch.mit.edu/projects/991697687/) Basically, the collisions were jerky, b/c you could see the system compensating for the wall. So, naturally, I turned it to Run Without Screen Refresh… and it went BONKERS. It’s actually ridiculous. This is the only change I have made, and now the system a) freezes up for a second, b) teleports my character about 40 tiles away, and c) THINKS THE RIGHT ARROW KEY IS BEING PRESSED WHEN IT’S NOT BEING PRESSED! It’s like Scratch is possessed or something lol.
So I’ve been working on this scrolling tile map project. (Link: https://scratch.mit.edu/projects/991697687/) Basically, the collisions were jerky, b/c you could see the system compensating for the wall. So, naturally, I turned it to Run Without Screen Refresh… and it went BONKERS. It’s actually ridiculous. This is the only change I have made, and now the system a) freezes up for a second, b) teleports my character about 40 tiles away, and c) THINKS THE RIGHT ARROW KEY IS BEING PRESSED WHEN IT’S NOT BEING PRESSED! It’s like Scratch is possessed or something lol.
Last edited by Connor-Hayes (March 30, 2024 12:44:29)
Hello, I’m Connor-Hayes.
Please check me out- I’m currently running a shop (prices listed below) and would be happy to chat with you.
I make games.
Insert funny ending here.
1 Love/Fav = Intro, PFP, or Banner
2 Loves/Faves = Specially Designed Engine (Text, RPG, etc.)
1 Follow = 1 PFP, Intro, and Banner OR 1 Animation OR any special request
Free = Any code, debugging, playtesting
- Connor-Hayes
- Scratcher
40 posts
Mysterious Input Problems
Plz help
Hello, I’m Connor-Hayes.
Please check me out- I’m currently running a shop (prices listed below) and would be happy to chat with you.
I make games.
Insert funny ending here.
1 Love/Fav = Intro, PFP, or Banner
2 Loves/Faves = Specially Designed Engine (Text, RPG, etc.)
1 Follow = 1 PFP, Intro, and Banner OR 1 Animation OR any special request
Free = Any code, debugging, playtesting
- Maximouse
- Scratcher
1000+ posts
Mysterious Input Problems
Run without screen refresh doesn't just make the block run faster – it prevents any other code from running until that block finished. In your project, this has the following consequences:
- Keyboard input (releasing the right arrow key) can't be detected.
- Tiles aren't redrawn when changing Character X, so “touching color black” will always return false.
- Maximouse
- Scratcher
1000+ posts
Mysterious Input Problems
The following code should work:
To avoid the first problem mentioned above, I moved the loop that waits for the arrow key to be released out of the custom block. To fix the second problem, I used “change x” instead of “change Character X” to move the character and not the tiles. After finding the distance needed to move the character out of the wall, the “Character X” variable is updated and the x position is reset.
when [right arrow v] key pressed
repeat until <not <key [right arrow v] pressed?>>
change [Character X v] by (10)
Move [R]
end
define Move [input]
if <(input) = [R]> then
repeat until <not <touching color [#000]?>>
change x by (-1)
end
change [Character X v] by (x position)
set x to (0)
else
...
end
To avoid the first problem mentioned above, I moved the loop that waits for the arrow key to be released out of the custom block. To fix the second problem, I used “change x” instead of “change Character X” to move the character and not the tiles. After finding the distance needed to move the character out of the wall, the “Character X” variable is updated and the x position is reset.
- Connor-Hayes
- Scratcher
40 posts
Mysterious Input Problems
Wow, that was…amazingly comprehensive and helpful. Thanks!!
(*me being astonished that I spelled comprehensive correctly*)
(*me realizing it was autocorrect*)
(*me crying in the bathroom*)
XD
(*me being astonished that I spelled comprehensive correctly*)
(*me realizing it was autocorrect*)
(*me crying in the bathroom*)
XD
Hello, I’m Connor-Hayes.
Please check me out- I’m currently running a shop (prices listed below) and would be happy to chat with you.
I make games.
Insert funny ending here.
1 Love/Fav = Intro, PFP, or Banner
2 Loves/Faves = Specially Designed Engine (Text, RPG, etc.)
1 Follow = 1 PFP, Intro, and Banner OR 1 Animation OR any special request
Free = Any code, debugging, playtesting
- Discussion Forums
- » Bugs and Glitches
- » Mysterious Input Problems