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

#1 2012-11-22 18:59:27

trappstar
New Scratcher
Registered: 2012-11-04
Posts: 3

I need help with a firing function

I need help on this one.  I'm trying to create a function that will stop the triangle and do some other stuff when any of the fire sprites hit it.  when I hit the green flag none of the fires register.  It does register every once in a while.  I appreciate any help on this one.  Thanks.

http://scratch.mit.edu/projects/trappstar/2929264

Here is the link to what I have so far.

Offline

 

#2 2012-11-22 20:03:58

VinMakesGames
Scratcher
Registered: 2012-09-23
Posts: 1

Re: I need help with a firing function

Heres a suggestion:
lets call your player sprite "player"
make a bullet sprite
for the bullet sprite:

when flag clicked
broadcast "ready"

when i receive "ready"
hide
repeat until [mouse down]?
/go to "player"
/////////////////////////
show
point towards [mouse_pointer]
repeat until [touching [edge]]
/move 10 steps
////////////////////////////
broadcast [ready]

Offline

 

#3 2012-11-22 20:30:32

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

Re: I need help with a firing function

VinMakesGames wrote:

Heres a suggestion:
lets call your player sprite "player"
make a bullet sprite
for the bullet sprite:

when gf clicked
broadcast [ready v]

when i receive [ready v]
hide
repeat until (mouse down?)
 go to [player v]
end
show
point towards [mouse_pointer v]
repeat until (touching [edge v]?)
 move (10) steps
end
broadcast [ready v]

Put into scratchblocks.


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

Offline

 

#4 2012-11-22 20:57:52

trappstar
New Scratcher
Registered: 2012-11-04
Posts: 3

Re: I need help with a firing function

I've created the bullet and it's movement.  I guess my issue is more that I want the sprite that the bullet touches to react in some way.  To test if my function is working I have repeat movement until bullet touching
but when my bullet is touching nothing happens most the time.  Please download my game if you have some time to see when is holding me up.  Thanks.

Offline

 

#5 2012-11-23 12:19:57

30-1
Scratcher
Registered: 2012-08-08
Posts: 100+

Re: I need help with a firing function

Put this script in the sprite:

when gf clicked
forever
 if <touching [bullet v]?>
  react in some way
  wait until <not <touching [bullet v]?>>
 end 
for reactions.  wink

Last edited by 30-1 (2012-11-23 12:20:12)


http://i.imgur.com/ocOya7x.gif
I. Text I Based I Games I

Offline

 

#6 2012-11-24 14:45:58

trappstar
New Scratcher
Registered: 2012-11-04
Posts: 3

Re: I need help with a firing function

Thank you.

Offline

 

Board footer