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

#1 2012-10-31 15:51:54

edxforme
New Scratcher
Registered: 2012-10-22
Posts: 9

sprite

hello i need alittle help please
ok  how do i have a sprite when it start at the bottom of screen moving vertically i only move it horizotally so that it go up to hit another sprite? i dont want to hold it with arrow but just move it from side to side before it hit a sprite at the top of the screen? there will be another sprite moving up i dont want it to stick to. i want to use right left arrow to direct them in a position to hit a moving sprite going left to right  at the top of  screen. also when it hit sprite at top make a sound . when game over the screen say game over
thank you

Offline

 

#2 2012-10-31 16:25:59

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: sprite

I think that this is what you need for your sprite:

when gf clicked
repeat until (touching [target v]?)
 change y by (1)//Adjust for a faster speed upwards.
 if (key [left v] pressed?) 
  if <(x velocity) > (-5)>//Change the -5 to edit the max speed leftwards.
   change [x velocity v] by (-.5)
  end
 else
  if (key [right v] pressed?)
   if <(x velocity) < (5)>//Change the 5 to edit the max speed rightwards.
    change [x velocity v] by (.5)
   End
  else
   change [x velocity v] by ((.5)*(([abs v] of (x velocity))/(x velocity)))
  end
 end
 change x by (x velocity)
end
play sound [sound v]
And use this in the You Lose sprite:
when gf clicked
hide

when I receive [You Lose v]
show
stop all//Opptional.
I hope that this helps!

Last edited by ErnieParke (2012-10-31 16:28:02)


http://i46.tinypic.com/35ismmc.png

Offline

 

Board footer