当前位置: 首页>>代码示例>>Java>>正文


Java LayerableModel类代码示例

本文整理汇总了Java中com.b3dgs.lionengine.game.feature.LayerableModel的典型用法代码示例。如果您正苦于以下问题:Java LayerableModel类的具体用法?Java LayerableModel怎么用?Java LayerableModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LayerableModel类属于com.b3dgs.lionengine.game.feature包,在下文中一共展示了LayerableModel类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Mario

import com.b3dgs.lionengine.game.feature.LayerableModel; //导入依赖的package包/类
/**
 * Constructor.
 * 
 * @param services The services reference.
 * @param setup The setup reference.
 */
public Mario(Services services, Setup setup)
{
    super(services, setup);

    addFeature(new LayerableModel(1));
    addFeature(new TransformableModel());
    addFeature(new BodyModel());
    addFeature(new CollidableModel(services, setup));
    addFeature(new TileCollidableModel(services, setup));

    final MarioModel model = new MarioModel(setup);
    addFeature(new MarioController(services, model));
    addFeature(new MarioUpdater(services, model));
    addFeature(new MarioRenderer(services, model));
}
 
开发者ID:b3dgs,项目名称:lionheart-remake,代码行数:22,代码来源:Mario.java

示例2: generate

import com.b3dgs.lionengine.game.feature.LayerableModel; //导入依赖的package包/类
/**
 * Generate a map.
 * 
 * @param services The services reference.
 * @param theme The theme name.
 * @return The generated map.
 */
public static MapTile generate(Services services, String theme)
{
    final MapTile map = services.create(MapTileGame.class);
    map.addFeature(new LayerableModel(Constant.LAYER_MAP));
    map.loadSheets(Medias.create(Constant.FOLDER_TILE, theme, TileSheetsConfig.FILENAME));

    final java.util.Map<TileRef, Media> entities = getEntities(theme);
    final TileSetListener listener = createListener(entities, map, services);
    map.addListener(listener);

    final List<MapTile> maps = getMaps(theme, MAX_LEVELS);

    final Collection<MapTile> levels = new ArrayList<MapTile>();
    for (int i = 0; i < MAX_LEVELS; i++)
    {
        final MapTile current = maps.get(UtilRandom.getRandomInteger(maps.size() - 1));
        levels.add(current);
    }
    map.append(levels, 0, 1, 0, MAX_LEVEL_INTERVAL_HEIGHT_IN_TILE);

    map.removeListener(listener);
    entities.clear();

    return map;
}
 
开发者ID:b3dgs,项目名称:tyrian-remake,代码行数:33,代码来源:Map.java

示例3: Effect

import com.b3dgs.lionengine.game.feature.LayerableModel; //导入依赖的package包/类
/**
 * Create an effect.
 * 
 * @param services The services reference.
 * @param setup The setup reference.
 */
public Effect(Services services, Setup setup)
{
    super(services, setup);

    viewer = services.get(Viewer.class);

    addFeature(new Recycler());
    addFeature(new LayerableModel(Constant.LAYER_EFFECT));
    transformable = addFeatureAndGet(new TransformableModel(setup));

    final EffectModel model = addFeatureAndGet(new EffectModel(setup));
    addFeature(new EffectUpdater(services, model));
    addFeature(new EffectRenderer(model));

    anim = AnimationConfig.imports(setup).getAnimation("start");
    surface = model.getSurface();
}
 
开发者ID:b3dgs,项目名称:tyrian-remake,代码行数:24,代码来源:Effect.java

示例4: Entity

import com.b3dgs.lionengine.game.feature.LayerableModel; //导入依赖的package包/类
/**
 * Create an entity.
 * 
 * @param services The services reference.
 * @param setup The setup reference.
 */
public Entity(Services services, Setup setup)
{
    super(services, setup);

    addFeature(new CollidableModel(services, setup));
    addFeature(new LayerableModel());

    addFeature(new EntityModel(setup));
    addFeature(new EntityUpdater(services, setup));
    addFeature(new EntityRenderer(services));
}
 
开发者ID:b3dgs,项目名称:tyrian-remake,代码行数:18,代码来源:Entity.java

示例5: Projectile

import com.b3dgs.lionengine.game.feature.LayerableModel; //导入依赖的package包/类
/**
 * Create a projectile.
 * 
 * @param services The services reference.
 * @param setup The setup reference.
 */
public Projectile(Services services, Setup setup)
{
    super(services, setup);

    addFeature(new Recycler());
    addFeature(new LayerableModel(Constant.LAYER_PROJECTILES));
    addFeature(new TransformableModel(setup));
    addFeature(new LaunchableModel());
    addFeature(new CollidableModel(services, setup));

    final ProjectileModel model = addFeatureAndGet(new ProjectileModel(setup));
    addFeature(new ProjectileUpdater(services, model));
    addFeature(new ProjectileRenderer(model));
}
 
开发者ID:b3dgs,项目名称:tyrian-remake,代码行数:21,代码来源:Projectile.java

示例6: Bonus

import com.b3dgs.lionengine.game.feature.LayerableModel; //导入依赖的package包/类
/**
 * Create an entity.
 * 
 * @param services The services reference.
 * @param setup The setup reference.
 */
