This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2009-05-07 08:27:49

Test_Guardian
Scratcher
Registered: 2009-02-16
Posts: 30

4-way directional characters?

sry but im trying to create a character that walks in an environment. i wonder what are the best scripts that are used to make it.

sry if this has already been asked..
Im lookin for block commands not suggestions on finding the commands. any bit that i havent mentioned would help..

Last edited by Test_Guardian (2009-05-07 08:33:15)

Offline

 

#2 2009-05-07 08:32:22

ScratchX
Scratcher
Registered: 2009-05-05
Posts: 1000+

Re: 4-way directional characters?

Thats ok..heres how to make it walk
<when[ right arrow ]key pressed>
<move(10)steps>

Repeat this for left but make the steps -10

now for up and down

<when[ up]key pressed>
<change y by( 10)

Now repeat this again for down and make the 10 a -10


Happy New Year!
http://i45.tinypic.com/1nyasi.pnghttp://i50.tinypic.com/219pez8.pnghttp://i49.tinypic.com/e5s4zr.pnghttp://i48.tinypic.com/23l18hf.jpghttp://i49.tinypic.com/66zymu.png

Offline

 

#3 2009-05-07 08:45:01

Test_Guardian
Scratcher
Registered: 2009-02-16
Posts: 30

Re: 4-way directional characters?

i figured this one but the character looks wrong.. sry...

Offline

 

#4 2009-05-07 08:53:58

yambanshee
Scratcher
Registered: 2007-11-06
Posts: 500+

Re: 4-way directional characters?

yep, never use the block heads for movment

use a forever loop with the if statements inside them

Offline

 

#5 2009-05-07 09:27:56

Dibbo222
Scratcher
Registered: 2007-11-03
Posts: 100+

Re: 4-way directional characters?

yambanshee wrote:

yep, never use the block heads for movment

use a forever loop with the if statements inside them

yep definitely, this is the above shown:

<when green flag clicked>
<forever>
   <if><key[ right ]pressed?>
   <change x by( 5 )>
   <end>
   <if><key[ left ]pressed?>
   <change x by( -5 )>
   <end>
   <if><key[ up ]pressed?>
   <change y by( 5 )>
   <end>
   <if><key[ down ]pressed?>
   <change y by( -5 )>
   <end>
<end>


The biggest tower defense game on Scratch?
http://scratch.mit.edu/projects/Dibbo222/929092

Offline

 

#6 2009-05-07 13:30:44

pokemon_master12
Scratcher
Registered: 2008-09-26
Posts: 100+

Re: 4-way directional characters?

Dibbo222 wrote:

yambanshee wrote:

yep, never use the block heads for movment

use a forever loop with the if statements inside them

yep definitely, this is the above shown:

<when green flag clicked>
<forever>
   <if><key[ right ]pressed?>
   <change x by( 5 )>
   <end>
   <if><key[ left ]pressed?>
   <change x by( -5 )>
   <end>
   <if><key[ up ]pressed?>
   <change y by( 5 )>
   <end>
   <if><key[ down ]pressed?>
   <change y by( -5 )>
   <end>
<end>

Or there is a "forever if" block, which is a "forever" block and an "if" block all in one. It keeps checking if the script is true all the way through the project, whereas if you put an "if" block inside a "forever" block, it may mean that once you've pressed the right arrow, the sprite will keep moving forever. In other words, until you press the stop button.  wink


My Dragon Egg! http://dragcave.net/image/5YUA.gif
Visit my blog: http://freyasworld.wordpress.com/

Offline

 

#7 2009-05-07 16:06:18

D97
Scratcher
Registered: 2007-12-22
Posts: 100+

Re: 4-way directional characters?

pokemon_master12 wrote:

Or there is a "forever if" block, which is a "forever" block and an "if" block all in one. It keeps checking if the script is true all the way through the project, whereas if you put an "if" block inside a "forever" block, it may mean that once you've pressed the right arrow, the sprite will keep moving forever. In other words, until you press the stop button.  wink

