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

#1 2012-06-27 02:03:04

jax55
New Scratcher
Registered: 2012-06-27
Posts: 1

How do I shoot a sprite?

I'm making a game where you have to shoot a flying object, but I have no idea how to do this and I haven't found a way to do it. So help? I need to finish this for a class assignment.

Offline

 

#2 2012-06-27 02:19:25

Corwen
New Scratcher
Registered: 2012-06-23
Posts: 28

Re: How do I shoot a sprite?

what do you want that object to do? kill something?

Offline

 

#3 2012-06-27 02:24:19

Corwen
New Scratcher
Registered: 2012-06-23
Posts: 28

Re: How do I shoot a sprite?

If what i said above is true you will need to do something like this:


on ur enemy sprite:
when enemysprite clicked
broadcast shot

on ur bullet:
when i receive shot
glide towards enemysprite
forever
  if touching enemysprite
    set endgame to 1

then set this 'endgame' variable to do what you want

Offline

 

#4 2012-06-27 08:00:43

SciTecCf
Scratcher
Registered: 2011-11-23
Posts: 1000+

Re: How do I shoot a sprite?

Try this:

Enemy Sprite:

when [enemysprite] clicked
broadcast [shot v] and wait
Bullet:
when gf clicked
hide
when i receive [shot v]
go to [gun v] //The sprite that shoots.
point in direction ([direction v] of [gun v])
show
repeat until <<touching [edge v]?> or <touching [enemysprite v]?>>
 move (2) steps //You can change this number.
end
if <touching [enemysprite v]?>
 set [endgame v] to [1] //Whatever you want to happen when enemy shot
end
hide //Don't remove this.
That'll work.  wink

Last edited by SciTecCf (2012-06-27 08:19:34)


http://bit.ly/LCZEJRhttp://bit.ly/LSONcOhttp://bit.ly/LF3vIc
http://trinary.site40.net/images/scratchrank.php?username=SciTecCf&amp;display=small

Offline

 

#5 2012-06-28 18:50:39

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: How do I shoot a sprite?

Or just look at the scripts in my 2-player shooter.


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

Board footer