How do I Boss A.I.

0 favourites
  • 4 posts
From the Asset Store
Endlevel boss, brainwave animation, projectiles, ...
  • Hello guys.

    I'm doing the A.I. a boss. All he needs to do is to turn and shoot 5 in 5 seconds. Did I make. But the part that makes it turn, is not satisfactory. I had to calculate how many seconds it takes to turn each side. Is there a more precise manner to do this?

    Thank you.

    Capx: ... -test.capx

  • Try Construct 3

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

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

    Sometimes this kind of thing will happen (also happens with some collision events when moving fast) and the easiest way I have found to deal with it is to manually set it back to our desired angle (or position) when it overshoots.

    Here is a working version of your cap:

    We have added a new variable to the boss object called "SpinAngle" and each time we make it spin we just add 90 to the amount.

    Just a piece of advice, although it is undoubtedly easier to make a long chain of events using the "wait" command - from my experience it ends up being very difficult to work with for a number of reasons. If you can, stick to trigger style events (that is, activate a spin function, when the spin finishes activate the shooting function etc).

  • Hello,

    Many thanks for the help and the advice. It looks pretty smart. But how would I do it here (below), for example, without the "wait x seconds"?

    Thanks a lot, man.

  • No worries,

    Sorry I should have been a bit more clear on what I meant about the wait command. It's not that using it is bad in itself, I just meant making long events (where you are doing lots of unrelated things) can be troublesome in that it can lead to unexpected bugs late in the project that take a lot of time to find and fix.

    For instance, even with that simple function above - lets say it gets called and then a split second later your player kills the boss. Now that boss will fire his second barrage (even though he is dead) unless you get ride of the sprite immediately on death.

    Here is how you would do it safely:

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