my character needs to be able to shoot... how can i make him do that ? i want it so whenever i press space bar he will shoot...
also i want to know how another character can randomly shoot, but the bullets slowly randomly at times come towards the 1st character so he will have to dodge them.....
Offline
A script like this will shoot a bullet from the character:
when key [space v] pressed go to [my character v] point towards [mouse-pointer v] show repeat until <<touching [edge v]?> or <touching [enemy v]?>> move (10) steps end hideFor shooting back:
when gf clicked forever hide wait (pick random (2) to (4.5)) secs go to [enemy v] point towards [my character v] show repeat until <<touching [edge v]?> or <touching [my character v]?>> move (10) steps end
Offline
Well, the issue is, there is only one sprite that is shooting. It will keep moving until it hits the edge or another sprite, then it will let you shoot. But while it's moving it won't let you. I suppose you could make a bunch of other bullets...
Edit: But the issue with that is that they'd all shoot at once if they all had the same script as MoreGamesNow...
Last edited by powerpoint56 (2012-07-25 09:06:13)
Offline
Here's are some scripts I made that would work:
Example:
when gf clicked set [bullets? v] to [0] forever if < <key [space v] pressed> and <[bullets] < [4]>> change [bullets] by (1) wait until <not <key [space v] pressed> >You can have [wait till space is not pressed], or you can have [wait 1 second].
when gf clicked forever if <(bullets?) = 1> go to [my character v] point towards [mouse-pointer v] show repeat until <<touching [edge v]?> or <touching [enemy v]?>> move (10) steps end change [bullets] by (-1) end hideBullet 2:
when gf clicked forever if <(bullets?) = 2> go to [my character v] point towards [mouse-pointer v] show repeat until <<touching [edge v]?> or <touching [enemy v]?>> move (10) steps end change [bullets] by (-1) end hideBullet 3:
when gf clicked forever if <(bullets?) = 3> go to [my character v] point towards [mouse-pointer v] show repeat until <<touching [edge v]?> or <touching [enemy v]?>> move (10) steps end change [bullets] by (-1) end hideBullet 4:
when gf clicked forever if <(bullets?) = 4> go to [my character v] point towards [mouse-pointer v] show repeat until <<touching [edge v]?> or <touching [enemy v]?>> move (10) steps end change [bullets] by (-1) end hideI hope that this helps!
Last edited by ErnieParke (2012-07-25 10:48:19)
Offline
when gf clicked set [bullet# v] to (0) forever if <key [space v] pressed?> broadcast (join[shoot](bullet#)) change [bullet# v] by (1) set [bullet# v] to ((bullet#) mod (number of bullets you have)) wait (0.2) secsEach bullet gets a script like the one below (but with "shoot" + bullet_number_of_sprite)
When I receive [shoot0 v] go to [character v] point towards [mouse-pointer v] repeat until <touching [edge v]?> move (5) steps endIt should be noted that the longer your bullets, the faster you can shoot them without having them pass through something without touching it.
Last edited by MoreGamesNow (2012-07-25 10:49:57)
Offline
Make another sprite that's the missle. You'll have to hide the bullet first. Here's how you do it.
Missle:
<when[space bar]key pressed> show go to [Sprite 2 v]Enemy:
when gf clicked if <touching [Sprite 3]> [(do other scripts you need to do here)]
Last edited by maxamillion321 (2012-07-29 19:42:28)
Offline
Scratch seems to be cutting off part of the end my post when I put my message at the bottom of the quote, so I'm putting it up here:
Going to Sprite 2 will not work because of the fact that the player won't see the bullet going there, just that it suddenly appeared there, though this is a good idea!
maxamillion321 wrote:
Make another sprite that's the missle. You'll have to hide the bullet first. Here's how you do it.
Missle:<when[space bar]key pressed> show go to [Sprite 2 v]Enemy:when gf clicked if <touching [Sprite 3]> [(do other scripts you need to do here)](do other scripts)
Last edited by ErnieParke (2012-07-29 19:38:35)
Offline