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

#1 2013-03-27 16:55:54

shadowmouse
New Scratcher
Registered: 2013-02-03
Posts: 100+

How do I make a worm.

I'm trying to make a worm which acts acurately with gravity.
Because I mod scratch, I've got four extra blocks which are very useful and pretty self explanitry that I can use:

(speed if x vel( ) y vel( ))
(bearing if x vel( ) y vel( ))
(x vel if speed( ) bearing( ))
(y vel if speed( ) bearing( ))
I've worked out their length beforehand and I'll put that as length.
At the moment my worm is made up of several circles and several rectangles.
The first circle is arrow key controlled. The first rectangle has a sccript of
when gf clicked
forever
point towards [first circle v]
move ((distance to [first circle v]) - ((length) / (2))) steps
the first circle has
when gf clicked
forever
change x by (x vel if speed((length of first rectangle) / 2) bearing (([direction v] of [first rectangle v]) + (180))
change y by (x vel if speed((length of first rectangle) / 2) bearing (([direction v] of [first rectangle v]) + (180))
.
Sorry about the length of the post and thanks if your still reading but what I'm tring to do is implement x and y velocities so that the entire worm acts acurately (with gravity) but still have the front of the worm moving in the direction that it is facing and turning (rather than going up, left, right e.t.c.). Any help is greatly appreciated.  smile

Offline

 

#2 2013-03-27 16:59:09

shadowmouse
New Scratcher
Registered: 2013-02-03
Posts: 100+

Re: How do I make a worm.

It seems scratch won't accept ridiculously long stings of blocks all nested within each other. The mising script basically worked out the difference between the x and y of the end of the rectangle and the centre of the ball. The ball and rectangle are then copied and each new one moves towards the one before it.

Offline

 

Board footer