How do I make the computer shoot me?

0 favourites
  • 5 posts
From the Asset Store
Shoot balls to destroy as many blocks as possible, at each stage the game will become more difficult.
  • Hi,

    I am making a game in Construct 2 which looks like the already existing game "Raft Wars" The controls for the player look a bit like in Angry Birds, but in my game de enemy’s also automatically shoot me, just like in Raft Wars.

    Is it possible to make a enemy shoot the players but also make the enemy miss the players sometimes? I am making a couple levels, so in the first level the enemy should miss the targets a lot, which gives the player the opportunity to shoot more. The higher the level, the higher the accuracy of the enemy.

    If this above is too difficult or not possible, I thought about another plan. In the first level I could place like 4 extra invisible "players". Then I could give the enemy the task to shoot randomly towards one of the 6 players (2 real players and the 4 invisible ones) In this case the changes that the enemy shoots one of the actual players are little. In level 2 I could remove one of the existing invisible players, which makes the changes of the enemy hitting the right player bigger.

    Can anyone tell me what I should do and how it's done? I'm not very experienced with Construct 2, so a detailed and simple explanation would be great!

    Thanks a lot!!!

  • Hey!

    Give each enemy an attribute for accuracy. Check this attribute before each shot. If it succeeds, aim at the player, if it doesn't, aim at the player and adjust the angle for missing. It's not hard.

    Another approach is having the attribute itself as the angle range. You just roll a random angle inthe range. The bigger the range, the worse will be the accuracy.

    I prefer the first option, since it gives me more control. But both work.

    Hope this helps. Cheers!

  • Thank you for the quick reaction brunopalermo!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey!

    Give each enemy an attribute for accuracy. Check this attribute before each shot. If it succeeds, aim at the player, if it doesn't, aim at the player and adjust the angle for missing. It's not hard.

    Another approach is having the attribute itself as the angle range. You just roll a random angle inthe range. The bigger the range, the worse will be the accuracy.

    I prefer the first option, since it gives me more control. But both work.

    Hope this helps. Cheers!

    Thank you for the quick reaction brunopalermo!

    Glad to hear it should be not too hard. However, I am, as I told before, not very experienced in Construct 2.

    I think I would like to use your first method, because I understand what you're doing, but I can't find all the right events and actions in Construct 2.

    Do you mind explaining the first option in all the words I see on my computer display, please?

    Or screenshots would be great, but I understand if that's too much work.

    I hope I am not asking too much now, but you would help me a lot.

    Thanks in advance!

    In addition: How do I take account into the fact that the bullet of the enemys needs to go with graffiti? The bullets of the enemy just need to go as in Raft Wars.

  • Hey 88tc88!

    I modified one of R0J0hound 's examples to do what I think you're trying to achieve.

    Enemies all have a 50% accuracy.

    https://www.dropbox.com/s/wgazg4t2q1fcf ... .capx?dl=1

    If you have any questions about the code, just let me know.

    Hope this helps. Cheers!

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