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

#1 2013-04-22 20:52:12

Sturm_Programing
New Scratcher
Registered: 2013-04-19
Posts: 2

Walk?

I'm trying to get my sprite to go back and forth.
I've tried to do:
When Green Flag clicked
Forever
Glide 15 sec to x, y
Go to x,y
Point in direction -90
Glide 15 sec to x, y
Go to x, y
Point in direction 90

This worked on my first maze game, but now my sprite gets stuck on the edge of the screen. I've tried: When Green Flag clicked
forever
move 10 steps
point in direction -90
move -10 steps

That didn't go to well. My sprite got stuck at the point it was supposed to turn around, and started to shake.

Offline

 

#2 2013-04-22 21:03:42

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Walk?

Sturm_Programing wrote:

I'm trying to get my sprite to go back and forth.
I've tried to do:

When gf clicked
Forever
 Glide (15) secs to x: (x) y: (y)
 Go to x: (x) y: (y)
 Point in direction [-90 v] 
 Glide (15) secs to x: (x) y: (y)
 Go to x: (x) y: (y)
 Point in direction [90 v]

This worked on my first maze game, but now my sprite gets stuck on the edge of the screen. I've tried:

When gf clicked
forever
move (10) steps
point in direction [-90 v]
move (-10) steps

That didn't go to well. My sprite got stuck at the point it was supposed to turn around, and started to shake.

So is that the only script that your sprite has? I doubt that, though if it is true, then your sprite's going to shake because there's no delay and things are happening very rapidly. You'll probably want to use a glide block, or a repeat loop instead. That, or you could add in a delay. As for getting stuck, I'm not sure what'd cause that in your script. :/

Anyway, hello Sturm_Programing and welcome to Scratch! I hope tat you'll have a great time here!

With regards,

ErnieParke

Last edited by ErnieParke (2013-04-22 21:07:06)


http://i46.tinypic.com/35ismmc.png

Offline

 

#3 2013-04-25 09:56:11

kattenelvis
Scratcher
Registered: 2013-02-06
Posts: 100+

Re: Walk?

do this:

forever
 if <key [left arrow v] pressed?>
  change x by [-5]
and
forever
 if <key [right arrow v] pressed?>
  change x by [5]

on this way it runs more smooth  cool

Last edited by kattenelvis (2013-04-25 09:59:46)


http://i38.tinypic.com/35b8d4n.png

Offline

 

#4 2013-04-26 13:50:29

cauzality
New Scratcher
Registered: 2013-03-19
Posts: 44

Re: Walk?

here's something like what ernie suggested (using both repeat and wait blocks):

when gf clicked
forever
   point in direction [90]
   repeat [10]
      move [10] steps
   end
   wait [1] secs
   point in direction [-90]
   repeat [10]
      move [10] steps
   end
   wait [1] secs

Offline

 

#5 2013-04-26 17:50:33

Pilplup
New Scratcher
Registered: 2013-04-22
Posts: 14

Re: Walk?

forever
 if <key [left arrow v] pressed?>
  change x by [-5]
wait (0.75) secs
and
forever
 if <key [right arrow v] pressed?>
  change x by [5]
wait (0.75) secs
on this way it runs more smooth  cool
This will make it run even smoother. If you do kattens way, if you hold the key down your sprite will go flying.

Offline

 

Board footer