Pages: 1
Topic closed
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
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)
Offline
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.
Offline
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.
Offline
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)
Offline
It is very important to post your project otherwise we can only blindly guess at a million different solutions.
Offline
Topic closed
Pages: 1