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

#1 2013-03-06 18:43:18

adrianpye
New Scratcher
Registered: 2013-03-05
Posts: 2

please help

how do you make objects move and a sprite shot it but  i know how to make the sprite move but how about the object its really confusing me cause in the thing for it that i saw it had a vaiable that i dident know how to make to make the object move and lso i need help on making the sprite shot

Offline

 

#2 2013-03-06 19:32:08

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

Re: please help

This seems a bit garbled, and so I want to make sure that I'm not misinterpreting you. So you want to know how to make an object move and how to make a sprite shoot at it? Is there anything else?

With regards,

ErnieParke


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

Offline

 

#3 2013-03-06 21:25:39

bob6
Scratcher
Registered: 2010-07-01
Posts: 100+

Re: please help

OOhh I understand:
You want to know
(1) how to make your player shoot
(2) how to make the targets move

And you know:
(1) how to make the sprite move

Well, there are quite a few ways to do this.
This is the way that I think is most simplest.
(1) create a sprite called "bullet" that looks like a bullet (obviously)
(2) create as many "target" sprites as you want. These are the sprites that your player will control.
(3) We need to make a script to control how the target will move.
Here is a script for a target that I quickly whipped up that will randomly move the target along the line x=100:

when gf clicked
show
forever
 glide (1) secs to x: (100) y: (pick random (-150) to (150))
 if <touching [bullet v]?>
  hide
 end
end
If you want to keep track of score:
when gf clicked
show
set [score v] to (0)
forever
 glide (1) secs to x: (100) y: (pick random (-150) to (150))
 if <touching [bullet v]?>
  hide
  change [score v] by (1)
 end
end
And in case you don't know, how to create a variable:
Click on the last section, I forgot if it said "variable" or not, but on Scratch 2.0 beta it says "data"
Now, click "create variable"
Now, make sure that "all sprites" option is selected (it is supposed to be automatically selected if you create variable, just make sure), and name your variable (in this case "score")
Now, click ok, and you have created a variable!

Last edited by bob6 (2013-03-06 21:35:44)


http://i46.tinypic.com/3148ksz.gif

Offline

 

Board footer