How do I have a falling Enemy AI?

0 favourites
  • 6 posts
From the Asset Store
Template for an alternative to falling shapes, fully documented in comments and video
  • Hello! I'm trying to make a game like (Turrican /Gunlord) and i want to create falling enemy [Ai] (enemy behavior similar to the Gunlord game from Sega Dreamcast). The exact behavior of the enemy looks like in this movie - youtube.com/watch

    I tried hundreds of times and I could not to do this. I also used a sine behavior but it still does not work as it should.

    I have attached a capx file with an amateur code but it does not work as it should. I used "head_collide" which is pinned to the player (to better detect the enemy). I have no idea at the moment so are there any other solutions?

    capx file - mediafire.com/file/suqqoqn60hef06d/Falling+Enemy.capx

  • I suggest a completely different approach.

    Put an invisible "Sensor" sprite on the floor under the Enemy.

    When player collides with the Sensor (and the enemy is not currently moving), the enemy starts falling.

    Instead of the Bullet behavior use MoveTo.

    First move the Enemy to Sensor sprite. Then, after it arrives (in "Hit the Target Position" event), move the Enemy back to its original position.

  • My try:

    https://drive.google.com/uc?export=down ... ChIjxlEols

    I turned the enemy sprite 90° in the sprite editor to use move forward. I turned pixel rounding of for smoother movement. You have to look with the absolut positions if that is OK. The enemies react only every 3 seconds. I recognized that was in you video the same. If that is not what you want change the time or delete it.

  • unfortunately it does not work for me as I would like. It works for me only when I'm on the top.

    As soon as I go down, the enemy is crazy. I only changed the enemy's speed.

    You can check this on this capx file) - mediafire.com/file/8warfwvyaow3ckg/EnemyFall.capx

    This guide from Jerementor works very well (I checked) - youtube.com/watch

    however, it's something completely different.

    I still have no idea

  • unfortunately it does not work for me as I would like. It works for me only when I'm on the top.

    As soon as I go down, the enemy is crazy. I only changed the enemy's speed.

    As I wrote. The movement of the enemies are hard coded positions, if you change the position it won't work.

    I changed the example this should work better:

    https://drive.google.com/uc?export=down ... 9Ga5Ifxim1

    I recommend that you try to understand how this works, otherwise it will break again when you adapt it to another setting. I put a little explanation in it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • fantastic job Asmodean and now It works perfectly. I see that I still have to learn a lot.

    I forgot to ask for an explanation yesterday;) Thank you very much for the fix

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