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

#1 2009-05-27 04:57:28

Jennaroni
Scratcher
Registered: 2009-05-16
Posts: 8

Smoothly changing a sprite's size

Is there a way to make a sprite progressively reduce or increase in size while it's traveling? eg make a car gradually get smaller as it drives off into the distance. I've tried using the 'change size' scripts, but as the sprite only changes size when it gets to the script, it looks jerky and unrealistic.
I guess you'd need a cross between a 'looks' and 'motion' script that said something like 'glide 1 secs to x: 269 y: 156 changing size to -90'. Is such as thing possible to do in any other way?

Offline

 

#2 2009-05-27 05:54:39

Mike_W
Scratcher
Registered: 2009-02-05
Posts: 100+

Re: Smoothly changing a sprite's size

Start a separate thread that does the sizing.

Don't wait for the glide , in the thread that control the size read the sprites x and y

Offline

 

#3 2009-05-27 06:49:43

Jennaroni
Scratcher
Registered: 2009-05-16
Posts: 8

Re: Smoothly changing a sprite's size

Sorry Mike, I'm a total newbie at this and I don't understand your message. Can you give me a concrete example?

Offline

 

#4 2009-05-27 07:38:54

fruit
Scratcher
Registered: 2009-04-24
Posts: 1000+

Re: Smoothly changing a sprite's size

Don't use: <glide(  )secs to x sad   )y sad 

Use: <go to x sad   )y sad


@savi3000 | hcsmp.com

Offline

 

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

cheddargirl
Scratch Team
Registered: 2008-09-15
Posts: 1000+

Re: Smoothly changing a sprite's size

Jennaroni wrote:

Sorry Mike, I'm a total newbie at this and I don't understand your message. Can you give me a concrete example?

What Mike was referring to was that you have two scripts: one script takes care of the gliding, and another script that takes care in adjusting the sprite's size.

ie:
When green flag pressed:
     glide 1 secs to x: 269 y: 156

When green flag pressed:
     change size by -90


http://i.imgur.com/8QRYx.png
Everything is better when you add a little cheddar, because when you have cheese your life is at ease  smile

Offline

 

#6 2009-05-27 09:27:40

Jennaroni
Scratcher
Registered: 2009-05-16
Posts: 8

Re: Smoothly changing a sprite's size

Thanks fruit and cheddargirl - the 'go to' rather than 'glide' worked OK but I needed to do a lot of playing around with the numbers to minimize jerkiness in the movement. I got the best result with:
Repeat 8
change y by 15
change size by -10
However I'd still prefer to simply provide start and end co-ordinates, number of seconds of travel and end size of the sprite, and leave the program to smoothly adjust the sprite's size over that journey. (As you do with animation programs such as Flash and Director. Yes I know they cost LOTS more than Scratch and I am enjoying playing with Scratch :-)

Offline

 

#7 2009-05-27 12:10:36

Mozaz
Scratcher
Registered: 2009-05-19
Posts: 500+

Re: Smoothly changing a sprite's size

Jennaroni wrote:

Thanks fruit and cheddargirl - the 'go to' rather than 'glide' worked OK but I needed to do a lot of playing around with the numbers to minimize jerkiness in the movement. I got the best result with:
Repeat 8
change y by 15
change size by -10
However I'd still prefer to simply provide start and end co-ordinates, number of seconds of travel and end size of the sprite, and leave the program to smoothly adjust the sprite's size over that journey. (As you do with animation programs such as Flash and Director. Yes I know they cost LOTS more than Scratch and I am enjoying playing with Scratch :-)

Try using two seperate scripts rather than just using the one:

<when green flag clicked>
<glide( 1 )secs to x sad  269 )y sad  156 )

<when green flag clicked>
<repeat(
<change size by(
<end>


http://i33.tinypic.com/15i5fmp.png

Offline

 

#8 2009-05-27 17:03:40

Jennaroni
Scratcher
Registered: 2009-05-16
Posts: 8

Re: Smoothly changing a sprite's size

Good thought Mozaz, but that didn't work. The size changed first, then the sprite moved.

Offline

 

#9 2009-05-27 21:02:56

clapmatt
Scratcher
Registered: 2007-06-19
Posts: 18

Re: Smoothly changing a sprite's size

This?(Scratch project) Download it for code, but it doesn't seem that difficult.

Offline

 

#10 2009-05-27 23:18:06

Jennaroni
Scratcher
Registered: 2009-05-16
Posts: 8

Re: Smoothly changing a sprite's size

You beauty clapmatt! Best solution yet! Thanks :-)

Offline

 

Board footer