BrentAureli / SuperMario

Source Code from my Creating Super Mario Bros YouTube Tutorials
https://www.youtube.com/playlist?list=PLZm85UZQLd2SXQzsF-a0-pPF6IWDDdrXt
424 stars 246 forks source link

Unable to find region from badlogic #15

Open murchie85 opened 7 years ago

murchie85 commented 7 years ago

In the code snippet below, it says incompatible types for region where i have marked asterisk, for some reason it only recognises it as java.lang.object.

public TextureRegion getFrame(float dt){ currentState = getState();

    TextureRegion region;
    switch(currentState){
        case JUMPING:
            region = marioJump.getKeyFrame(stateTimer);  ***********
            break;
        case RUNNING:
            region = marioRun.getKeyFrame(stateTimer, true); ***********
            break;
        case FALLING:
        case STANDING:
        default:
            region = marioStand;
            break;
    }
creative04 commented 7 years ago

Did you find a solution about this problem? I wondered too. Can you share with me if you find it?

RobCM commented 7 years ago

Make sure that the region in use is from "import com.badlogic.gdx.graphics.g2d.TextureRegion;" and not import com.badlogic.gdx.graphics.Texture; Also the variables are set as: private Animation marioRun; private Animation growMario;