How do I make enemies shoot instead of just follow you

0 favourites
  • 9 posts
From the Asset Store
Shoot balls to destroy as many blocks as possible, at each stage the game will become more difficult.
  • How can I make enemies try to shoot at the player, than just try to follow him? I can't seem to get the bullet sprite to spawn in, and it wont shoot.

    Screenshot of the event sheet:

  • Welp, can't post screenshots because of the stupid rule they have in place.

    I'll write everything here:

    System - Every tick - Player - Set angle toward (Mouse.X("game"),Mouse.Y("game")

    Mouse - Left button is down - Player - Spawn Bullet on layer "game:(image point "shootpoint"

    Bullet - On collision with enemy - Enemy - subtract 10 health

    - Bullet - Destroy

    Enemy - Health < 0 - Enemy - Destroy

    ...Just some movement for player...

    Enemy - Has LOS to Player - Enemy set angle toward Player.X, Player.Y)

    - Enemy - Set Bullet speed to 100

    Enemy - X has LOS to palyer

    Player - On collision with Bullet2 0 Player - Subtract 10 from health

    Sprite (Health bar) - Set width to Player.Health

    Sprite - is on screen

    Player - Health = 0 - Player - set opacity to 0

    System - Go to layout 2 (Death screen)

    Bullet 2 - on collision with player - Player - subtract 20 health

    sprite - set width to Player.Health

    Enemy - Has LOS to player - Bullet 2 - set angle towards Player.X,Player.Y

    Bullet 2 - Set Bullet speed to 100

    Bullet 2 - set bullet enabled

  • What you can do, which is rather simple, is tell your enemy to "Spawn" your bullet object. You can use the Every X seconds to control the frequency of the bullets created.

    Its pretty much the same way as your player script except without the input controls.

  • As for the layer, and the Image point, what should those values be? And, I can't seem to find a way to keep the health bar at the top right corner wherever the player moves.

  • layer "HUD" parallax (0,0) and your health bar stays where you want

  • Ok, I got it working. But then I added a new background, and I can see it in the layout screen, but when I play it it's not on screen,

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Make sure your hud screen is on the top most layer, it should allow you to see it now.

  • It is, but it doesn't show up in game for some reason

  • give enemies the turret behavior and use the "On Shoot" command. Make them spawn their bullet, it should automatically fire in whatever direction the enemy is facing

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)