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

#1 2011-12-18 05:39:17

bob2bob2
Scratcher
Registered: 2011-12-02
Posts: 3

movement

[blocks] <when green flag clicked><forever><go to[ mouse pointer]
[/blocks]

Offline

 

#2 2011-12-18 11:48:16

12_lassy
Scratcher
Registered: 2011-07-23
Posts: 13

Re: movement

That is one way to make a sprite move; the sprite will follow the cursor forever once you press start, I'm sure you already know. It can be used in projects such as cursor games and paint projects.

There are other ways to control the sprites' movement, like with the arrow keys. You can use it in many types of game projects, like mazes and platforms.

when green flag clicked
 if<key [up v] pressed?>
change y by (10)
end
 if<key [down v] pressed?>
change y by (-10)
end
if <key [left v] pressed?>
change x by (-10)
end
if <key [right v] pressed?>
change x by (10)
end
end
This is only one of the many ways you can use arrow keys to control sprites.

You can also make the sprites move by itself from point to point:

when green flag clicked
forever
point in direction (-90)
glide (1) secs to x: (-219) y: (0)
point in direction (90)
glide (1) secs to x: (219) y:(0)
end
Or in a circle:

when green flag clicked
forever
move (15) steps
turn cw (5) degrees
end
Those two can be used in animations and for AIs, among many other things.

These are only a few of numerous ways to create sprite movement, I'm sure with a little experimenting, you can find a lot more!

Last edited by 12_lassy (2012-03-17 13:56:16)


http://i552.photobucket.com/albums/jj357/12_lassy/scratchsiggy.png

Offline

 

#3 2011-12-18 13:15:23

Daroach1
Scratcher
Registered: 2011-09-11
Posts: 1000+

Re: movement

to move or to not move?
what a tough decision
maybe we should consult
the ST


http://i47.tinypic.com/v83mhl.png

Offline

 

#4 2011-12-21 14:54:18

SOScratch
Scratcher
Registered: 2010-02-01
Posts: 100+

Re: movement

I usually use this kind of script for sprite movement:
<when green flag clicked>
<if><key[ down ]pressed?>
<change y by( 10

Something like that.


-SOScratch
Scratch On!

Offline

 

#5 2011-12-21 15:05:20

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: movement

SOScratch wrote:

I usually use this kind of script for sprite movement:
<when green flag clicked>
<if><key[ down ]pressed?>
<change y by( 10

Something like that.

For the down arrow key it should be -10, not 10  smile


Why

Offline

 

Board footer