Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » AI Shooting Projectiles?
- snakeboy712
-
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
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
-
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.
and for shooting create a “bullet” sprite, or whatever the correct term is, and in the macrophage's script do
and in the “bullet”'s script do:
Last edited by jokebookservice1 (Feb. 21, 2016 01:29:05)
- Le_Drewie
-
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:
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:
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.
If this doesn't work let me know, I'll test it in my own project.
- snakeboy712
-
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
is the AI first
- officialianthekitten
-
1 post
AI Shooting Projectiles?
Well, technically it is the lymphocytes that shoot things. Just a helpful suggestion.
- KJRYoshi07
-
1000+ posts
AI Shooting Projectiles?
Please don't necropost. Well, technically it is the lymphocytes that shoot things. Just a helpful suggestion.
- r_courbet
-
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
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
-
1000+ posts
AI Shooting Projectiles?
Please create your own topic instead of necroposting. 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
- Discussion Forums
- » Help with Scripts
-
» AI Shooting Projectiles?