lukezero's Forum Posts

  • An example might be close to what you are looking for: dropbox.com/scl/fi/futhyhxo5wbfz4txot0rw/4-direction-chase-avoid.capx

    It's a good solution, man. Thanks again! :D

    It will work well with some enemies.

    My big challenge now is being able to implement an enemy AI that actually pursues the player on the stage, whether or not it may find the shortest route. And most importantly, it doesn't get stuck on the walls. ^^

  • ChatGPT doesn't know Construct as well as other programming languages. It can only help with very basic questions. And will very often give wrong and confusing results.

    It can help with Javascript code, if it's not Construct-specific.

    Construct is intended for people with little or even zero programming experience. Study a few tutorials and built-in examples, and you could start making games in Construct in no time!

    Due to the little programming knowledge I have, I found some strange routines expressed by the AI. He usually gets the expressions and conditions right, but it tends to be a little confusing. :|

  • R0J0hound alextro

    I managed to implement this last night, using Overlapping + Pick random instance + Pick instance with UID. You two are awesome!

    Thanks again for all attention and support! :D

  • R0J0hound Sorry to bother you again, but now I have a new question: how do I make the green box activate only the enemy touched by it (it's also the one closest to the player character)?

    In the current routine, the box activates them all after touching one of them. I tried several alternatives (using UID, pick random instance, pick nearest), but still without success. :(

  • If you just want to pick the closest enemy then:

    Enemy: pick closest to (player.x, player.y)

    Or if you want to pick all the enemies within a certain distance of the player:

    System: pick by comparison: enemy: distance(enemy.x,enemy.y,player.x,player.y)<100

    I personally wouldn’t want to touch any code that ai generates. Mainly because debugging is hard and time consuming. I find it easier to try to understand what I code as I go so I’m able to fix things as I go. I have no way of verifying how correct, robust or bug free a piece of ai code is without dissecting it which sounds like an annoying waste of time.

    It's working!

    You are the man!

  • System: pick by comparison: enemy: distance(enemy.x,enemy.y,player.x,player.y)<100

    In this case, is it better for enemies to be alone or grouped together in a family?

  • If you just want to pick the closest enemy then:

    Enemy: pick closest to (player.x, player.y)

    Or if you want to pick all the enemies within a certain distance of the player:

    System: pick by comparison: enemy: distance(enemy.x,enemy.y,player.x,player.y)<100

    I personally wouldn’t want to touch any code that ai generates. Mainly because debugging is hard and time consuming. I find it easier to try to understand what I code as I go so I’m able to fix things as I go. I have no way of verifying how correct, robust or bug free a piece of ai code is without dissecting it which sounds like an annoying waste of time.

    Thanks, dude!

    I want the routine to calculate the distance of each enemy to the player character and the drone (the green square) to activate them in an order of proximity.

  • Hi guys!

    I'm raising this question here for several reasons:

    1. I know that many programmer friends use AIs successfully with other languages/engines;

    2. As a designer, I usually use "no code" engines to produce my games and only now have I been testing this AI for this purpose.

    3. I ask because in my first tests, I found some inconsistencies in the code suggested by ChatGPT.

  • Try Construct 3

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

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

    I'm trying to implement a routine for my top-down game, in which a flying enemy activates disabled enemies near the player character, in order of proximity.

    I tried to create a routine with the help of ChatGPT, but I believe he made mistakes in some commands (but he was right when recommending the use of Array).

    Below is an image so you can better understand the mechanics I am trying to program.

    Tagged:

  • Like this:

    I also made some adjustments to the demo which include this, and made some tweaks to some values, such as the pathfinding refresh rate. It was at every 0.02 seconds, but that appears to be pretty memory heavy so I changed it to 0.05.

    It also seems to work better with 4 directional movement.

    https://drive.google.com/file/d/1nDI-BU8huVVyZSzPvkEFd0nZLw6xFY-e/view?usp=drive_link

    Thank you very much!!! :D

  • Adding this should help you achieve the effect:

    Also consider increasing the rotation speed so the characters quickly snap into the correct angle.

    As for the animations, all you need to do is check the angle of the Player/Enemy Controllers and apply the animation to the characters based on that.

    - For example, if Enemy_Controller angle is between 315 and 45, set Enemy animation to "Right".

    You can use the condition "Pick Children" to access the Graphic object belonging to the controller.

    - For example: Condition1 -> Enemy_Controller -> Pick Children -> Enemy.

    Condition2 -> Enemy_Controller angle is between 315 and 45

    Action: Enemy -> Set Animation to "Right"

    Since you used the Condition 1 to specifically pick the child of the Enemy_Controller, it will only change the animation if it's its own child.

    Same applies to the Player.

    Thanks again! You're awesome! :D

  • Do you need only the graphics to turn in 4 directions, or do you want to restrict the movement to only Up, Left, Right and Down?

    Both things, but only the necessary programming to make it functional in this way.

  • I made a small improvement to fix an issue where they would still get stuck in the wall sometimes. Use this version instead:

    https://drive.google.com/file/d/1nDI-BU8huVVyZSzPvkEFd0nZLw6xFY-e/view?usp=drive_link

    Do you think it works well with the enemy moving in 4 directions?

  • I made a small improvement to fix an issue where they would still get stuck in the wall sometimes. Use this version instead:

    https://drive.google.com/file/d/1nDI-BU8huVVyZSzPvkEFd0nZLw6xFY-e/view?usp=drive_link

    Thanks again! Already downloaded! :D

  • Here's an example I made using the pathfinding behavior.

    It has some extra stuff to add a bit of polishing that you may find useful.

    The code is fully commented to great detail, so it should be easy to understand.

    https://drive.google.com/file/d/1nDI-BU8huVVyZSzPvkEFd0nZLw6xFY-e/view?usp=drive_link

    Thanks, dude!

    I'll test and study it right now! :D