Java 类org.newdawn.slick.Animation 实例源码

项目:trashjam2017    文件:PackedSheetTest.java   
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
    this.container = container;

    sheet = new PackedSpriteSheet("testdata/testpack.def", Image.FILTER_NEAREST);
    rocket = sheet.getSprite("rocket");

    SpriteSheet anim = sheet.getSpriteSheet("runner");
    runner = new Animation();

    for (int y=0;y<2;y++) {
        for (int x=0;x<6;x++) {
            runner.addFrame(anim.getSprite(x,y), 50);
        }
    }
}
项目:trashjam2017    文件:AnimationTest.java   
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
    this.container = container;

    SpriteSheet sheet = new SpriteSheet("testdata/homeranim.png", 36, 65);
    animation = new Animation();
    for (int i=0;i<8;i++) {
        animation.addFrame(sheet.getSprite(i,0), 150);
    }
    limited = new Animation();
    for (int i=0;i<8;i++) {
        limited.addFrame(sheet.getSprite(i,0), 150);
    }
    limited.stopAt(7);
    manual = new Animation(false);
    for (int i=0;i<8;i++) {
        manual.addFrame(sheet.getSprite(i,0), 150);
    }
    pingPong = new Animation(sheet, 0,0,7,0,true,150,true);
    pingPong.setPingPong(true);
    container.getGraphics().setBackground(new Color(0.4f,0.6f,0.6f));
}
项目:Progetto-C    文件:PackedSheetTest.java   
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
    this.container = container;

    sheet = new PackedSpriteSheet("testdata/testpack.def", Image.FILTER_NEAREST);
    rocket = sheet.getSprite("rocket");

    SpriteSheet anim = sheet.getSpriteSheet("runner");
    runner = new Animation();

    for (int y=0;y<2;y++) {
        for (int x=0;x<6;x++) {
            runner.addFrame(anim.getSprite(x,y), 50);
        }
    }
}
项目:Progetto-C    文件:AnimationTest.java   
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
    this.container = container;

    SpriteSheet sheet = new SpriteSheet("testdata/homeranim.png", 36, 65);
    animation = new Animation();
    for (int i=0;i<8;i++) {
        animation.addFrame(sheet.getSprite(i,0), 150);
    }
    limited = new Animation();
    for (int i=0;i<8;i++) {
        limited.addFrame(sheet.getSprite(i,0), 150);
    }
    limited.stopAt(7);
    manual = new Animation(false);
    for (int i=0;i<8;i++) {
        manual.addFrame(sheet.getSprite(i,0), 150);
    }
    pingPong = new Animation(sheet, 0,0,7,0,true,150,true);
    pingPong.setPingPong(true);
    container.getGraphics().setBackground(new Color(0.4f,0.6f,0.6f));
}
项目:BaseClient    文件:PackedSheetTest.java   
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
    this.container = container;

    sheet = new PackedSpriteSheet("testdata/testpack.def", Image.FILTER_NEAREST);
    rocket = sheet.getSprite("rocket");

    SpriteSheet anim = sheet.getSpriteSheet("runner");
    runner = new Animation();

    for (int y=0;y<2;y++) {
        for (int x=0;x<6;x++) {
            runner.addFrame(anim.getSprite(x,y), 50);
        }
    }
}
项目:BaseClient    文件:AnimationTest.java   
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
    this.container = container;

    SpriteSheet sheet = new SpriteSheet("testdata/homeranim.png", 36, 65);
    animation = new Animation();
    for (int i=0;i<8;i++) {
        animation.addFrame(sheet.getSprite(i,0), 150);
    }
    limited = new Animation();
    for (int i=0;i<8;i++) {
        limited.addFrame(sheet.getSprite(i,0), 150);
    }
    limited.stopAt(7);
    manual = new Animation(false);
    for (int i=0;i<8;i++) {
        manual.addFrame(sheet.getSprite(i,0), 150);
    }
    pingPong = new Animation(sheet, 0,0,7,0,true,150,true);
    pingPong.setPingPong(true);
    container.getGraphics().setBackground(new Color(0.4f,0.6f,0.6f));
}
项目:BeatBitBeat    文件:Monster4.java   
public Monster4(int playerNumber) throws SlickException {
        super();
        skillIcons = new Image[]{
                new Image("Assets/Graphics/Monster and Human Sprites/Root/Root - 1 Leaf Icon.png"),
                new Image("Assets/Graphics/Monster and Human Sprites/Flame/Firefly.png"),
                new Image("Assets/Graphics/Monster and Human Sprites/Flame/X-Burner.png")
        };
        if (playerNumber == 1) {
            animationIdle = new Animation(new SpriteSheet("Assets/Graphics/Monster and Human Sprites/Root/Root - Idle P1.png", 600, 300, 1), frameDurationMonsterIdle);
            animationHumanIdle = new Animation(new SpriteSheet("Assets/Graphics/Monster and Human Sprites/Root/Root - Human P1.jpg", 150, 150, 1), frameDurationHumanIdle);

            animationSkill1 = new Animation(new SpriteSheet("Assets/Graphics/Monster and Human Sprites/Root/Root - 1 Leaf Icon P1.png", 600, 300, 1), frameDurationSkill1);
            animationSkill2 = new Animation(new SpriteSheet("Assets/Graphics/Monster and Human Sprites/Root/Root - 1 Leaf Icon P1.png", 600, 300, 1), frameDurationSkill2);
            animationSkillUlt = new Animation(new SpriteSheet("Assets/Graphics/Monster and Human Sprites/Root/Root - 1 Leaf Icon P1.png", 600, 300, 1), frameDurationSkillUlt);

            // TODO uncomment when sprites for player2 (flipper player1 sprites) are done
//        } else if (playerNumber == 2) {
//            animationIdle = new Animation(new SpriteSheet("Assets/Graphics/Monster and Human Sprites/Blueffy/Blueffy - Idle P2.png", 600, 300, 1), 250);
//            animationHumanIdle = new Animation(new SpriteSheet("Assets/Graphics/Monster and Human Sprites/Blueffy/Blueffy - Human P2.png", 600, 300, 1), 250);

//            animationSkill1 = new Animation(new SpriteSheet("Assets/Graphics/Monster Skills Sprites/Blueffy/Blueffy - 1 Blistol P2.png", 600, 300, 1), 250);
//            animationSkill2 = new Animation(new SpriteSheet("Assets/Graphics/Monster Skills Sprites/Blueffy/Blueffy - 2 Gatling P2.png", 600, 300, 1), 250);
//            animationSkillUlt = new Animation(new SpriteSheet("Assets/Graphics/Monster Skills Sprites/Blueffy/Blueffy - 3 Bluezooka P2.png", 600, 300, 1), 250);
        }

    }
