Question

In AndEngine I defined a PathModifier in this way

          public static IEaseFunction EASEFUNCTION;
                EASEFUNCTION =EaseSineInOut.getInstance();
                float[] coordinatesX = new float[300], coordinatesY = new float[300];
    for (int i=0; i<300; i++){
        coordinatesX[i] = i;
        coordinatesY[i] = (float)(20 * (Math.sin((-0.10 * coordinatesX[i]))));
        System.out.println(coordinatesX[i]);
        System.out.println(coordinatesY[i]);
    }
    PathModifier path = new PathModifier(10, coordinatesX, coordinatesY, EASEFUNCTION);

It's a mathematical function. I wanna to apply an EASEFunction to the PathModifier created by me. The constructor exists but none of the EASEFunctions don't works in this case. What's going wrong ?

Was it helpful?

Solution

You need to create the Path object first, then pass it to the PathModifier constructor.

This will work:

Path path = new Path(coordinatesX, coordinatesY);
PathModifier modifier = new PathModifier(10, path, EaseSineInOut.getInstance());

I highly recommend you to download AndEngine's source code, so you can fix such small issues fast and with ease.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top