How to make the character's movement along a curved floor in the game?

5ccdd11d47d8b565842105.png

Is there a real way to make sure that the character could move across the floor on the drawn curve?
With linear movement, everything is clear, counted coordinati div Blocks (rectangular shape).

Ideally, I see myself as: drawn black and white image, which will restrict movement (floors, walls) of the character. Code level check - the character below the pixel #000 ? Yes? Then stop the model.
5ccdd294ae3b0459469413.png
How to do it?
March 20th 20 at 11:48
4 answers
March 20th 20 at 11:50
Ideally, I see myself as: drawn black and white image, which will restrict movement (floors, walls) the character

To divide the entity.
Visual display is one thing.
But the surface properties is different.

It is more flexible.

And your version too then you will limit.
It can only of the most severe economy to do that this gland is pointless.
March 20th 20 at 11:52
If a line is present in the form of points - then you need the arrays for all lines [[x,y],...]
and then every time you move go through the array comparing where the character is and if it can move there.
Good idea, but not too resource-intensive will that work? Imagine that every 10 seconds the loop checks let's say 2,000 points on the surface. - jaqueline.Rosenbau commented on March 20th 20 at 11:55
Can be simplified into a set of lines. - julianne commented on March 20th 20 at 11:58
March 20th 20 at 11:54
In the game you don't need any div-blocks js game made in webgl or canvas.
View phaser.io
Thank you and see. - jaqueline.Rosenbau commented on March 20th 20 at 11:57
March 20th 20 at 11:56
Here you have a picture of the curve, you can get data on any pixel at any time, check its color and transparency. So here you have x,y. x += 1 and check all the pixels on the y from the top down. Once the pixel has become opaque, it is desired y coordinate for the character. All.
And then the author wants the background - britney_Berge commented on March 20th 20 at 11:59
@marietta.Dicki, which sits on another canvas, which is located under the canvas with limiters )))

Once the pixel has become opaque
- Brent22 commented on March 20th 20 at 12:02
@marietta.Dicki, Yes, let him do what he wants. Even though the picture he draws, and comes where he wants. The main thing that pixels could set and explicitly define. To distinguish between transparent and opaque regions and all. - maximo93 commented on March 20th 20 at 12:05
Now, that's interesting!) - jaqueline.Rosenbau commented on March 20th 20 at 12:08

Find more questions by tags JavaScript