문제

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 ?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top