项目:BeatBitBeat    文件:Monster6.java   
public Monster6(int playerNumber) throws SlickException {
        super();

        if (playerNumber == 1) {
            animationIdle = new Animation(new SpriteSheet("Assets/Graphics/Monster and Human Sprites/Blueffy/Blueffy - Idle P1.png", 600, 300, 1), 250);
            animationHumanIdle = new Animation(new SpriteSheet("Assets/Graphics/Monster and Human Sprites/Blueffy/Blueffy - Human P1.jpg", 600, 300, 1), 250);

            animationSkill1 = new Animation(new SpriteSheet("Assets/Graphics/Monster and Human Sprites/Blueffy/Blueffy - 1 Blistol P1.png", 600, 300, 1), 250);
            animationSkill2 = new Animation(new SpriteSheet("Assets/Graphics/Monster and Human Sprites/Blueffy/Blueffy - 2 Gatling P1.png", 600, 300, 1), 250);
            animationSkillUlt = new Animation(new SpriteSheet("Assets/Graphics/Monster and Human Sprites/Blueffy/Blueffy - 3 Bluezooka P1.png", 600, 300, 1), 250);

            // TODO uncomment when sprites for player2 (flipper player1 sprites) are done
//        } else if (playerNumber == 2) {
//            animationIdle = new Animation(new SpriteSheet("Assets/Graphics/Monster and Human Sprites/Blueffy/Blueffy - Idle P2.png", 600, 300, 1), 250);
//            animationHumanIdle = new Animation(new SpriteSheet("Assets/Graphics/Monster and Human Sprites/Blueffy/Blueffy - Human P2.png", 600, 300, 1), 250);

//            animationSkill1 = new Animation(new SpriteSheet("Assets/Graphics/Monster Skills Sprites/Blueffy/Blueffy - 1 Blistol P2.png", 600, 300, 1), 250);
//            animationSkill2 = new Animation(new SpriteSheet("Assets/Graphics/Monster Skills Sprites/Blueffy/Blueffy - 2 Gatling P2.png", 600, 300, 1), 250);
//            animationSkillUlt = new Animation(new SpriteSheet("Assets/Graphics/Monster Skills Sprites/Blueffy/Blueffy - 3 Bluezooka P2.png", 600, 300, 1), 250);
        }

    }
