/** * @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); } } }
@Override public void init(GameContainer container, StateBasedGame game) throws SlickException { CHANGE_SEASON_SIZE = 150; CHANGE_SEASON_PADDING = 150; this.initProcessor(container, game); this.pressed = new LinkedList<TouchPosition>(); this.vibration = (Vibrator)AndroidLoader.ANDROID_CONTEXT.getSystemService(Context.VIBRATOR_SERVICE); //Obt�m as imagens dos controles. PackedSpriteSheet pack = new PackedSpriteSheet("data/sprites/control.def", Image.FILTER_NEAREST); this.controls = new Image[3]; this.controls[0] = pack.getSprite("control_left"); this.controls[1] = pack.getSprite("control_right"); this.controls[2] = pack.getSprite("control_up"); //Posi��es dos bot�es do controle. this.left = new Rectangle(5, 347, 80, 128); this.right = new Rectangle(85, 347, 80, 128); this.up = new Rectangle(667, 347, 128, 128); this.lastDragPoint = new Vec2(0,0); }
/** * Realiza carregamento de sprites de um pack. * @param name Nome-base das imagens no sprite a serem carregadas. * @param pack Pacote de sprites. * @param flip Indica se se deve inverter o sprite horizontalmente. * @return Array contendo as imagens carregadas. */ public static Image[] loadSprites(String name, PackedSpriteSheet pack) { Image[] img = new Image[20]; for (int i = 1; i <= 20; i++) img[i - 1] = pack.getSprite(name + "_" + String.valueOf(i)); return img; }
protected void initProcessor(GameContainer container, StateBasedGame game) throws SlickException { this.listeners = new LinkedList<GameInputListener>(); this.seasons = new Image[4]; PackedSpriteSheet pack = new PackedSpriteSheet("data/sprites/seasons.def", Image.FILTER_NEAREST); this.seasons[0] = pack.getSprite("spring"); this.seasons[1] = pack.getSprite("summer"); this.seasons[2] = pack.getSprite("autumn"); this.seasons[3] = pack.getSprite("winter"); //Inicia o jogo no ver�o. this.lastSeason = this.currentSeason = this.hookOnSeason = Seasons.Summer; this.isPaused = false; }