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

#1 2012-04-08 11:47:19

THAWKK
New Scratcher
Registered: 2012-02-27
Posts: 37

Need Help with Shooter!

1). How do you script the player sprite to fire its gun?

I also need help with just some of the script in general.  For instance, how would you make the player lose health if they're touching an enemy?  I'm new, so please don't hate over me.

Offline

 

#2 2012-04-08 12:20:33

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Need Help with Shooter!

This community is really supportive.  Nobody should hate on you  smile

You'll probably need to make a "bullet" sprite, with a script like this:

When I Receive [shoot v]
go to [player]
point towards [mouse-pointer v]
repeat until <<touching [edge v]?> or <touching[enemy v]?>>
move (5) steps
end
if <touching [enemy v]?>
broadcast [kill enemy v]
end
To shoot, just do something like this

when gf clicked
forever
if <mouse down?>
broadcast [shoot v] and wait
end
To lose health, put this in the enemy:

when gf clicked
forever if <touching [player v]?>
change [player's health v] by (-.25)
end

Last edited by MoreGamesNow (2012-04-08 12:23:13)


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#3 2012-04-08 13:23:32

SOScratch
Scratcher
Registered: 2010-02-01
Posts: 100+

Re: Need Help with Shooter!

And then for the enemy once it has been shot:
(Put this script on the enemy sprite)

when I receive [kill enemy v]
hide
And do not worry.
Everyone has to start from somewhere.
Nobody will hate you  smile


-SOScratch
Scratch On!

Offline

 

Board footer