项目:telyn    文件:OrbObject.java   
@Override
public void init(GameContainer container, StateBasedGame game) throws SlickException {
    this.anim = new Animation(this.sprite, 75);
    this.anim.setCurrentFrame(Utils.getRandomNumber(13));
    this.anim.start();

    BodyDef def = new BodyDef();
    def.position.set(this.position);
    this.objBody = this.world.createBody(def);

    PolygonDef sd = new PolygonDef();
    sd.setAsBox(0.3f, 0.3f);
    sd.userData = "orb"; //Indica que o objeto � uma orb.
    this.objBody.createShape(sd);
    this.objBody.setMassFromShapes();
    this.objBody.setUserData(this);
}
项目:2COA    文件:WindowGame.java   
public void init(GameContainer container) throws SlickException //fait par VS, JD et FS
{

    //Initialisation of animation when BOOOOM !
    explosionAnimation  = new Animation();
    explosionImage1 = new Image ("boom1.png");
    explosionImage2 = new Image ("boom2.png");
    explosionImage3 = new Image ("boom3.png");
    explosionImage4 = new Image ("boom4.png");
    explosionAnimation.addFrame(explosionImage1, 25);
    explosionAnimation.addFrame(explosionImage2, 35);
    explosionAnimation.addFrame(explosionImage3, 35);
    explosionAnimation.addFrame(explosionImage4, 150);
    explosionAnimation.setLooping(false);

    //Graphic aspect
    ttf = new TrueTypeFont(font, true);
    container.getGraphics().setBackground(new Color(193, 184, 176)); 

    //Input management on TextArea
    pseudoEntry = new TextArea(20,20,150,20);
    container.getInput().addKeyListener(pseudoEntry);
    container.getInput().addMouseListener(pseudoEntry);
    pseudoEntry.setPosition(grid.getRightPosition(), getNextCommandPosition(0));
}
项目:TinyTank    文件:Animator.java   
public Animator(Animator animator) {
    this.animations = new HashMap<>();
    for (Map.Entry entry : animator.animations.entrySet()) {
        EnumAnimation type = (EnumAnimation) entry.getKey();
        List<Animation> values = (ArrayList<Animation>) entry.getValue();
        List<Animation> newValues = new ArrayList<>();
        for (Animation value : values) {
            newValues.add(value.copy());
        }
        this.addElement(type, newValues);
    }
    this.current = animator.current;
    this.index = animator.index;
    this.printable = animator.printable;
    this.deleted = animator.deleted;
    this.needUpdate = animator.needUpdate;
    this.filter = animator.filter;
    this.activatedTimer = new ActivatedTimer(animator.activatedTimer);
}
项目:Saboteur    文件:RessourceManager.java   
public static Animation[] loadPlayerFeet() {
    SpriteSheet sprites = new SpriteSheet(loadImage("feet.png"), 64, 64);

    Animation[] model = new Animation[8];

    Image[] frames = new Image[8];
    for (int angle = 0, j = 0; angle < 360; angle += 45, j++) {
        for (int i = 0; i < 8; i++) {
            Image temp = sprites.getSprite(0, i);
            temp.rotate(angle);
            frames[i] = temp;
        }
        model[j] = new Animation(frames, 100);
    }

    return model;
}
项目:awesome-game-store    文件:TimeMeter.java   
public TimeMeter(float xPos, float yPos, float xOffset, float yOffset, float entityWidth, float entityHeight, int timeLimit) throws SlickException {

    // Basic attributes
    this.xPos = xPos;
    this.yPos = yPos;
    originalXPos = xPos;
    originalYPos = yPos;
    this.xOffset = xOffset;
    this.yOffset = yOffset;
    width = height = 30;

    // Visibility
    visible = false;

    // Create the Circle SpriteSheet
    circle = ResourceLoader.getInstance().timeSpriteSheet;
    circle.setFilter(Image.FILTER_NEAREST);
    timeAnimation = new Animation(circle, 0, 0, 26, 0, true, 1, true);
    timeAnimation.setLooping(false);

    // Calculate the animation speed based on the Time Limit
    this.timeLimit = timeLimit;
    animationSpeed = 1000f / timeLimit / ((float)timeAnimation.getFrameCount() - 1f);
    timeAnimation.setSpeed(animationSpeed);
}
项目:MMO-Rulemasters-World    文件:Entity.java   
public void render(Graphics g)
{
    for (Animation[] animations : mAnimations) {
        if (animations[mDirection] != null) {
   //           g.drawAnimation(mAnimations[mDirection], mPosition.x - mSize.x / 2, mPosition.y - mSize.y / 2);
            animations[mDirection].draw(mPosition.x - mSize.x / 2, mPosition.y - mSize.y / 2, mSize.x, mSize.y);
        } else if (animations[0] != null) {
            animations[0].draw(mPosition.x - mSize.x / 2, mPosition.y - mSize.y / 2, mSize.x, mSize.y);
        }
    }

    if (mGameMode.isDebug()) {
        g.draw(mBounds);
        if (mVision != null) {
            g.draw(mVision);
        }
    }
}
项目:MMO-Rulemasters-World    文件:OnlineEntity.java   
public void setSkin() {
    for (String skin : mSkinParts) {
        Image img = (Image) DatasManager.getInstance().getFile(skin);
        SpriteSheet s = new SpriteSheet(img, img.getWidth() / 3, img.getHeight() / 4);
        Animation[] anim = new Animation[8];
        anim[0] = loadAnimation(s, 0, 0, 3); // Haut
        anim[1] = loadAnimation(s, 0, 1, 3); // Gauche
        anim[2] = loadAnimation(s, 0, 2, 3); // Droite
        anim[3] = loadAnimation(s, 0, 3, 3); // Bas
        anim[4] = loadAnimation(s, 1, 0, 2); // Haut qui bouge pas
        anim[5] = loadAnimation(s, 1, 1, 2); // Gauche qui bouge pas
        anim[6] = loadAnimation(s, 1, 2, 2); // Droite qui bouge pas
        anim[7] = loadAnimation(s, 1, 3, 2); // Bas qui bouge pas
        mAnimations.add(anim);
    }
}
项目:Gorillaz    文件:AnimationRenderComponent.java   
/**
 * Create a new AnimationRenderComponent based on the information provided
 *
 * @param frames
 *          the individual animation frames to be displayed in order
 * @param speed
 *          the speed at which the images change
 * @param width
 *          the width of the images
 * @param height
 *          the height of the images
 * @param looping
 *          whether the first frame shall be displayed when the animation is
 *          over or not.
 */
