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

#1 2010-01-05 13:09:21

PrimusGod
Scratcher
Registered: 2009-11-16
Posts: 10

Moving Diagonally

What can I use to move the sprite with x and y at the same time, sort of as a diagonal path?

Or is Scratch incapable of it? I don't want it to go one way and then the other to go diagonal, I want it to happen all in one.

An example is, if I press the "Up" key, it will move diagonally.


Hard artichokes, rarely keep
Hungarian elephants, Singapore sleep

Offline

 

#2 2010-01-05 13:11:42

juststickman
Scratcher
Registered: 2009-05-31
Posts: 1000+

Re: Moving Diagonally

You could use the <move(  )steps>?


Or, you could use:

<go to x sad  <x position>  + how much you want to change X by )y sad  <y position>  + how much you want to change Y by


I'm not sure if you can, but tell me if the above methods worked!


http://is.gd/iBQi2 Add grob to your sig and help with world dominiation!http://is.gd/iBQ9Q                                                             Hey guys, we're seriously naming our team bob?

Offline

 

#3 2010-01-05 13:23:22

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

Re: Moving Diagonally

When key up pressed
change x by 5
change y by -5

You want something like that right? Just try it in scratch and see if you get the results you wanted.


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

 

#4 2010-01-05 15:05:13

juststickman
Scratcher
Registered: 2009-05-31
Posts: 1000+

Re: Moving Diagonally

archmage wrote:

When key up pressed
change x by 5
change y by -5

You want something like that right? Just try it in scratch and see if you get the results you wanted.

I think PrimusGod is saying that a script that changes both X and Y at the same time is needed. That will have a slight time delay.

Why did I say "that" so many times up there?!


http://is.gd/iBQi2 Add grob to your sig and help with world dominiation!http://is.gd/iBQ9Q                                                             Hey guys, we're seriously naming our team bob?

Offline

 

#5 2010-01-05 15:48:24

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

Re: Moving Diagonally

I use that kind of script all the time to move diagonally and it doesn't give me problems. But you you want to do it with just 1 block you could do this

Code:

when up pressed
go to x:(x position+5) y:(y position-5)

Last edited by archmage (2010-01-05 15:49:14)


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

 

#6 2010-01-05 16:15:22

JSO
Community Moderator
Registered: 2007-06-23
Posts: 1000+

Re: Moving Diagonally

Actually, it does when using the pen.

I seperated the x and y in my mouse recorder project that comes with Scratch ( in the Lists folder) because I thought it was easier to understand but the result is awful  neutral


http://oi48.tinypic.com/2v1q0e9.jpg

Offline

 

#7 2010-01-05 16:16:39

JSO
Community Moderator
Registered: 2007-06-23
Posts: 1000+

Re: Moving Diagonally

Oops... It isn't in there anymore  smile  There was a list folder with my project in it in 1.3...


http://oi48.tinypic.com/2v1q0e9.jpg

Offline

 

#8 2010-01-05 17:58:17

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Moving Diagonally

You could try one of the above methods, or you could just point in a diagonal direction and use "move ___ steps," though I do frown upon it.

Offline

 

Board footer