Package plar.core

Examples of plar.core.SpriteSet


        int maxFiring = 50;
        HashMap<String, SpriteSet> spriteSet;

        public SpriteManager() {
            spriteSet = new HashMap<String, SpriteSet>();
            spriteSet.put("move_right", new SpriteSet());
            spriteSet.put("move_left", new SpriteSet());
            spriteSet.put("stop_right", new SpriteSet());
            spriteSet.put("stop_left", new SpriteSet());
            spriteSet.put("fire_left", new SpriteSet());
            spriteSet.put("fire_right", new SpriteSet());
            spriteSet.put("down_left", new SpriteSet());
            spriteSet.put("down_right", new SpriteSet());

            String p = "res/players/squeak/";
            spriteSet.get("stop_right").add(new Sprite(p + "squeakr.png", 0.1f));
            spriteSet.get("stop_left").add(new Sprite(p + "squeakl.png", 0.1f));
            spriteSet.get("move_right").add(new Sprite(p + "squeakmr0.png", 0.1f));
View Full Code Here


        HashMap<String, SpriteSet> spriteSet;

        public SpriteManager() {
            spriteSet = new HashMap<String, SpriteSet>();
            spriteSet.put("none",null);
            spriteSet.put("move_right", new SpriteSet());
            spriteSet.put("move_left", new SpriteSet());
            spriteSet.put("jump_right", new SpriteSet());
            spriteSet.put("jump_left",new SpriteSet());
            spriteSet.put("stop_right",new SpriteSet());
            spriteSet.put("stop_left",new SpriteSet());
            spriteSet.put("fire_left",new SpriteSet());
            spriteSet.put("fire_right",new SpriteSet());
            spriteSet.put("jumpfire_left",new SpriteSet());
            spriteSet.put("jumpfire_right", new SpriteSet());
            spriteSet.put("down_left",new SpriteSet());
            spriteSet.put("down_right", new SpriteSet());
            String p = "res/players/kittycat/";

            spriteSet.get("stop_right").add(
                new Sprite(p+"kittysr.png", 0.1f));
            spriteSet.get("stop_left").add(
View Full Code Here

        int maxFiring = 50;
        HashMap<String, SpriteSet> spriteSet;

        public SpriteManager() {
            spriteSet = new HashMap<String, SpriteSet>();
            spriteSet.put("move_right", new SpriteSet());
            spriteSet.put("move_left", new SpriteSet());
            spriteSet.put("jump_right", new SpriteSet());
            spriteSet.put("jump_left", new SpriteSet());
            spriteSet.put("stop_right", new SpriteSet());
            spriteSet.put("stop_left", new SpriteSet());
            spriteSet.put("fire_left", new SpriteSet());
            spriteSet.put("fire_right", new SpriteSet());
            spriteSet.put("pogo", new SpriteSet());
            spriteSet.put("jumpfire_left", new SpriteSet());
            spriteSet.put("jumpfire_right", new SpriteSet());
            spriteSet.put("down_left", new SpriteSet());
            spriteSet.put("down_right", new SpriteSet());
            String p = "res/players/qeen/";
            spriteSet.get("pogo").add(new Sprite(p + "queenp.png", 0.1f));
            spriteSet.get("stop_right").add(new Sprite(p + "queensr.png", 0.1f));
            spriteSet.get("stop_left").add(new Sprite(p + "queensl.png", 0.1f));
            spriteSet.get("move_right").add(new Sprite(p + "queenrr0.png", 0.1f));
View Full Code Here

    public AABB explosionRelativeRectangle;
    public int explosionDamage;

    public Mine() {
        super();
        currentSpriteSet = new SpriteSet();
        currentSpriteSet.autoSize = false;
        Common.info(1, "nuova mina!");
        explosionTime = 5;
        lifeTime = 6;
        ActionLifeTimer alt = new ActionLifeTimer();
        actions.addAction("alt", alt);
        actions.addAction("mine", new ActionTimer("",explosionTime,0,false) {


            public Object force(Object o) {

                Mine mme = (Mine) me;
                AABB rr = new AABB(mme.explosionRelativeRectangle);
                Vec2 c = me.body.getWorldCenter();
                AABB ar = new AABB(new Vec2(c.x + rr.lowerBound.x/2, c.y
                                            + rr.lowerBound.y/2), new Vec2(c.x + rr.upperBound.x/2,
                                                    c.y + rr.upperBound.y/2)

                                  );

                ArrayList<Fixture>  ss =  Common
                                          .queryAABB(level.world, ar);


                currentSpriteSet = new SpriteSet();
                currentSpriteSet.autoSize=false;
                currentSpriteSet.add(mme.explosionSprite);
                //  Common.info(1,"sprite is now:"+ currentSpriteSet.get(0).getFileName());
                for (Fixture s : ss) {
                    Element p = (Element) s.getBody().getUserData();
View Full Code Here

    }
    Sprite explosionSprite;
    public void setBody(Body b)
    {   super.setBody(b);
        Common.info(1,"currentSETBOFY");
        currentSpriteSet = new SpriteSet();

        Sprite mineSprite = new Sprite("res/elements/mine.png", explosionTime);
        mineSprite.sizex = getSize().x;
        mineSprite.sizey = getSize().y;
        explosionSprite = new Sprite("res/elements/explosion0.png", lifeTime-explosionTime);
        Common.info(1,"explosion estentss x:"+explosionRelativeRectangle.getExtents().x);
        explosionSprite.sizex = explosionRelativeRectangle.getExtents().x;
        explosionSprite.sizey = explosionRelativeRectangle.getExtents().y;
        currentSpriteSet = new SpriteSet();
        currentSpriteSet.add(mineSprite);
        //currentSpriteSet.add(explosionSprite);

        currentSpriteSet.autoSize=false;
    }
View Full Code Here

    }

    byte signal = Signal.getSignal(data);
    data = Signal.getData(data);
    if (signal == Signal.SPRITE) {
      SpriteSet o = null;

      try {

        o = (SpriteSet) Signal.toObject(data);
      } catch (IOException ex) {
        ex.printStackTrace();
      } catch (ClassNotFoundException ex) {
        ex.printStackTrace();
      }
      if (o != null)
      buffer.add(o);
      Common.info(1,"new SpriteSet :"+o.get(0).getFileName());
    }
    if (signal == Signal.SCREEN) {
      synchronized (screen)
      {
        screen.clear();
        // Common.info(7,"parsing screen"+data.length);
        //int N = 5;
        int N = 4;
        int dimE=2;
       
        for (int i = 0; i < (int) (data.length / (N*2)); i++) {

          /*
      byte[] z = new byte[N + 1];
        z[0] = (int)data[0 + i * N];
        z[1] = (int)data[1 + i * N];
        z[2] = (int)data[2 + i * N];
        z[3] = (int)data[3 + i * N];
        z[4] = data[4 + i * N];
        z[5] = 0;
      *//*
        short[] z = new short[N + 1];
        z[0] = (short)pezzi[0 + i * N];
        z[1] = (short)pezzi[1 + i * N];
        z[2] = (short)pezzi[2 + i * N];
        z[3] = (short)pezzi[3 + i * N];
        /*z[4] = data[4 + i * N];
        z[5] = 0;
        */
         
          // int[] dati = Signal.from6ByteTo5Int(z);
          /*int x = dati[0];
        int y = dati[1];
        int t = dati[2];
        int d = dati[3];
        float theta = t / 100f;*/
          /*
        int x=(int)z[0];
        int y=(int)z[1];
        int t=(int)z[2];
        int d=(int)z[3];*/
         
         
          int x=(int) Signal.from2ByteTo1Short(data[0 + i * N*2],data[0 + i * N*2 +1]);
          int y=(intSignal.from2ByteTo1Short(data[1*2 + i * N*2 ],data[1*2 + i * N*2 + 1]);       
          int t=(intSignal.from2ByteTo1Short(data[2*2 + i * N*2 ],data[2*2 + i * N*2 + 1]);
          int d=(intSignal.from2ByteTo1Short(data[3*2 + i * N*2 ],data[3*2 + i * N*2 + 1]);/*
        Common.info(1,"sending: "+x+" "+y+" "+d+" "+t);
        Common.info(1," d="  +Signal.from2ByteTo1Short(data[1*2 + i * N*2 ],data[1*2 + i * N*2 + 1])+" ; "
                  +Signal.from2ByteTo1Short(data[1*2 + i * N*2 +1],data[1*2 + i * N*2 ])+" ;"+d);
      Common.info(1," t="  +Signal.from2ByteTo1Short(data[3*2 + i * N *2],data[3*2 + i * N*2 + 1])+" ; "
                  +Signal.from2ByteTo1Short(data[3*2 + i * N*2 +1],data[3*2 + i * N*2 ])+" ;"+t);
                 
                 
                  Common.info(1,"sending: "+x+":["+data[0 + i * 2*N]+" "+data[1 + i *2* N]+"]"
                    +y+":["+data[2 + i *2* N]+" "+data[3 + i *2* N]+"]"
                    +t+":["+data[4 + i *2* N]+" "+data[5 + i *2* N]+"]"
                    +d+":["+data[6 + i *2* N]+" "+data[7 + i *2* N]+"]"
                    );
                    */
          /*        Common.info(1," s="  +Signal.from2ByteTo1Short((byte)0x01,(byte)0x00)+" ; "
                  +Signal.from2ByteTo1Short((byte)0x00,(byte)0x01)+" ; "
                  +Signal.from2ByteTo1Short((byte)0x01,(byte)0x01));*/
          float theta = t / 1000f;
          // int d = dati[4];
          // float t= ((byte)data[6+i*7]*255)*3.14f;
          // Common.info(7,"x="+x+" y="+y+" t="+t+" d="+d+" theta+"+theta);

          // Common.info(7,"x="+x+"y="+y+"w="+w+"h="+h+"d="+d);
          // if(w==0 && h==0 && x==0 && y==0 && d==0)
          // i=data.length;else
          // {
          ShownElement e;
          SpriteSet thisSS;
          if (d < buffer.size()) {
            // e = new ShownElement(new
            // Rectangle(x,y,w,h),buffer.get(d),0f);
            thisSS = buffer.get(d);
            // e = new ShownElement(new Point(x,y),,theta);

          } else {
            // Common.info(7,"received a block with no sprite! :( "+d);
            thisSS = new SpriteSet();
          }
          e = new ShownElement(new Point(x, y), thisSS, theta);
          screen.add(e);

          // }
View Full Code Here

TOP

Related Classes of plar.core.SpriteSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.