public AnimationRenderComponent(Image[] frames, float speed, float width, float height, boolean looping) {
    super("AnimationRenderComponent");

    // set the size for this component
    size = new Vector2f(width, height);

    // create a new Animation object based on the frames with a duration of 1
    animation = new Animation(frames, 1);

    // assign the other parameters (speed, looping mode)
    animation.setSpeed(speed);
    animation.setLooping(looping);

    // start the animation
    animation.start();
}
项目:GPVM    文件:PackedSheetTest.java   
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
    this.container = container;

    sheet = new PackedSpriteSheet("testdata/testpack.def", Image.FILTER_NEAREST);
    rocket = sheet.getSprite("rocket");

    SpriteSheet anim = sheet.getSpriteSheet("runner");
    runner = new Animation();

    for (int y=0;y<2;y++) {
        for (int x=0;x<6;x++) {
            runner.addFrame(anim.getSprite(x,y), 50);
        }
    }
}
项目:GPVM    文件:AnimationTest.java   
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
    this.container = container;

    SpriteSheet sheet = new SpriteSheet("testdata/homeranim.png", 36, 65);
    animation = new Animation();
    for (int i=0;i<8;i++) {
        animation.addFrame(sheet.getSprite(i,0), 150);
    }
    limited = new Animation();
    for (int i=0;i<8;i++) {
        limited.addFrame(sheet.getSprite(i,0), 150);
    }
    limited.stopAt(7);
    manual = new Animation(false);
    for (int i=0;i<8;i++) {
        manual.addFrame(sheet.getSprite(i,0), 150);
    }
    pingPong = new Animation(sheet, 0,0,7,0,true,150,true);
    pingPong.setPingPong(true);
    container.getGraphics().setBackground(new Color(0.4f,0.6f,0.6f));
}
项目:SpaceStationAlpha    文件:PackedSheetTest.java   
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
    this.container = container;

    sheet = new PackedSpriteSheet("testdata/testpack.def", Image.FILTER_NEAREST);
    rocket = sheet.getSprite("rocket");

    SpriteSheet anim = sheet.getSpriteSheet("runner");
    runner = new Animation();

    for (int y=0;y<2;y++) {
        for (int x=0;x<6;x++) {
            runner.addFrame(anim.getSprite(x,y), 50);
        }
    }
}
项目:SpaceStationAlpha    文件:AnimationTest.java   
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
    this.container = container;

    SpriteSheet sheet = new SpriteSheet("testdata/homeranim.png", 36, 65);
    animation = new Animation();
    for (int i=0;i<8;i++) {
        animation.addFrame(sheet.getSprite(i,0), 150);
    }
    limited = new Animation();
    for (int i=0;i<8;i++) {
        limited.addFrame(sheet.getSprite(i,0), 150);
    }
    limited.stopAt(7);
    manual = new Animation(false);
    for (int i=0;i<8;i++) {
        manual.addFrame(sheet.getSprite(i,0), 150);
    }
    pingPong = new Animation(sheet, 0,0,7,0,true,150,true);
    pingPong.setPingPong(true);
    container.getGraphics().setBackground(new Color(0.4f,0.6f,0.6f));
}
项目:cretion    文件:PackedSheetTest.java   
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
    this.container = container;

    sheet = new PackedSpriteSheet("testdata/testpack.def", Image.FILTER_NEAREST);
    rocket = sheet.getSprite("rocket");

    SpriteSheet anim = sheet.getSpriteSheet("runner");
    runner = new Animation();

    for (int y=0;y<2;y++) {
        for (int x=0;x<6;x++) {
            runner.addFrame(anim.getSprite(x,y), 50);
        }
    }
}
项目:cretion    文件:AnimationTest.java   
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
    this.container = container;

    SpriteSheet sheet = new SpriteSheet("testdata/homeranim.png", 36, 65);
    animation = new Animation();
    for (int i=0;i<8;i++) {
        animation.addFrame(sheet.getSprite(i,0), 150);
    }
    limited = new Animation();
    for (int i=0;i<8;i++) {
        limited.addFrame(sheet.getSprite(i,0), 150);
    }
    limited.stopAt(7);
    manual = new Animation(false);
    for (int i=0;i<8;i++) {
        manual.addFrame(sheet.getSprite(i,0), 150);
    }
    pingPong = new Animation(sheet, 0,0,7,0,true,150,true);
    pingPong.setPingPong(true);
    container.getGraphics().setBackground(new Color(0.4f,0.6f,0.6f));
}
项目:DosimOnline.Models    文件:Nazi.java   
public Nazi(float x, float y) throws SlickException {
    super(x, y);

    dos = null;
    lifeAddTimeout = new Random().nextInt(30);

    naziSheet = new SpriteSheet("org/dosimonline/res/sprites/nazi.png", 20,
            55);
    naziWalkLeft = new Animation();
    naziWalkLeft.setAutoUpdate(true);
    naziWalkLeft.addFrame(
            naziSheet.getSprite(0, 0).getFlippedCopy(true, false), 150);
    naziWalkLeft.addFrame(
            naziSheet.getSprite(1, 0).getFlippedCopy(true, false), 150);

    naziWalkRight = new Animation();
    naziWalkRight.setAutoUpdate(true);
    naziWalkRight.addFrame(naziSheet.getSprite(0, 0), 150);
    naziWalkRight.addFrame(naziSheet.getSprite(1, 0), 150);

    addType("Anti Semitic"); // Gilnaa: lol wut
    setHitBox(0, 20, 20, 35);
}
项目:aphelion    文件:SwissArmyKnife.java   
public static @Nonnull Animation spriteToAnimation(@Nonnull Image img, int horizontalTiles, int verticalTiles, int frameDuration)
{
        SpriteSheet sheet = new SpriteSheet(img, img.getWidth() / horizontalTiles, img.getHeight() / verticalTiles);
        Animation anim = new Animation();

        anim.setAutoUpdate(true);
        for (int y = 0; y < sheet.getVerticalCount(); y++)
        {
                for (int x = 0; x < sheet.getHorizontalCount(); x++)
                {
                        anim.addFrame(sheet.getSprite(x, y), frameDuration);
                }
        }

        return anim;
}
项目:slick2d-maven    文件:PackedSheetTest.java   
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
    this.container = container;

    sheet = new PackedSpriteSheet("testdata/testpack.def", Image.FILTER_NEAREST);
    rocket = sheet.getSprite("rocket");

    SpriteSheet anim = sheet.getSpriteSheet("runner");
    runner = new Animation();

    for (int y=0;y<2;y++) {
        for (int x=0;x<6;x++) {
            runner.addFrame(anim.getSprite(x,y), 50);
        }
    }
}
项目:slick2d-maven    文件:AnimationTest.java   
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
    this.container = container;

    SpriteSheet sheet = new SpriteSheet("testdata/homeranim.png", 36, 65);
    animation = new Animation();
    for (int i=0;i<8;i++) {
        animation.addFrame(sheet.getSprite(i,0), 150);
    }
    limited = new Animation();
    for (int i=0;i<8;i++) {
        limited.addFrame(sheet.getSprite(i,0), 150);
    }
    limited.stopAt(7);
    manual = new Animation(false);
    for (int i=0;i<8;i++) {
        manual.addFrame(sheet.getSprite(i,0), 150);
    }
    pingPong = new Animation(sheet, 0,0,7,0,true,150,true);
    pingPong.setPingPong(true);
    container.getGraphics().setBackground(new Color(0.4f,0.6f,0.6f));
}
项目:square-loot    文件:Player.java   
public Player(Vector2f pos) {
    super(pos);
    oxygenConsumptionPerSecond = (int) ConfigManager.playerOxygenConsumption;
    this.gbtype = GameBodyType.PLAYER;
    this.setMaxHealth(20);
    this.setHealth(20);
    this.accFactor = ConfigManager.playerAcc;
    halfSize.set(0.4f, 0.4f);
    try {
        headSprites = new SpriteSheet("assets/textures/animperso.png",256,256);
        headAnimation = new Animation(headSprites, 600);
        headAnimation.setPingPong(true);
        bodySprites = new SpriteSheet("assets/textures/playerBody.png",256,256);
        featherSprites = new SpriteSheet("assets/textures/feather.png",256,256);
        featherAnimation = new Animation(featherSprites, 50);
        featherAnimation.setPingPong(true);
    } catch (SlickException e) {
        e.printStackTrace();
    }

    inventory = new Inventory(5,this);
    actionZone = new ActionZone(actionRange, position.x, position.y);
    actionZone.init();
}
项目:Sharktron    文件:DrawableGameComponent.java   
/**
 * Calculates the bounding box and returns it as Slick2D Rectangle
 *
 * @return The current bounding box of the GFX
 */
