Discuss Scratch

MasterOskarYT
Scratcher
52 posts

Sprinting sprite

How do I make my sprite sprint? The sprint bar should be changing Full to Empty.
dogeiscut
Scratcher
500+ posts

Sprinting sprite

Project link please

peanut
Troyer_Kem
Scratcher
1000+ posts

Sprinting sprite

Oopsie, this is going to Help With Scripts

If you're seeing this account, I'm Morimop and the reason that I use this account is:

**I'm too lazy to switch accounts**
**I forget my password**
**I got a forum message while drawing something**
Troyer_Kem
Scratcher
1000+ posts

Sprinting sprite

MasterOskarYT wrote:

How do I make my sprite sprint? The sprint bar should be changing Full to Empty.
when green flag clicked
forever
wait until <<<touching [mouse pointer v] ?> and <mouse down?>>>
if <not <(Sprint) = [0]>> then
set [Sprinting? v] to [Yes]
end
wait until <<<touching [mouse pointer v] ?> and <mouse down?>>>
set [Sprinting? v] to [No]
when green flag clicked
forever
if <(Sprinting?) = [Yes]> then

change [Sprint v] by (-1)
wait (0.1) secs

else
change [Sprint v] by (1)
wait (0.5) secs
end
end
when green flag clicked
forever
if <(Sprinting?) = [Yes]> then
if <key [space v] pressed?> then
move (15) steps
wait (0.1) secs
move (10) steps
else
if <key [space v] pressed?> then
move (5) steps
end
end
end
when green flag clicked
show variable [Sprint Bar v]
forever
if <(Sprint) < [10]> then


set [Sprint Bar v] to [Empty]

else
set [Sprint Bar v] to [Full]
end
end

Last edited by Troyer_Kem (May 18, 2019 16:26:52)


If you're seeing this account, I'm Morimop and the reason that I use this account is:

**I'm too lazy to switch accounts**
**I forget my password**
**I got a forum message while drawing something**
MasterOskarYT
Scratcher
52 posts

Sprinting sprite

This post has been deleted!

Last edited by MasterOskarYT (May 18, 2019 08:59:42)

MasterOskarYT
Scratcher
52 posts

Sprinting sprite

But how I make it happen when I press in-game button? It should do it until you press it again!
Troyer_Kem
Scratcher
1000+ posts

Sprinting sprite

MasterOskarYT wrote:

But how I make it happen when I press in-game button? It should do it until you press it again!
I update, check it!

If you're seeing this account, I'm Morimop and the reason that I use this account is:

**I'm too lazy to switch accounts**
**I forget my password**
**I got a forum message while drawing something**
-Mar-Vell-
Scratcher
4 posts

Sprinting sprite

I'm sorry I'm late I am new to scratch can you tell me how to make my sprite sprint using keyboard buttons???

(sorry if my English grammar is bad, English is my second language)
soninjabwilliams
Scratcher
7 posts

Sprinting sprite

change x by (speed((speed) - (speed)))
—Note—
This does not work

Last edited by soninjabwilliams (June 7, 2021 21:12:22)

RiveneCodes
Scratcher
2 posts

Sprinting sprite

to be honest this is something im trying to figure out myself and i think the code is gonna be a bit long but without using velocity variables i created this method:

when green flag clicked
forever
if <> then
<key [ w<<> or <>><key [ up arrow] pressed?>] pressed?>
end
end
RiveneCodes
Scratcher
2 posts

Sprinting sprite

hmm i was just testing the image thing ok for real this is the code

When clicked
forever
if key“whatever you want” pressed
move 10 steps or change x right?

so you have your normal controls but if you want to make it sprint just say if key “any” pressed
move or change x or change y by any number it will make the sprite go faster if it does the same thing as the other key if you didnt understand copy this code:

although the thing about this simple method is you have to press 2 diffrent keys at the same time message me on here if you want hte complex Your text to link here…version\

Decaying_oldman
Scratcher
1 post

Sprinting sprite

gtlpfojoirjdppjpirpjigj when the imposter is sus
historical_supa
Scratcher
1000+ posts

Sprinting sprite

Decaying_oldman wrote:

gtlpfojoirjdppjpirpjigj when the imposter is sus
Please don't necropost.

i love life
TaPePolic
Scratcher
1 post

Sprinting sprite

indiaandrussia
Scratcher
16 posts

Sprinting sprite

when green flag clicked
forever
wait until <<touching [mouse pointer v] ?> and <mouse down?>>
if <not <(Sprint) = [0]>> then
set [Sprinting? v] to [Yes]
end
wait until <not<<touching [mouse pointer v] ?> and <mouse down?>>>//correction here
set [Sprinting? v] to [No]
hope this helps

Last edited by indiaandrussia (Aug. 30, 2023 17:19:43)

indiaandrussia
Scratcher
16 posts

Sprinting sprite

MasterOskarYT wrote:

But how I make it happen when I press in-game button? It should do it until you press it again!
when green flag clicked
forever
wait until <<touching [mouse pointer v] ?> and <mouse down?>>
wait until <not<<touching [mouse pointer v] ?> and <mouse down?>>>
set [Sprinting? v] to [Yes]//this can be used 1 step before if you want it to do before we remove our mouse
wait until <<touching [mouse pointer v] ?> and <mouse down?>>
wait until <not<<touching [mouse pointer v] ?> and <mouse down?>>>
set [Sprinting? v] to [No]//If you do that then you should do this or if you didn't do that then don't do this
hope this helps
GlitchEnterntainment
New to Scratch
1 post

Sprinting sprite

when green flag clicked
forever
if <> then
<key [ v] pressed?><<> and <>><key [ v] pressed?>
change x by ()
if <> then
<key [ v] pressed?>
if <> then
<not <>><key [<<> and <>><key [ v] pressed?> v] pressed?>
change x by ()
end
end
scratchclicky
Scratcher
1 post

Sprinting sprite

how to make a player have limited sprinting.

Powered by DjangoBB