0 Favourites

AI problem?

  • Hi all, I'm having a problem with something, in the tutorial where

    its says the monsters are to stay on screen, however when I put the info in it seems the

    objects continue to move off the page even though they are pointing in different directions and

    none seem to stay on the layout.

    I do not know if this is intended but needed to ask. Towards bottom of page:

    Making monsters a little smarter

    Tutorial beginners-guide-to-construct-2/page-5

    Right now the monsters just wander off the layout to the right. Let's make them a bit more interesting. First of all, let's start them at a random angle.

    This works it seems

    Condition: System -> On start of Layout

    Action: Monster -> Set angle -> random(360)

    Event 4 of the tutorial.

    They will still wander off forever when they leave the layout, never to be seen again. Let's keep them inside. What we'll do is point them back at the player when they leave the layout. This does two things: they always stay within the layout, and if the player stands still, monsters come right for them!

    (This is where I'm thinking there is a problem cause the monsters do not stay in layout)

    Condition: Monster -> Is outside layout

    Action: Monster -> Set angle toward position -> For X, Player.X - for Y, Player.Y.

    Run the game. If you hang around for a while, you'll notice the monsters stay around the layout too, and they're going in all kinds of directions. It's hardly AI, but it'll do!

    Other than adding some functionality to the keyboard for Player movement, the file up to this point should be

    just like the tutorial on the website.

    Basic questions I know and thanks for the input.

    Finally have the time to work on this stuff.

    Thanks

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • I didn't look at the capx but, try giving the spites "bound to layout" behavior.

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