private Rectangle calculateBoundingBox()
{
    if (this.gfx.getClass() == Image.class)
    {
        return new Rectangle(this.getPosition().getX(), this.getPosition().getY(), ((Image) this.gfx).getWidth(), ((Image) this.gfx).getHeight());
    }
    else if (this.gfx.getClass() == Animation.class)
    {
        return new Rectangle(this.getPosition().getX(), this.getPosition().getY(), ((Animation) this.gfx).getWidth(), ((Animation) this.gfx).getHeight());
    }
    else
    {
        return new Rectangle(0, 0, 0, 0);
    }

}
项目:trashjam2017    文件:SlickCallableTest.java   
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
    image = new Image("testdata/rocket.png");
    back = new Image("testdata/sky.jpg");
    font = new AngelCodeFont("testdata/hiero.fnt","testdata/hiero.png");
    SpriteSheet sheet = new SpriteSheet("testdata/homeranim.png", 36, 65);
    homer = new Animation(sheet, 0,0,7,0,true,150,true);
}
项目:Projet-PLA    文件:WindowGame.java   
private Animation loadAnimation(SpriteSheet spriteSheet, int startX, int endX, int y) {
    Animation animation = new Animation();
    for (int x = startX; x < endX; x++) {
        animation.addFrame(spriteSheet.getSprite(x, y), 100);
    }
    return animation;
}
项目:Progetto-C    文件:SlickCallableTest.java   
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
    image = new Image("testdata/rocket.png");
    back = new Image("testdata/sky.jpg");
    font = new AngelCodeFont("testdata/hiero.fnt","testdata/hiero.png");
    SpriteSheet sheet = new SpriteSheet("testdata/homeranim.png", 36, 65);
    homer = new Animation(sheet, 0,0,7,0,true,150,true);
}
项目:HCMIU_PlantsAndZombies    文件:AnimationLoader.java   
/**
 * Get Animation by load all PNG file in specific folder by name order
 * @param directory Images folder
 * @param duration  Duration of each frame
 * @return  Animation
 */
