Package com.pointcliki.dizgruntled.map

Examples of com.pointcliki.dizgruntled.map.MapEntity


   
    // Create human player
    fHuman = new HumanPlayer("human");
    fPlayerManager.add(fHuman);
               
    final MapEntity fMapViewer = new MapEntity(fMapManager.map(), new Vector2f(fGame.application().getScreenWidth(), fGame.application().getScreenHeight()));
    addChild(fMapViewer);
    fMapViewer.init();
   
    Minion<TimeEvent> scroller = new Minion<TimeEvent>() {
      public long run(com.pointcliki.event.Dispatcher<TimeEvent> dispatcher, String type, TimeEvent event) {
        if (GruntzGame.inputManager().isKeyPressed(Keyboard.KEY_RIGHT)) fMapViewer.offset(new Vector2f(Math.min(Math.max(fMapViewer.offset().x - event.delta() / 2f, -fMapViewer.map().width() * 32f + fSW), 0), fMapViewer.offset().y));
        else if (GruntzGame.inputManager().isKeyPressed(Keyboard.KEY_LEFT)) fMapViewer.offset(new Vector2f(Math.min(Math.max(fMapViewer.offset().x + event.delta() / 2f, -fMapViewer.map().width() * 32 + fSW), 0), fMapViewer.offset().y));
        if (GruntzGame.inputManager().isKeyPressed(Keyboard.KEY_DOWN)) fMapViewer.offset(new Vector2f(fMapViewer.offset().x, Math.min(Math.max(fMapViewer.offset().y - event.delta() / 2f, -fMapViewer.map().height() * 32 + fSH), 0)));
        else if (GruntzGame.inputManager().isKeyPressed(Keyboard.KEY_UP)) fMapViewer.offset(new Vector2f(fMapViewer.offset().x, Math.min(Math.max(fMapViewer.offset().y + event.delta() / 2f, -fMapViewer.map().height() * 32 + fSH), 0)));
        return Minion.CONTINUE;       
      };
    };
    timeManager().dispatcher().addMinion(TimeEvent.TYPE, scroller);
   
View Full Code Here


  }
 
  private void setupMapViewer() {
    fMapManager.map().editing(true);

    fMapViewer = new MapEntity(fMapManager.map(), new Vector2f(fSW - 176, fSH - 40));
    fMapViewer.offset(new Vector2f(16, 16));
    fMapViewer.position(new Vector2f(0, 28));
    addChild(fMapViewer, 0);
    fMapViewer.init();
   
View Full Code Here

TOP

Related Classes of com.pointcliki.dizgruntled.map.MapEntity

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.