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

#1 2013-01-21 18:53:26

Zebus
New Scratcher
Registered: 2013-01-21
Posts: 14

Help with top down shooter!

At the moment I am having troble getting my plane to shoot a bullet when i press space bar how would i spawn a bullet or mutiple bullets when i press the space bar

Offline

 

#2 2013-01-21 21:42:58

numberonegamers
Scratcher
Registered: 2012-07-12
Posts: 100+

Re: Help with top down shooter!

For the plane

When [space v] key pressed
 Broadcast [bullet v]
End
And for the bullet

When gf clicked
Hide

When I receive [bullet v]
Go to [plane v]
Show
Point in direction ([direction v] of [plane v])
Repeat until <<touching [enemy v]> or <touching [edge v]>>
 Move [3] steps
End
If <touching [enemy v]>
 Broadcast [kill enemy v]
End
Hide
And for the enemies
When I receive [kill enemy v]
 Hide
Hope that I helped

Last edited by numberonegamers (2013-01-21 21:43:16)

Offline

 

#3 2013-01-22 01:43:45

CheeseMunchy
Scratcher
Registered: 2008-10-13
Posts: 1000+

Re: Help with top down shooter!

numberonegamers wrote:

For the plane

When [space v] key pressed
 Broadcast [bullet v]
End
And for the bullet

When gf clicked
Hide

When I receive [bullet v]
Go to [plane v]
Show
Point in direction ([direction v] of [plane v])
Repeat until <<touching [enemy v]> or <touching [edge v]>>
 Move [3] steps
End
If <touching [enemy v]>
 Broadcast [kill enemy v]
End
Hide
And for the enemies
When I receive [kill enemy v]
 Hide
Hope that I helped

Excellent example.
Just one problem, this:

Point in direction ([direction v] of [plane v])
Should be this:
Point in direction <([direction v] of [plane v]) - [180] >
Wouldn't want the bullet flying backwards.  tongue


6418,

Offline

 

#4 2013-01-22 05:47:54

ianthestuntman
Scratcher
Registered: 2013-01-02
Posts: 100+

Re: Help with top down shooter!

ok... this is for the bullet

[scratchblocks]
when (space) key pressed
broadcast (shoot)

Offline

 

#5 2013-01-22 05:54:45

ianthestuntman
Scratcher
Registered: 2013-01-02
Posts: 100+

Re: Help with top down shooter!

sorry...

when (space) key pressed
broadcast (shoot)

Offline

 

#6 2013-01-22 05:58:02

ianthestuntman
Scratcher
Registered: 2013-01-02
Posts: 100+

Re: Help with top down shooter!

once again,

when [space] key pressed
broadcast [shoot]

Offline

 

#7 2013-01-22 06:01:34

ianthestuntman
Scratcher
Registered: 2013-01-02
Posts: 100+

Re: Help with top down shooter!

when gf clicked
hide

Offline

 

#8 2013-01-22 06:04:42

ianthestuntman
Scratcher
Registered: 2013-01-02
Posts: 100+

Re: Help with top down shooter!

when  I receive [bullet]
go to (plane)
point in direction <pick random (-90) to (90)>
repeat until [touching (enemy)]
move (10) steps
end
hide

Offline

 

#9 2013-01-23 13:47:55

Zebus
New Scratcher
Registered: 2013-01-21
Posts: 14

Re: Help with top down shooter!

CheeseMunchy wrote:

numberonegamers wrote:

For the plane

When [space v] key pressed
 Broadcast [bullet v]
End
And for the bullet

When gf clicked
Hide

When I receive [bullet v]
Go to [plane v]
Show
Point in direction ([direction v] of [plane v])
Repeat until <<touching [enemy v]> or <touching [edge v]>>
 Move [3] steps
End
If <touching [enemy v]>
 Broadcast [kill enemy v]
End
Hide
And for the enemies
When I receive [kill enemy v]
 Hide
Hope that I helped

Excellent example.
Just one problem, this:

Point in direction ([direction v] of [plane v])
Should be this:
Point in direction <([direction v] of [plane v]) - [180] >
Wouldn't want the bullet flying backwards.  tongue

Thank you both for your help my ship now fires had to change the orientation of the sprite bullet because it shot out the side of the ship which was kinda funny but now it shoots straight

keep a eye out for the finished product also i am going to be making a help thread tut and will be giving credit where it is due

Offline

 

Board footer