public static Animation getAnimationFromFolder(String directory, int duration) {
    Animation temp = new Animation();
    String[] imgs = getFiles(directory, "png");
    for (int i=0; i<imgs.length; i++) {
        try {
            temp.addFrame(new Image(directory+"/"+imgs[i]), duration);
        } catch (SlickException e) {
            e.printStackTrace();
        }
    }
    return temp;
}
项目:HCMIU_PlantsAndZombies    文件:AnimationLoader.java   
/**
 * Get Animation by finding loaded Animation as Class name
 * @param _className Class
 * @return  Animation
 */
public static Animation getAnimation(Class _className) {
    for (int i=0; i<aniList.size(); i++) {
        //if (aniList.get(i).get_class().getSimpleName().equals(_className.getSimpleName())) {
        if (aniList.get(i).get_class() == _className) {
            return aniList.get(i).getAni().copy();
        }
    }
    return null;
}
项目:BaseClient    文件:SlickCallableTest.java   
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
    image = new Image("testdata/rocket.png");
    back = new Image("testdata/sky.jpg");
    font = new AngelCodeFont("testdata/hiero.fnt","testdata/hiero.png");
    SpriteSheet sheet = new SpriteSheet("testdata/homeranim.png", 36, 65);
    homer = new Animation(sheet, 0,0,7,0,true,150,true);
}
项目:opsu-dance    文件:MenuButton.java   
/**
 * Creates a new button from an Animation.
 * @param anim the animation
 * @param x the center x coordinate
 * @param y the center y coordinate
 */
