Need help with BackandForthMirroredMovement behavior

Hello everyone. I’m new to Gdevelop, and while making my first platform game, I tried using the BackandForthMirroredMovement behavior to create enemies’ back and forth movement (in stead of using the “collision with left/right object” like in the default tutorial). However, for some reasons, it does not seem to work. The object I try using this behavior on just stay put for some reasons.

Can someone help me figure out what I have done wrong? And is there a better way to create enemies’ movement? Thank you.
I would also love to learn more about the topic “enemies’ AI” for platform games. I would highly appreciate any suggestions about where to start. Thank you.

Hi,
I just tried it with the platformer example.
There’s a mistake in the instructions. You need to create two identical animations, one called TurnLeft and another called GoLeft.
You also need to make sure the object can move freely for the specified distance (in the object behavior properties) or the script gets stuck.

@4ian when mistakes are spotted in public behaviors, can anyone fix the mistakes and reupload the behaviors? :thinking:

We can submit new extensions and files, here

This is not an error :slight_smile: Check the Space shooter example.
This is because the sprite is flipped.

Yes as bouh mentioned you can submit a modified/fixed behavior here: GitHub - GDevelopApp/GDevelop-extensions: Repository of behaviors, actions, conditions and expressions to be used in GDevelop for creating games
Read “Submit your extension” section :slight_smile:

To export an extension, this page will be helpful: Share dialog and sharing options - GDevelop documentation

Thanks for the links!

The error is here:

I looked at the space shooter, I understand it better now :sweat_smile:
I’m not sure it’s a great behavior to make public though, it’s not really the universal/basic/easy-to-use solution people might expect.:thinking:
I’ll see what I can come up with. :blush:

I used the condition/action combination:

Object1 distance to Object2 is not below 50 —> move towards and set animation to ‘moving’
–The X Position of Object1 < Object2.X() —> Flip horizontally Object1 no
–The X Position of Object1 > Object2.X() —> Flip horizontally Object1 yes

But in the case of my game I just wanted Object1 to follow Object2 around aimlessly. I can see my solution not working if the direction of the following object is important for attacks and such.

jd

Thank you guys for all the help. I am learning from the space shooter example as well.

You’re right! I’ve fixed the description.

It’s true that this behavior is not that clear. I’m thinking about ways to improve this, maybe by including examples/screenshots in the description.