It doesn't do that.


Yes, I am still alive, and no, I am not GLADOS.
Join Sayonara, my Scratch games company!

Offline

 

#8 2009-05-07 17:53:46

keroro645
Scratcher
Registered: 2008-06-07
Posts: 1000+

Re: 4-way directional characters?

Pokeman_master645 wrote:

Or there is a "forever if" block, which is a "forever" block and an "if" block all in one. It keeps checking if the script is true all the way through the project, whereas if you put an "if" block inside a "forever" block, it may mean that once you've pressed the right arrow, the sprite will keep moving forever. In other words, until you press the stop button.  wink

Actually no. It doesn't need that, it does not keep on forever, maybe you should test this out?

Last edited by keroro645 (2009-05-07 17:54:30)

Offline

 

#9 2009-05-07 18:32:48

bhz
Scratcher
Registered: 2008-07-06
Posts: 100+

Re: 4-way directional characters?

keroro645 wrote:

Pokeman_master645 wrote:

Or there is a "forever if" block, which is a "forever" block and an "if" block all in one. It keeps checking if the script is true all the way through the project, whereas if you put an "if" block inside a "forever" block, it may mean that once you've pressed the right arrow, the sprite will keep moving forever. In other words, until you press the stop button.  wink

Actually no. It doesn't need that, it does not keep on forever, maybe you should test this out?

http://scratch.mit.edu/projects/bhz/517354

Last edited by bhz (2009-05-07 18:34:44)

Offline

 

#10 2009-05-07 19:06:27

DawnLight
Scratcher
Registered: 2009-04-25
Posts: 500+

Re: 4-way directional characters?

bhz wrote:

keroro645 wrote:

Pokeman_master645 wrote:

Or there is a "forever if" block, which is a "forever" block and an "if" block all in one. It keeps checking if the script is true all the way through the project, whereas if you put an "if" block inside a "forever" block, it may mean that once you've pressed the right arrow, the sprite will keep moving forever. In other words, until you press the stop button.  wink

Actually no. It doesn't need that, it does not keep on forever, maybe you should test this out?

http://scratch.mit.edu/projects/bhz/517354

Nice way to help fellow scratchers!Keep up the great work bhz!

Offline

 

#11 2009-05-07 21:10:27

ScratchX
Scratcher
Registered: 2009-05-05
Posts: 1000+

Re: 4-way directional characters?

DawnLight wrote:

bhz wrote:

keroro645 wrote:


Actually no. It doesn't need that, it does not keep on forever, maybe you should test this out?

http://scratch.mit.edu/projects/bhz/517354

Nice way to help fellow scratchers!Keep up the great work bhz!

that doesn't really add any informaton to the problem


Happy New Year!
http://i45.tinypic.com/1nyasi.pnghttp://i50.tinypic.com/219pez8.pnghttp://i49.tinypic.com/e5s4zr.pnghttp://i48.tinypic.com/23l18hf.jpghttp://i49.tinypic.com/66zymu.png

Offline

 

#12 2009-05-18 10:02:40

Test_Guardian
Scratcher
Registered: 2009-02-16
Posts: 30

Re: 4-way directional characters?

aww, i thought i had reliable help...

Offline

 

#13 2009-05-18 13:43:06

yambanshee
Scratcher
Registered: 2007-11-06
Posts: 500+

Re: 4-way directional characters?

Test_Guardian wrote:

aww, i thought i had reliable help...

what do you mean?

Offline

 

#14 2009-05-30 19:30:30

Test_Guardian
Scratcher
Registered: 2009-02-16
Posts: 30

Re: 4-way directional characters?

no one is talking about a way to solve my problem, it's been weeks since it's been properly answered now

Offline

 

#15 2009-05-30 19:40:28

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: 4-way directional characters?

Some one already posted a script to move in 4 directions, what more do you want?


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

Board footer