[SOLVED] Rectangle function


#1


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


#2

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


#3

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


#4

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.

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


#5

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


#6

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.


#7

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.


#8

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


#9

Wow, thanks a lot for your work


#10

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


#11

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


#12

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


#13

Yeah, it works. Thanks