Discuss Scratch

snakeboy712
Scratcher
100+ posts

AI Shooting Projectiles?

Im making this Virus game and im making a Macrophage and on the images i have seen apparently they shoot something to kill virus cells
so i thought i could make the Macrophage a boss but the thing is you're controlling the Virus so i need help figuring out how
to make an AI Shoot
jokebookservice1
Scratcher
1000+ posts

AI Shooting Projectiles?

Use the same script as for the virus, but change the arrow keys to an up down motion i.e.
whenclickedforeverglide1secstox:xy:y+10glide1secstox:xy:y-10
and for shooting create a “bullet” sprite, or whatever the correct term is, and in the macrophage's script do
foreverpointtowardsviruswait1secsbroadcastshoot
and in the “bullet”'s script do:
whenclickedhidewhenIreceiveshootshowgotox:x positionofmacrophage y:y positionofmacrophage glide1secstox:x positionofvirus y:y positionofvirus

Last edited by jokebookservice1 (Feb. 21, 2016 01:29:05)

snakeboy712
Scratcher
100+ posts

AI Shooting Projectiles?

Thanks
Le_Drewie
Scratcher
20 posts

AI Shooting Projectiles?

Plenty of ways to do this, here's one I'd use.

Create a sprite who will serve as the projectile being shot. Make sure the front of the projectile is facing right, as per its standard rotation style. Then, there are a variety of conditions under which you can have it shoot. Does it just shoot every 2 seconds? Or whenever the player is in range? Anyway, here's the basic code to go in this projectile:
whenclickedhideforeverifconditiontoshootismet?thencreatecloneofmyself
The projectile will clone itself and fire at the player's location whenever the projectile was first shot. If you want it to track, then you just have to update the projectile's target constantly.
whenIstartasaclonegotomacrophagenamepointtowardsplayernameshowrepeatuntiltouchingedge?movehoweverfastyouwanttheshottomovestepsiftouchingplayername?thendealdamagetotheplayerdeletethisclonedeletethisclone
If this doesn't work let me know, I'll test it in my own project.
snakeboy712
Scratcher
100+ posts

AI Shooting Projectiles?

@Le_Drewie does your script come with AI? because pretty much what i kinda really need
is the AI first
officialianthekitten
Scratcher
1 post

AI Shooting Projectiles?

Well, technically it is the lymphocytes that shoot things. Just a helpful suggestion.
KJRYoshi07
Scratcher
1000+ posts

AI Shooting Projectiles?

officialianthekitten wrote:

Well, technically it is the lymphocytes that shoot things. Just a helpful suggestion.
Please don't necropost.
SM4635
Scratcher
2 posts

AI Shooting Projectiles?

codeman1044
Scratcher
1000+ posts

AI Shooting Projectiles?

Please don't necropost or spam.
r_courbet
New Scratcher
2 posts

AI Shooting Projectiles?

s
r_courbet
New Scratcher
2 posts

AI Shooting Projectiles?

what if i made this for my

when flag clicked
set rotation style to left-right
- forever
| point torwards mouse pointer
| move distance to mouse pointer / 30
-
ThE gOaL oF tHe GaMe Is To AvoiD aLl ShoTs
deck26
Scratcher
1000+ posts

AI Shooting Projectiles?

r_courbet wrote:

what if i made this for my

when flag clicked
set rotation style to left-right
- forever
| point torwards mouse pointer
| move distance to mouse pointer / 30
-
ThE gOaL oF tHe GaMe Is To AvoiD aLl ShoTs
Please create your own topic instead of necroposting.
frankthetankampro
Scratcher
5 posts

AI Shooting Projectiles?

how do i make a clone shoot at me?

Powered by DjangoBB