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

#1 2012-10-18 11:13:50

djmartin67
New Scratcher
Registered: 2012-10-18
Posts: 1

Unexpected behaviour when sprite glides between x -220 and x -150

Hi All,

I have a sprite which glides along the y axis - when the space bar is pressed I have it so the gliding speed changes, at which point another sprite is told to got the first sprite (The second sprite is also hidden until the space is pressed)

The first sprite also has 2 costumes depending on the direction it is gliding.

This works fine except when the first sprite is between x -220 and x -150 (approx)
Sometimes when I press the space bar the costume of the first sprite changes when it shouldn't

Also the second sprite which should go to the first sprite doesn't - it goes to x 220 (approx)


The gliding of the first sprite is on a fixed y position of 22.

Just a tad frustrating

Cheers
Dj

Offline

 

#2 2012-10-18 19:19:04

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Unexpected behaviour when sprite glides between x -220 and x -150

Can you give us a link to your project?  It's a lot easier to track down issues when we can see the scripts.


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#3 2012-10-20 14:32:00

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: Unexpected behaviour when sprite glides between x -220 and x -150

A link would indeed be helpful  smile

djmartin67 wrote:

I have a sprite which glides along the y axis - when the space bar is pressed I have it so the gliding speed changes, at which point another sprite is told to got the first sprite (The second sprite is also hidden until the space is pressed)

Are you using the "glide" blocks? Because I tried this:

when green flag clicked
go to x:(-160) y:(122)
glide (10) secs to x:(-164) y:(-108)

when [space v] key pressed
glide (5) secs to x:(-164) y:(-108)
[edit this]

The second glide block seems to "interrupt" the first one — it glides to the new position, and then goes back to where it was when the first glide block was interrupted, and continues that one.

I assume this is intended behaviour for Scratch — this is one of the reasons I don't use glide blocks...  smile


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#4 2012-12-14 02:15:49

DanilaKritsin
Scratcher
Registered: 2011-12-12
Posts: 12

Re: Unexpected behaviour when sprite glides between x -220 and x -150

Use the two blocks for glide.

glide 10 secs to x:-164 y:-108
glide 10 secs to x:-160 y:122
Use a variable for control. If space key pressed, variable a set. If variable 1, set to 0. If variable 0, set to 1. If variable = 0, glide to one point.  If variable = 1, glide to two point.

Offline

 

#5 2012-12-14 08:02:54

Mokat
Scratcher
Registered: 2011-12-08
Posts: 1000+

Re: Unexpected behaviour when sprite glides between x -220 and x -150

DanilaKritsin wrote:

Use the two blocks for glide.

glide (10) secs to x:(-164) y:(-108)
glide (10) secs to x:(-160) y:(122)
Use a variable for control. If space key pressed, variable a set. If variable 1, set to 0. If variable 0, set to 1. If variable = 0, glide to one point.  If variable = 1, glide to two point.

scratchblocks fixed


http://www.eggcave.com/egg/977371.pnghttp://www.eggcave.com/egg/977376.pnghttp://www.eggcave.com/egg/1005291.pnghttp://www.eggcave.com/egg/996745.png

Offline

 

Board footer