How Do I Code AI For Level Elements?

0 favourites
  • 2 posts
From the Asset Store
Two levels with two sistem Wave. with Source-code (.c3p) + HTML5 Exported.
  • Hi Guys,

    I am looking for a little bit of help in regards to coding the logic of some level elements.

    I have started to bring in some elements to my game to test some idea's and I am struggling on how to code them and give them functionality.

    I have a saw in my game which is an obstacle the player must dodge and not get hit by. The saw is something I want to move up, down, left and right. I have seen some tutorials which use sprites as boundaries in order to keep the AI in specific area's. I have a simple set up at the moment here is a screenshot.

    The saw for this section of my game I want to move up and down, but I have other sections where I want the saw to move horizontally as well. I did get the saw moving horizontally through a simple event which basically stated

    if the saw is > 0, set y position, 415.

    This got my saw in the correct position and with the platformer behavior I simulated left and right movement through a global variable called 'Patrol' (0 was left and 1 was right). I don't know if this is the best way but it did work as I wanted in regards to the movement of the saw my only problem was I was unable to get the saw moving vertically when I wanted. I was thinking of using separate event sheets but then I thought that just complicated things and wouldn't really be the best solution to how I want to use the saw throughout my game.

    I guess what I am asking here is, would it be possible to have an object move on its own in multiple directions? I am struggling to work out the logic and what behaviors to use.



  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I guess you could use any movement behaviour..

    In this case using the sine behaviour might suit you best, but depending on the amount of difficulty of the movement others might be better..

    You might also want to take a look at the third party plugins "litetween" and "moveto"

    They can make certain movements easier..

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