Hello, how can I get the enemies to attack me with a projectile? Thank you in advance for your answers and sorry if I am not clear in my remarks, I speak very poor English and I help myself with a translator.
i get this when i try to download your file.
but u can make enemies attack by having 2 sprites,
1 sprite for the enemy
1 sprite for the bullet or projectile
for the enemy to start shooting we need a condition that will make him shoot and an action to create the bullet which will go towards the player position. We also need the bullet behavior for the projectile to move and untick set angle on the behavior.
condition can look something like this
system/compare two variables
distance(enemy.x,enemy.y,player.x,player.y) =< 100
enemy.spawnanotherobject. bullet(or what the name of the projectile is)
under that we put another action for enemy
Enemy.BulletBehavior.SetAngle to Angle(self.x,self.y,player.x,player.y)
Enemy.bulletbehavior.setangleofmovement to Angle(self.x,self.y,player.x,player.y)
Then we need a condition to destroy the bullet and subtract life form player
Projectile on collision with another object "player"
Player subtract from variable "life" _ 1
now the variable life can be global or local on the player himself.
if you want a game over on the player life = 0
we do condition
Compare variable "life"
if life =<0
Reset global variables
kinda that is the logic of things.. now you can alter the reset variables or restart layout the way you want in order to suit your needs.
Hope it helps you also make sure you look at the community blogs and tutorials there are plenty of tutorials that help you achieve this and more.