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


Java Transformable类代码示例

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


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

示例1: spawn

import com.b3dgs.lionengine.game.feature.Transformable; //导入依赖的package包/类
/**
 * Spawn a random object from medias array.
 * 
 * @param medias The medias array.
 * @param layer The associated layer.
 */
private void spawn(List<Media> medias, int layer)
{
    if (!medias.isEmpty())
    {
        final Media media = getRandomMedia(medias);
        final Featurable featurable = factory.create(media);
        featurable.getFeature(Layerable.class).setLayer(layer);
        handler.add(featurable);
        final Transformable transformable = featurable.getFeature(Transformable.class);
        final double x = UtilRandom.getRandomInteger(camera.getWidth() - transformable.getWidth() * 2)
                         + transformable.getWidth();
        final double y = (int) camera.getY() + camera.getHeight() + transformable.getHeight();
        transformable.teleport(x, y);
    }
}
 
开发者ID:b3dgs,项目名称:tyrian-remake,代码行数:22,代码来源:World.java

示例2: createBase

import com.b3dgs.lionengine.game.feature.Transformable; //导入依赖的package包/类
/**
 * Create base world.
 * 
 * @param x The horizontal base.
 * @param y The vertical base.
 */
private void createBase(int x, int y)
{
    final Featurable peon = factory.create(Medias.create(Constant.FOLDER_ENTITY, Constant.FOLDER_ORC, "Peon.xml"));
    peon.getFeature(Pathfindable.class).setLocation(x, y);
    handler.add(peon);

    final Featurable grunt = factory.create(Medias.create(Constant.FOLDER_ENTITY,
                                                          Constant.FOLDER_ORC,
                                                          "Grunt.xml"));
    grunt.getFeature(Pathfindable.class).setLocation(x + 2, y + 1);
    handler.add(grunt);

    camera.teleport(grunt.getFeature(Transformable.class).getX()
                    - camera.getWidth() / 2,
                    grunt.getFeature(Transformable.class).getY() - camera.getHeight() / 2);
}
 
开发者ID:b3dgs,项目名称:warcraft-remake,代码行数:23,代码来源:World.java

示例3: prepare

import com.b3dgs.lionengine.game.feature.Transformable; //导入依赖的package包/类
@Override
public void prepare(FeatureProvider provider)
{
    super.prepare(provider);

    weapon = factory.create(Medias.create(Constant.FOLDER_WEAPON, "pulser.xml")).getFeature(WeaponUpdater.class);

    final Transformable transformable = ship.getFeature(Transformable.class);
    target = new Localizable()
    {
        @Override
        public double getX()
        {
            return transformable.getX() + ship.getSpeed().getDirectionHorizontal();
        }

        @Override
        public double getY()
        {
            return transformable.getY() + ship.getSpeed().getDirectionVertical();
        }
    };

    weapon.getFeature(Launcher.class).addListener(new LaunchableListener()
    {
        @Override
        public void notifyFired(Launchable launchable)
        {
            launchable.getFeature(Collidable.class).setGroup(Constant.COLLISION_GROUP_PROJECTILES_ENTITIES);
        }
    });
}
 
开发者ID:b3dgs,项目名称:tyrian-remake,代码行数:33,代码来源:Shooter.java

示例4: prepare

import com.b3dgs.lionengine.game.feature.Transformable; //导入依赖的package包/类
@Override
public void prepare(FeatureProvider provider)
{
    super.prepare(provider);

    player = services.get(ShipUpdater.class).getFeature(Transformable.class);
}
 
开发者ID:b3dgs,项目名称:tyrian-remake,代码行数:8,代码来源:Ship.java

示例5: createListener

import com.b3dgs.lionengine.game.feature.Transformable; //导入依赖的package包/类
/**
 * Create the map listener to add entities over tiles.
 * 
 * @param entities The entities mapping.
 * @param map The map reference.
 * @param services The services reference.
 * @return The created listener.
 */
private static TileSetListener createListener(final java.util.Map<TileRef, Media> entities,
                                              final MapTile map,
                                              Services services)
{
    final Factory factory = services.get(Factory.class);
    final Handler handler = services.get(Handler.class);

    return new TileSetListener()
    {
        @Override
        public void onTileSet(Tile tile)
        {
            final TileRef tileRef = new TileRef(tile);
            if (entities.containsKey(tileRef))
            {
                final Media media = entities.get(tileRef);
                final Entity entity = factory.create(media);
                final Transformable transformable = entity.getFeature(Transformable.class);
                final int x = (int) (tile.getX() + transformable.getWidth() / 2);
                final int y = (int) (tile.getY() + map.getTileHeight() - transformable.getHeight() / 2);
                transformable.teleport(x, y);
                handler.add(entity);
            }
        }
    };
}
 
开发者ID:b3dgs,项目名称:tyrian-remake,代码行数:35,代码来源:Map.java

示例6: start

import com.b3dgs.lionengine.game.feature.Transformable; //导入依赖的package包/类
/**
 * Start the explode.
 * 
 * @param transformable The transformable reference.
 */
public void start(Transformable transformable)
{
    area.set(transformable.getX(), transformable.getY(), transformable.getWidth(), transformable.getHeight());
    count++;
}
 
开发者ID:b3dgs,项目名称:tyrian-remake,代码行数:11,代码来源:Explode.java


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