Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How do I make diagonal walking scripts?
- UnlimitedJokinha
-
100+ posts
How do I make diagonal walking scripts?
BEFORE ANYTHING:I'M NOT MAKING A GAME,I JUST WANT TO KNOW :D
So let's say I have a sprite,and it points in all 8 directions(north,northeast,east,southeast,south,southwest,west and northwest).
I was trying to make a walking script for all 8 directions.
I already knew how to make one for up,down,left and right,but when I tried to make the diagonal ones,for some reason only the southwest sprites were right,and all other diagonal sprites weren't showing…
I tried it with both
and
But none of them worked…
(OBS.:the “dir” variable above is used because the sprite has an idle animation that is the same as the walking,so instead of using a sprite changing script and bugging the animation,I used this variable,so that when dir is set to number,it points to direction number° and loops the costumes number and number)
Before you answer anything,I used
(oh,and by the way,another thing is that when i used the second scripts,the sprite for some reason didn't move up and down and the diagonal scripts started bugging,i dunno)
So basically I can't make diagonal walking scripts,but I want to,so i just came here and asked it
P.S.:I'm dumb.
So let's say I have a sprite,and it points in all 8 directions(north,northeast,east,southeast,south,southwest,west and northwest).
I was trying to make a walking script for all 8 directions.
I already knew how to make one for up,down,left and right,but when I tried to make the diagonal ones,for some reason only the southwest sprites were right,and all other diagonal sprites weren't showing…
I tried it with both
if <<key [right arrow v] pressed?> and <key [down arrow v] pressed?>> then
set [dir v] to [?]
end
and
when [right arrow v] key pressed
set [dir v] to [?]
if <key [down arrow v] pressed?> then
set [dir v] to [?]
end
But none of them worked…
(OBS.:the “dir” variable above is used because the sprite has an idle animation that is the same as the walking,so instead of using a sprite changing script and bugging the animation,I used this variable,so that when dir is set to number,it points to direction number° and loops the costumes number and number)
Before you answer anything,I used
change x by (10)blocks and stuff,I just didn't put it on the scripts because I'm lazy
(oh,and by the way,another thing is that when i used the second scripts,the sprite for some reason didn't move up and down and the diagonal scripts started bugging,i dunno)
So basically I can't make diagonal walking scripts,but I want to,so i just came here and asked it
when green flag clicked
repeat until <[someone v] answers>
hit head on wall
end
P.S.:I'm dumb.
- powercon5
-
1000+ posts
How do I make diagonal walking scripts?
could you be more clear on what you mean?
- asivi
-
1000+ posts
How do I make diagonal walking scripts?
BEFORE ANYTHING:I'M NOT MAKING A GAME,I JUST WANT TO KNOW :DHi, i'm lazy too(and lot of others scratchers)
So let's say I have a sprite,and it points in all 8 directions(north,northeast,east,southeast,south,southwest,west and northwest).
I was trying to make a walking script for all 8 directions.
I already knew how to make one for up,down,left and right,but when I tried to make the diagonal ones,for some reason only the southwest sprites were right,and all other diagonal sprites weren't showing…
I tried it with bothif <<key [right arrow v] pressed?> and <key [down arrow v] pressed?>> then
set [dir v] to [?]
end
andwhen [right arrow v] key pressed
set [dir v] to [?]
if <key [down arrow v] pressed?> then
set [dir v] to [?]
end
But none of them worked…
(OBS.:the “dir” variable above is used because the sprite has an idle animation that is the same as the walking,so instead of using a sprite changing script and bugging the animation,I used this variable,so that when dir is set to number,it points to direction number° and loops the costumes number and number)
Before you answer anything,I usedchange x by (10)blocks and stuff,I just didn't put it on the scripts because I'm lazy
(oh,and by the way,another thing is that when i used the second scripts,the sprite for some reason didn't move up and down and the diagonal scripts started bugging,i dunno)
So basically I can't make diagonal walking scripts,but I want to,so i just came here and asked itwhen green flag clicked
repeat until <[someone v] answers>
hit head on wall
end
P.S.:I'm dumb.
So, what do you think we could do?
- footsocktoe
-
1000+ posts
How do I make diagonal walking scripts?
BEFORE ANYTHING:I'M NOT MAKING A GAME,I JUST WANT TO KNOW :D
So let's say I have a sprite,and it points in all 8 directions(north,northeast,east,southeast,south,southwest,west and northwest).
I was trying to make a walking script for all 8 directions.
I already knew how to make one for up,down,left and right,but when I tried to make the diagonal ones,for some reason only the southwest sprites were right,and all other diagonal sprites weren't showing…
I tried it with bothif <<key [right arrow v] pressed?> and <key [down arrow v] pressed?>> then
set [dir v] to [?]
end
andwhen [right arrow v] key pressed
set [dir v] to [?]
if <key [down arrow v] pressed?> then
set [dir v] to [?]
end
But none of them worked…
(OBS.:the “dir” variable above is used because the sprite has an idle animation that is the same as the walking,so instead of using a sprite changing script and bugging the animation,I used this variable,so that when dir is set to number,it points to direction number° and loops the costumes number and number)
Before you answer anything,I usedchange x by (10)blocks and stuff,I just didn't put it on the scripts because I'm lazy
(oh,and by the way,another thing is that when i used the second scripts,the sprite for some reason didn't move up and down and the diagonal scripts started bugging,i dunno)
So basically I can't make diagonal walking scripts,but I want to,so i just came here and asked itwhen green flag clicked
repeat until <[someone v] answers>
hit head on wall
end
P.S.:I'm dumb.
If you use direction blocks, then don't use change x blocks, use move blocks. x is a direction so it won't work to combine it with change direction. Move is not a direction. It moves the sprite in any direction.
- TheGamer1144
-
12 posts
How do I make diagonal walking scripts?
Point your sprite diagonally.
Make a script to move*.
*Do this:
Make a script to move*.
*Do this:
when green flag clicked
if <key [space v] pressed?> then
move (25) steps
end
- UnlimitedJokinha
-
100+ posts
How do I make diagonal walking scripts?
BEFORE ANYTHING:I'M NOT MAKING A GAME,I JUST WANT TO KNOW :D
So let's say I have a sprite,and it points in all 8 directions(north,northeast,east,southeast,south,southwest,west and northwest).
I was trying to make a walking script for all 8 directions.
I already knew how to make one for up,down,left and right,but when I tried to make the diagonal ones,for some reason only the southwest sprites were right,and all other diagonal sprites weren't showing…
I tried it with bothif <<key [right arrow v] pressed?> and <key [down arrow v] pressed?>> then
set [dir v] to [?]
end
andwhen [right arrow v] key pressed
set [dir v] to [?]
if <key [down arrow v] pressed?> then
set [dir v] to [?]
end
But none of them worked…
(OBS.:the “dir” variable above is used because the sprite has an idle animation that is the same as the walking,so instead of using a sprite changing script and bugging the animation,I used this variable,so that when dir is set to number,it points to direction number° and loops the costumes number and number)
Before you answer anything,I usedchange x by (10)blocks and stuff,I just didn't put it on the scripts because I'm lazy
(oh,and by the way,another thing is that when i used the second scripts,the sprite for some reason didn't move up and down and the diagonal scripts started bugging,i dunno)
So basically I can't make diagonal walking scripts,but I want to,so i just came here and asked itwhen green flag clicked
repeat until <[someone v] answers>
hit head on wall
end
P.S.:I'm dumb.
If you use direction blocks, then don't use change x blocks, use move blocks. x is a direction so it won't work to combine it with change direction. Move is not a direction. It moves the sprite in any direction.
Thanks,I'll try that.
I tried that,and the walking part works,but it stills only points to the southwest when pointing diagonally
Last edited by UnlimitedJokinha (May 2, 2017 23:15:53)
- asivi
-
1000+ posts
How do I make diagonal walking scripts?
Hi, test https://scratch.mit.edu/projects/136951941/
Works for you?
Works for you?
- UnlimitedJokinha
-
100+ posts
How do I make diagonal walking scripts?
https://scratch.mit.edu/projects/136951941/Hi, test
Works for you?
Yes,why?
Do you want me to copy the scripts or somethin'?
- asivi
-
1000+ posts
How do I make diagonal walking scripts?
I don't want anything from you bb.
Good luck.
Good luck.
Last edited by asivi (May 3, 2017 09:12:01)
- Discussion Forums
- » Help with Scripts
-
» How do I make diagonal walking scripts?