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

#1 2010-01-18 05:38:11

vsherwood
Scratcher
Registered: 2010-01-18
Posts: 3

Sprites that should move independently but don't!

One of our students is creating a simple game where two sprites race each other.  Despite having different keys controlling each sprite, they both move at the same time, using either set of control keys.  We've tried everything (including deleting scripts and sprites) but it's still happening.

Any advice, please?

Thanks!

Offline

 

#2 2010-01-18 05:43:27

Ace-of-Spades
Scratcher
Registered: 2010-01-08
Posts: 1000+

Re: Sprites that should move independently but don't!

Are they the same sprite? You need to have 2 different sprites for them to not stick together (you might've just made 2 different cars or something not touching each other in the sprite layer, but that wouldn't make them different sprites)


11110010100011010100011010101000100011011011001010111100101000110101000110101010001000110110110010101111001010001101010001101010100010001101101100101011110010100011010100011010101000100011011011001010
110101010010001010101010101010101010101010100110101010010101010010101001101011010101010010101010101

Offline

 

#3 2010-01-18 08:19:36

vsherwood
Scratcher
Registered: 2010-01-18
Posts: 3

Re: Sprites that should move independently but don't!

Hi Ace

Thanks for your speedy response.

They are listed as two different Sprites (Sprites 3 and 4).

Sherwood

Offline

 

#4 2010-01-18 08:21:41

Ace-of-Spades
Scratcher
Registered: 2010-01-08
Posts: 1000+

Re: Sprites that should move independently but don't!

Maybe they both have the same scripts? Like if you copied one car from the other, they would both respond to signal 'A' and signal 'B' at the same time.


11110010100011010100011010101000100011011011001010111100101000110101000110101010001000110110110010101111001010001101010001101010100010001101101100101011110010100011010100011010101000100011011011001010
110101010010001010101010101010101010101010100110101010010101010010101001101011010101010010101010101

Offline

 

#5 2010-01-18 08:27:20

demosthenes
Retired Community Moderator
Registered: 2008-02-19
Posts: 1000+

Re: Sprites that should move independently but don't!

If you are using variables to control movement, they are probably global variables shared by both cars so whatever input given to one car affects the other the same way.


I've taken a long hiatus, but I still visit sometimes. Give me some time to answer any messages you post on my projects!

Offline

 

#6 2010-01-18 08:38:25

vsherwood
Scratcher
Registered: 2010-01-18
Posts: 3

Re: Sprites that should move independently but don't!

They were both created seperately and scripts written seperately also.  Will have a look during lesson tomorrow.

Thanks for advice.

Offline

 

#7 2010-01-18 15:11:47

shamrocker
Scratcher
Registered: 2009-03-19
Posts: 1000+

Re: Sprites that should move independently but don't!

I'll see... Post the scripts you put on them.
I'd suggest a script like this:

[blocks] <when green flag clicked>
<if> <key[ right arrow ]pressed?>
<point in direction( 90
<move( 10 )steps>
<end>
<if><key[ left arrow ]pressed?>
<point in direction( -90
<move( 10 )steps>
<end>[/blocks]

for one* sprite, and for the other:

[blocks]<when green flag clicked>
<if><key[ d ]pressed?>
<point in direction( 90
<move( 10 )steps>
<end>
<if><key[ a ]pressed?>
<point in direction( -90
<move( 10 )steps>
<end>[/blocks]

Last edited by shamrocker (2010-01-18 15:15:25)


http://i46.tinypic.com/2s1b32e.png
respect the oxford comma

Offline

 

#8 2010-01-22 01:23:36

Locomule
Scratcher
Registered: 2009-08-24
Posts: 500+

Re: Sprites that should move independently but don't!

It is very important to post your project otherwise we can only blindly guess at a million different solutions.


aka Pain from DragonSpires, Delrith Online, BotBattle, Urban Dead etc etc lol

Offline

 

Board footer