Discuss Scratch

MrSuperGamer
Scratcher
32 posts

How do you make it not "lag" when you hold a button to make a thing move?

In my project Pong! (https://scratch.mit.edu/projects/167534320/) I want to make a two player paddle mode. Previously I used the mouse pointer but in this case it is different and i am having a problem

whenkeypressedchangeyby-7

but when i hold it, it moves a bit, then stops, then moves as normal. however, i want to stop the bit where it “lags” and stops to make the game more smooth. how would i go about doing this (sorry for basic SPaG)
MrSuperGamer
Scratcher
32 posts

How do you make it not "lag" when you hold a button to make a thing move?

i gtg and won't be able to reply for a few hours, but i will be grateful of any help you could give
Happysoul05
Scratcher
100+ posts

How do you make it not "lag" when you hold a button to make a thing move?

Do not use hate block use boolean.

whenclickedforeverifkeyup arrowpressed?thenchangeyby2

the hat gets activated when a button is pressed first time.
But boolean checks if it is pressed.
deck26
Scratcher
1000+ posts

How do you make it not "lag" when you hold a button to make a thing move?

What you're seeing is the way the hardware acts when you press and hold a key - it doesn't repeat immediately, there's a slight pause before you get a stream of that character. If you're pressing if the key is down that's a different thing - you're chcking for a physical condition so the way the keyboard buffer works doesn't affect things.
RokCoder
Scratcher
1000+ posts

How do you make it not "lag" when you hold a button to make a thing move?

deck26 wrote:

What you're seeing is the way the hardware acts when you press and hold a key - it doesn't repeat immediately, there's a slight pause before you get a stream of that character.

If you press and hold a key when editing text (email, notepad, word processor or whatever) you'll see this exact same effect.
MrSuperGamer
Scratcher
32 posts

How do you make it not "lag" when you hold a button to make a thing move?

Happysoul05 wrote:

Do not use hate block use boolean.

whenclickedforeverifkeyup arrowpressed?thenchangeyby2

the hat gets activated when a button is pressed first time.
But boolean checks if it is pressed.

Thx your suggestion really helped

deck26 wrote:

What you're seeing is the way the hardware acts when you press and hold a key - it doesn't repeat immediately, there's a slight pause before you get a stream of that character. If you're pressing if the key is down that's a different thing - you're chcking for a physical condition so the way the keyboard buffer works doesn't affect things.

i know that but i was asking because I know that other scratch games can manage to move a character held forward instantly without a pause

Powered by DjangoBB