Hello guys i wanted to know how i can add to an object the ability to move vertically?
Please, if possible, attach a small example because after several attempts and hours lost unnecessarily I could not conclude anything.
I use the HTML5 platform so I can not use the path because it is too complex.
Same thing for physical strength because every time unlocking objects move without control and I can not handle it.
Thanks for the possible answers
Basically you should use force on X axis, but the object have psysic behaviour, you’ll have to check froce equivalent with physic.
The simplest is that you provide a simple example in gedevelop of what you have, and tell wich object you want to move. Many parameters have to be known if some objects use physic behaviour.
The three main ways are:
- Change the position of the object by changing its Y co-ordinate
- Apply a force on the Y axis
- Use physics behaviour
Example of 1) where the object to move vertically is called ‘Rock’:
Do =Rock.X();=Rock.Y()-4 to the position of Rock
The Rock object will move up the screen by 4 pixels every frame. Find the action in All objects>Position.
Example of 2):
Apply to Rock a force of 0 p/s on X axis and -240 p/s on Y axis
The Rock object will move up the screen by 4 pixels every frame (if running at 60fps). Find the action in All objects>Movement.
Example of 3):
Apply to Rock force 80 at angle 270
Set linear velocity of Rock to 0;-4
You would change the numbers to give whatever speed you wanted. Find the action in Physics behavior>Displacement.
Maybe I’ve always been badly disagreeable because what I need is an object that goes back and forth a ladder that rises up and down (low high) not an object that just goes down.
But now I try with this code but I think there is still a lot left to complete the steps.
Anyway thanks for the answers. All and 2.
Sorry for the possible cross-posting error is not my intention to violate the rules of the forum but I have not been able to solve the problem then to avoid further problems I attach a video and a screen with the codes so let’s solve it once and for all .
The movement that has to do the platform is to go from side to side and always return in the same direction.
youtube.com/watch?v=PVpWpMV … e=youtu.be ( The movement that has to do the platform. )
The code used for the move that surely contains some error as it does not work.
If possible help me solve this?
With a simple attached screen because if you explain to me I can not conclude anything.
I know that for you it is simple as something but for me it is extremely complicated because I do not know the steps I have to do.
I take this opportunity to thank you for your patience.
Check out the “Basic platformer” example, or the “Web Platformer” template, they use a system to move the platforms horizontally: There is an object called “GoLeft”, and another called “GoRight”, you add a force to the right on the platform until it collides with the “GoLeft” and change the direction of movement to the left, and so… check the example code
Now you just have to copy these events, but with a “GoUp” and “GoDown” sprites placed over and under the platform, and add forces to move up and down depending on the object collided.
EDIT: Oh, I can see you are doing it already, sorry , the problem is that you are adding forces in the X axis, instead the Y axis, the signs are OK I think. Remember that you have to set the force damping = 1, so the platform keeps moving even if it isn’t colliding with an arrow
Thanks for your answer, I finally managed to solve it.