public MenuButton(Animation anim, float x, float y) {
    this.anim = anim;
    this.x = x;
    this.y = y;
    this.xRadius = anim.getWidth() / 2f;
    this.yRadius = anim.getHeight() / 2f;
}
项目:p2_java_plateformed2d    文件:Character.java   
protected HashMap<Facing, Animation> setMovingAnimation(Image[] images, int frameDuration,
    HashMap<Facing, Animation> movingAnim) {
movingAnim = new HashMap<Facing, Animation>();

movingAnim.put(Facing.RIGHT, new Animation(images, frameDuration));

Animation facingLeftAnimation = new Animation();
for (Image i : images) {
    facingLeftAnimation.addFrame(i.getFlippedCopy(true, false), frameDuration);
}
movingAnim.put(Facing.LEFT, facingLeftAnimation);
return movingAnim;

   }
项目:p2_java_plateformed2d    文件:Explosion.java   
public Explosion(float x, float y) throws SlickException {
super(x, y);
this.x_velocity = 0;
this.y_velocity = 0;
time1 = System.currentTimeMillis();
time2 = System.currentTimeMillis();
damage = 10;

Image img00 = new Image("ressources/tiles/item/regularExplosion00.png");
Image img01 = new Image("ressources/tiles/item/regularExplosion01.png");
Image img02 = new Image("ressources/tiles/item/regularExplosion02.png");
Image img03 = new Image("ressources/tiles/item/regularExplosion03.png");
Image img04 = new Image("ressources/tiles/item/regularExplosion04.png");
Image img05 = new Image("ressources/tiles/item/regularExplosion05.png");
Image img06 = new Image("ressources/tiles/item/regularExplosion06.png");
Image img07 = new Image("ressources/tiles/item/regularExplosion07.png");
Image img08 = new Image("ressources/tiles/item/regularExplosion08.png");

img00 = img00.getScaledCopy(1.5f);
img01 = img01.getScaledCopy(1.5f);
img02 = img02.getScaledCopy(1.5f);
img03 = img03.getScaledCopy(1.5f);
img04 = img04.getScaledCopy(1.5f);
img05 = img05.getScaledCopy(1.5f);
img06 = img06.getScaledCopy(1.5f);
img07 = img07.getScaledCopy(1.5f);
img08 = img08.getScaledCopy(1.5f);

animation = new Animation(new Image[] { img00, img01, img02, img03, img04, img05, img06, img07, img08 }, 60,
    true);

boundingShape = new AABoundingRect(x, y, 200, 200);
maximumFallSpeed = 0;
   }