public Bonus(Services services, Setup setup)
{
    super(services, setup);

    addFeature(new TransformableModel(setup));
    addFeature(new CollidableModel(services, setup));
    addFeature(new LayerableModel());

    final BonusModel model = addFeatureAndGet(new BonusModel(setup));
    addFeature(new BonusUpdater(services, model));
    addFeature(new BonusRenderer(model));
}
 
开发者ID:b3dgs,项目名称:tyrian-remake,代码行数:19,代码来源:Bonus.java

示例7: Weapon

import com.b3dgs.lionengine.game.feature.LayerableModel; //导入依赖的package包/类
/**
 * Create a weapon.
 * 
 * @param services The services reference.
 * @param setup The setup reference.
 */
public Weapon(Services services, WeaponSetup setup)
{
    super(services, setup);

    addFeature(new LayerableModel(Constant.LAYER_PROJECTILES));
    addFeatureAndGet(new TransformableModel(setup));
    addFeature(new LauncherModel(services, setup));

    final WeaponModel model = addFeatureAndGet(new WeaponModel(setup));
    addFeature(new WeaponUpdater(model));
}
 
开发者ID:b3dgs,项目名称:tyrian-remake,代码行数:18,代码来源:Weapon.java

示例8: World

import com.b3dgs.lionengine.game.feature.LayerableModel; //导入依赖的package包/类
/**
 * Create the world.
 * 
 * @param context The context reference.
 * @param services The services reference.
 */
public World(Context context, Services services)
{
    super(context, services);

    final Resolution source = context.getConfig().getSource();
    camera.setView(VIEW_X, VIEW_Y, source.getWidth() - VIEW_X, source.getHeight() - VIEW_Y, source.getHeight());

    handler.addComponent(new ComponentCollision());

    map.addFeature(new MapTileViewerModel(services));
    map.addFeature(new MapTilePersisterModel(services));
    map.addFeature(new MapTileGroupModel());
    map.addFeature(new MapTilePathModel(services));
    handler.add(map);

    final Hud hud = factory.create(Medias.create("Hud.xml"));
    handler.add(hud);

    final Selector selector = services.get(Selector.class);
    selector.addFeature(new LayerableModel(Constant.LAYER_SELECTION, Constant.LAYER_SELECTION_RENDER));
    selector.setClickableArea(camera);
    selector.setSelectionColor(ColorRgba.GREEN);
    selector.setClickSelection(Mouse.LEFT);
    selector.getFeature(Collidable.class).addAccept(Constant.LAYER_ENTITY);

    text.setLocation(TEXT_X, TEXT_Y);
    text.setColor(TEXT_COLOR);

    services.add(Integer.valueOf(source.getRate()));
}
 
开发者ID:b3dgs,项目名称:warcraft-remake,代码行数:37,代码来源:World.java

示例9: ActionModel

import com.b3dgs.lionengine.game.feature.LayerableModel; //导入依赖的package包/类
/**
 * Create move action.
 * 
 * @param services The services reference.
 * @param setup The setup reference.
 */
public ActionModel(Services services, Setup setup)
{
    super();

    cursor = services.get(Cursor.class);
    selector = services.get(Selector.class);
    text = services.get(Text.class);

    addFeature(new LayerableModel(Constant.LAYER_SELECTION, Constant.LAYER_MENUS_RENDER));

    final SpriteAnimated background = Drawable.loadSpriteAnimated(Medias.create("action_background.png"), 2, 1);
    background.load();
    background.prepare();

    actionable = addFeatureAndGet(new ActionableModel(services, setup));
    actionable.setClickAction(Mouse.LEFT);
    actionable.setAction(new Action()
    {
        @Override
        public void execute()
        {
            cursor.setSurfaceId(1);
            cursor.setRenderingOffset(CURSOR_OFFSET, CURSOR_OFFSET);
            selector.setEnabled(false);
            state.set(assignable);
            ActionModel.this.action();
        }
    });
    state = new AtomicReference<Updatable>(actionable);

    assignable = addFeatureAndGet(new AssignableModel(services));
    assignable.setClickAssign(Mouse.LEFT);
    assignable.setAssign(new Assign()
    {
        @Override
        public void assign()
        {
            ActionModel.this.assign();
            cursor.setSurfaceId(0);
            cursor.setRenderingOffset(0, 0);
            selector.setEnabled(true);
            state.set(actionable);
        }
    });

    final SpriteTiled surface = Drawable.loadSpriteTiled(setup.getSurface(), 27, 19);
    surface.setLocation(actionable.getButton().getX(), actionable.getButton().getY());
    background.setLocation(actionable.getButton().getX() - 2, actionable.getButton().getY() - 2);

    addFeature(new RefreshableModel(new Updatable()
    {
        @Override
        public void update(double extrp)
        {
            if (actionable.isOver())
            {
                text.setText(actionable.getDescription());
            }
            state.get().update(extrp);
            ActionModel.this.update(extrp);
        }
    }));

    addFeature(new DisplayableModel(new Renderable()
    {
        @Override
        public void render(Graphic g)
        {
            background.render(g);
            surface.render(g);
            ActionModel.this.render(g);
        }
    }));
}
 
开发者ID:b3dgs,项目名称:warcraft-remake,代码行数:81,代码来源:ActionModel.java


注:本文中的com.b3dgs.lionengine.game.feature.LayerableModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。