Multiple Platform Movement for enemies/ai

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • There are so many tutorials on how to use the opponent with the Platform Movement Object. But my question is, how do I use this if, for example, you have 10 opponents who are running towards the opponent and if there is an abyss they fall into it. Is there an easier way to behave? Do I use a separate PMO for each opponent?


    Summarized:

    I want to have a level where the opponent activates as soon as the player is close and then runs towards him. The opponent uses Gravity, e.g. falls into a hole. There should be 10 such opponents in the level.

  • To make PMO work for multiple objects just have an instance foreach one of your enemies

    Each enemy stores the fixed value of PMO in an alt val like "PMO_ID"
    You could do that by creating a PMO foreach enemy, setting the enemy value of "PMO_ID" to that enemy, and setting the curren object of "PMO" to the selected "Enemy", something like this:

    Code
    // Spawn a PMO and assign to each new Enemy
    
    * Enemy: Created is off
    	 Enemy : Set Created on
    	Start loop for each one of Enemy, loop name "Enemy.PMO.Spawn"
    
    * On each one of Enemy, loop name "Enemy.PMO.Spawn"
    	New Objects : Create Platform Movement object at (0,0) layer 1
    	Enemy : Set PMO_ID to Fixed( "Platform Movement object" )
    	 Platform Movement object : Set object to Enemy

    Now you could compare the ID of Enemy to the Fixed value of PMO, so to handle collisions, you can do something like this:

    Code
    // Selection example: Collision handling
    
    * Platform Movement object: Test for obstacle overlap
    + PMO_ID of Enemy = Fixed( "Platform Movement object" )
    + Enemy is overlapping a backdrop
    	 Platform Movement object : Selected object overlaps an obstacle

    I may make an example, but I think the explanation above should be clear enough, it's mostly just some basic object selection stuff...
    Edit: nevermind lol, here is a very basic example: Please login to see this attachment.

    Game/App developer, artist and a community contributor.
    You can support my work on: Please login to see this link.

  • To add to this, add a value to the enemy PDistance, set an always event for a for each loop "AI" or whatever you'd like to call it;

    : Foreach loop "AI" - > Set enemy value "PDistance" to PDistance(X(enemy x position), Y(enemy y position), X(player x position), Y(player y position))

    The value of PDistance will go from greater to lower depending on the distance of the player, regardless of which side it is on. This way, you can set something like;

    : Enemy value "PDistance" >=30 - > (under the enemies PMO) User is holding Left (or right) input key

    This will cause the enemy to chase you only when that PDistance value is met and will stop if the value is greater than what you enter.

    Developer/Composer :

    Vamprotector

    Castlevania Chronicles 2 - Simon's Quest

    Castlevania Chronicles 3 - Dracula's Curse

  • To add to this, add a value to the enemy PDistance, set an always event for a for each loop "AI" or whatever you'd like to call it;

    : Foreach loop "AI" - > Set enemy value "PDistance" to PDistance(X(enemy x position), Y(enemy y position), X(player x position), Y(player y position))

    The value of PDistance will go from greater to lower depending on the distance of the player, regardless of which side it is on. This way, you can set something like;

    : Enemy value "PDistance" >=30 - > (under the enemies PMO) User is holding Left (or right) input key

    This will cause the enemy to chase you only when that PDistance value is met and will stop if the value is greater than what you enter.

    To add to this more - I prefer to give enemies a series of Alterable Values with various settings for things like X speed, jump height, gravity density, the amount of distance needed before an enemy is "activated," etc., all really make testing super fast and easy. This way, you don't have to go into the event editor and open the action every time you want to tweak a parameter - just change the respective Alterable Value and test again. This also makes it easier to adjust values for testing while the app is running by changing them in the debugger.

    Please login to see this link.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!