项目:p2_java_plateformed2d    文件:Projectile.java   
public Projectile(float x, float y) throws SlickException {
super(x, y);
x_velocity = 1;
y_velocity = 0;
damage = 1;
animation = new Animation(new Image[] { new Image("ressources/tiles/item/laserRed02.png") }, 125);
boundingShape = new AABoundingRect(x, y, 15, 15);
maximumFallSpeed = 0.0f;

   }
项目:p2_java_plateformed2d    文件:MuzzleFlash.java   
public MuzzleFlash(float x, float y) throws SlickException {
super(x, y);
x_velocity = 0;
y_velocity = 0;
maximumFallSpeed = 0;
time1 = System.currentTimeMillis();
time2 = System.currentTimeMillis();

Image img00 = new Image("ressources/tiles/item/flash00.png");
Image img01 = new Image("ressources/tiles/item/flash01.png");
Image img02 = new Image("ressources/tiles/item/flash02.png");
Image img03 = new Image("ressources/tiles/item/flash03.png");
Image img04 = new Image("ressources/tiles/item/flash04.png");
Image img05 = new Image("ressources/tiles/item/flash05.png");
Image img06 = new Image("ressources/tiles/item/flash06.png");
Image img07 = new Image("ressources/tiles/item/flash07.png");
Image img08 = new Image("ressources/tiles/item/flash08.png");

img00 = img00.getScaledCopy(0.1f);
img01 = img01.getScaledCopy(0.1f);
img02 = img02.getScaledCopy(0.1f);
img03 = img03.getScaledCopy(0.1f);
img04 = img04.getScaledCopy(0.1f);
img05 = img05.getScaledCopy(0.1f);
img06 = img06.getScaledCopy(0.1f);
img07 = img07.getScaledCopy(0.1f);
img08 = img08.getScaledCopy(0.1f);

animation = new Animation(new Image[] { img00, img01, img02, img03, img04, img05, img06, img07, img08 }, 10,
    true);

boundingShape = new AABoundingRect(x, y, 200, 200);
   }
项目:Java-2D-Game    文件:Sprite.java   
public Sprite() throws SlickException {

        //lokalizacja avataru
        imgSprite = new Image("graphic/heroSprite/avatar" + GameStatus.spriteNumber + ".png");

        //ilość klatek na szerokość
        int widthSubImageLength = 6;

        //rozmiar avataru
        this.heroHeight = imgSprite.getHeight() / 4;
        this.heroWidth = imgSprite.getWidth() / widthSubImageLength;

        Image[] walkDown = new Image[widthSubImageLength];
        Image[] walkLeft = new Image[widthSubImageLength];
        Image[] walkRight = new Image[widthSubImageLength];
        Image[] walkUp = new Image[widthSubImageLength];

        for (int w = 0, h = 0; w < imgSprite.getWidth(); w += heroWidth) {
            walkDown[h] = imgSprite.getSubImage(w, heroHeight * 0, heroWidth, heroHeight);
            walkUp[h] = imgSprite.getSubImage(w, heroHeight * 1, heroWidth, heroHeight);
            walkLeft[h] = imgSprite.getSubImage(w, heroHeight * 2, heroWidth, heroHeight);
            walkRight[h] = imgSprite.getSubImage(w, heroHeight * 3, heroWidth, heroHeight);
            h++;
        }

        //animacja avatar
        movingDown = new Animation(walkDown, duration, false);
        movingLeft = new Animation(walkLeft, duration, false);
        movingRight = new Animation(walkRight, duration, false);
        movingUp = new Animation(walkUp, duration, false);

        //ustawienie początkowego położenia avatar
        avatar = movingDown;
    }