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

#1 2010-07-16 09:14:05

Twinmold2
New Scratcher
Registered: 2010-07-16
Posts: 2

How do I shoot a bullet at a monster?

I have a monster in my game. I want to know how to shoot a bullet at the monster from my sprite.

Offline

 

#2 2010-07-16 09:22:02

codyronaldcamp
Scratcher
Registered: 2009-12-26
Posts: 100+

Re: How do I shoot a bullet at a monster?

Do [blocks]<when green flag clicked>
<forever>
<if><color[ |||||||| ]is over[ ||||||||
<hide>
<end>[/blocks]
Now switch red with the color of your bullet and green with the color of your monster.

Last edited by codyronaldcamp (2010-07-16 09:26:43)


http://i45.tinypic.com/332q9kz.png

Offline

 

#3 2010-07-16 09:25:59

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: How do I shoot a bullet at a monster?

Thank you for trying to help, codyronaldcamp, but turns out that script only hides the sprite  smile

You may want to take a look at Paddle2See's Trigonometry Cannon or Archmage's Trig-Less Cannon as examples.

Last edited by coolstuff (2010-07-16 12:44:01)

Offline

 

#4 2010-07-16 09:27:51

codyronaldcamp
Scratcher
Registered: 2009-12-26
Posts: 100+

Re: How do I shoot a bullet at a monster?

Well, how do you expect a New Scratch Member to build those scripts?


http://i45.tinypic.com/332q9kz.png

Offline

 

#5 2010-07-16 09:40:09

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: How do I shoot a bullet at a monster?

codyronaldcamp wrote:

Well, how do you expect a New Scratch Member to build those scripts?

At the moment, your script only hides when it's touching the monster. I find examples to be quite useful - they don't need to actually build the scripts themselves; on the contrary, they can just take them out of the project and put it into their own.

Offline

 

#6 2010-07-17 05:32:07

Flait7
Scratcher
Registered: 2008-04-14
Posts: 100+

Re: How do I shoot a bullet at a monster?

A very simple way to build your own script. is to use codyronaldcamps idea. or use <touching[ monster ]> and then make the bullet hide, but as well. make the monster respond to being hit. I suggest creating a variable, possibly naming it health, to simbolise that it has health, and then <change{ health }by( -1 )>


http://scratch.mit.edu/static/projects/Flait7/2248016_sm.pnghttp://scratch.mit.edu/static/projects/Flait7/1827934_sm.png

Offline

 

#7 2010-07-17 07:06:45

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: How do I shoot a bullet at a monster?

Thanks for trying to help, Flait7, but I believe Twinmold2 was try to design to script which dealt with the projectiles, not changing the health when getting hit.

Another possible thing to look at is my Target Shooter demo from a few years ago.

Offline

 

Board footer