Discuss Scratch

Sonic2HD
Scratcher
16 posts

Moving Sprites using keys

I made a script with a stand sprite,run sprite,jump sprite and a block sprite. I made a script which made it move with the run sprite with right arrow key but when I did it with left key,it started to move with the stand sprite. Is this a glitch or a problem or something like that? The Scratch Team could be able to sort this. Please do so!

Last edited by Sonic2HD (Nov. 8, 2013 22:19:19)



sonicfan12p
Scratcher
1000+ posts

Moving Sprites using keys

I assume you mean running costume? You don't need multiple sprites for animations like that. Also, could you share and link to your project?

Comeback time? Maybe?
KermitMC
Scratcher
100+ posts

Moving Sprites using keys

Can i please see your project,
I most likely will be able to help you.

Sonic2HD
Scratcher
16 posts

Moving Sprites using keys

The link is http://scratch.mit.edu/projects/14082682/ Check it and it will move while standing

Last edited by Sonic2HD (Nov. 8, 2013 22:23:18)



KermitMC
Scratcher
100+ posts

Moving Sprites using keys

Move your three switch costume to sonic up by one

KermitMC
Scratcher
100+ posts

Moving Sprites using keys

You know,
so they are inside the if statement not outside it.

Sonic2HD
Scratcher
16 posts

Moving Sprites using keys

Doesn't work


KermitMC
Scratcher
100+ posts

Moving Sprites using keys

It worked when I moved them up.

Sonic2HD
Scratcher
16 posts

Moving Sprites using keys

Are you doing opposite? It seems it is moving while standing to me. It's meant to be running


KermitMC
Scratcher
100+ posts

Moving Sprites using keys

You forgot to move the one for jumping

KermitMC
Scratcher
100+ posts

Moving Sprites using keys

also i just noticed this only fixes the jumping sry.
use this code for the movement
when gf clicked
forever
if (key pressed [right v])
repeat until <not (key pressed [right v])>
switch to costume [run1]
wait (0.05) secs
switch to costume [run2]
wait (0.05) secs
end
switch to costume [stand]
make this separate to your running script

Last edited by KermitMC (Nov. 8, 2013 22:44:31)


Sonic2HD
Scratcher
16 posts

Moving Sprites using keys

How do you even post in blocks?


sonicfan12p
Scratcher
1000+ posts

Moving Sprites using keys

KermitMC wrote:

also i just noticed this only fixes the jumping sry.
use this code for the movement
when gf clicked
forever
if <key [right arrow v] pressed?>
repeat until <not <key [right arrow v] pressed?>>
switch to costume [run1]
wait (0.05) secs
switch to costume [run2]
wait (0.05) secs
end
switch to costume [stand]
make this separate to your running script
Fixed scratchblocks.

Edit: You got it! And you can code in scratchblocks by using these tags.
[scratchblocks]
when gf clicked
say [Scratchblocks are awesome!] for [5] secs
set [Awesomeness v] to [Awesome]
[/scratchblocks]
That turns into this, and you can test the blocks here!
when gf clicked
forever
say [Scratchblocks are awesome!] for [5] secs
set [Awesomeness v] to [Awesome]
end

Last edited by sonicfan12p (Nov. 8, 2013 22:52:30)


Comeback time? Maybe?
JDY9
Scratcher
17 posts

Moving Sprites using keys

Try this script:
when green flag clicked
forever

if <up arrow> then

point in direction (0 v)
move () steps
end
if <key [left arrow v] pressed?> then

point in direction (-90 v)
move () steps
end
if <key [right arrow v] pressed?> then

point in direction (90 v)
move () steps
end
if <key [down arrow v] pressed?> then
point in direction (180 v)
move () steps

end
end

Last edited by JDY9 (May 3, 2014 05:49:36)

Powered by DjangoBB