[SOLVED] Rectangle function


Hello, Is it possible to manage animation or flit using the rectangle function ?

It’s a great function but I need to change the animation ( up,down,left_right) and automatizate flip.

Thanks,
J

Can you explain what do you want the object to do? (perhaps draw it)

Hi @ tristanrhodes
thanks for your answer.

I’m using the rectangle function to move a soldier following thes directions:
image
The sprite has these animation:

  • leftright
  • up
  • down

I would like to change the animation:
use leftright animation on right direction
use up animation on up direction
use down animation down direction
use leftright flipped animation on left direction

The example code is here:
https://drive.google.com/file/d/1kmvM5d5mCRb9W8cSfSXdvngDF4hki5oM/view?usp=sharing

Thanks,
J

Hi I’ve made a simple modification to the Extension so you can sync the movement with the animation
What I changed is the

  • Object from Object type to Sprite
  • Added a property checkbox bool to set sync with the animations
  • Added 4 animations to the player Left, Right, Up, Down
  • Added inside the Extension the animations with those names.

I don’t know if this is what you want here the project, hope this helps.
I’m pretty sure there will be a better way to do this but that needs a better mind that mine, maybe @tristanrhodes can do it better.

SquareMovementAnimation_edit_0

https://drive.google.com/file/d/1t5IoM8tA_wj9yizi8McBj6-SjZ52aiXE/view?usp=sharing

Wow, you are a fu**g genius. Thanks

1 Like

Rather than require specific animation names, how about adding 4 conditions?

IsMovingUp
IsMovingDown
IsMovingLeft
IsMovingRight

Then the user will have more flexibility on what happens when those states are triggered.

Sure that would be awesome, I just modify the Extension to fit the needs of @jumpingj, but if those 4 conditions are added it will be nice.

I will add those conditions and submit it as an update to the official extension.

2 Likes

Wow, thanks a lot for your work

Hello @tristanrhodes
I also suggest you to add a pause action.
Example:
condition: gameplay is in pause status
actione: pause the rectangle movement

Thanks,
J

You can already do this by disabling the extension (built in GDevelop feature )

1 Like

This link includes my updated version and example. I expect it will be added to GDevelop in a few days.

2 Likes

Yeah, it works. Thanks