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

#1 2012-12-30 22:19:00

camo_kanarya
New Scratcher
Registered: 2012-12-30
Posts: 2

Shooting

I have recently started making a game where two planes battle, i have got the health bar and everything ready but I just need some help on making them shoot. If anyone has an idea please help.

Offline

 

#2 2012-12-31 15:10:20

deepeed
New Scratcher
Registered: 2012-12-31
Posts: 1

Re: Shooting

when key space pressed
broadcast [fire]
/*different sprite for bullet*/
When i receive [fire]
repeat until [touching edge?]
    change [x by -5 or + 5]
end
i think

Offline

 

#3 2012-12-31 15:24:27

Tbtemplex97
Scratcher
Registered: 2011-11-12
Posts: 100+

Re: Shooting

Check out my  airhogs game Here

Its a plane game (can use my sprite if you want) and has shooting

Hope is helped

Last edited by Tbtemplex97 (2012-12-31 15:25:08)


Online Status: http://blocks.scratchr.org/API.php?action=onlineStatus&user=Tbtemplex97
Darkspace Coming Soon!, Try the Singleplayer Demo

Offline

 

#4 2013-01-02 22:15:30

Auto007
Scratcher
Registered: 2012-11-25
Posts: 100+

Re: Shooting

You can ask this question at script workshop .

Offline

 

#5 2013-01-03 14:47:40

zammer990
Scratcher
Registered: 2012-01-22
Posts: 500+

Re: Shooting

There are lots of possible ways to make weapons fire, it really depends if you want something to fire a lot of bullets/objects at once, or just one. If it's just one, do what the first suggestion said, if it's more than one, I can upload a project with a method for doing that


http://i45.tinypic.com/2ynq7nn.jpg Play now!

Offline

 

#6 2013-01-03 15:25:00

BLU_Spy
Scratcher
Registered: 2012-01-05
Posts: 1000+

Re: Shooting

I think I can help you...

Plane being controled:

when gf clicked
forever
wait until <key [space*] pressed?>
play sound [Shoot]
set [P1Shoot/P2Shoot***] to [1]
broadcast [P1shoot/P2shoot***]
wait [1*] secs
Bullet:
when i receive [P1shoot/P2shoot***]
show
point towards [P1/P2***]
repeat until <<touching [P2/P1***] ?> or <touching [edge]?>>
move [10*] steps
end
set [P1shoot/P2shoot***] to [0]

when gf clicked
forever if <(Shooting) = [0]>
go to [P1/P2***]
hide
Enemy plane:
when gf clicked
forever
wait until <touching [P1bullet/P2bullet***] ?>
play sound [hit]
change [P2health/P1health***] by [-1*]
wait [0.1**] secs
*Those are values that you can change if you want.
**The 0.1 second wait is necessary, to prevent accidental double damage.
***The first value is for the first plane, while the second one is for the other plane.



Hope it helps!  wink


I HAVE SWITCHED ACCOUNTS! My new username is NoxSpooth.

Offline

 

Board footer