public TileEffectDialog(Hexpert hexpert, Skin skin) {
super(hexpert, skin, false);
getContentTable().defaults().pad(15);
for(int i = 0; i < TileType.values().length; i++)
{
TileType tileType = TileType.values()[i];
Image tileImage = new Image(new TextureRegion((Texture) hexpert.assetManager.get(SPRITE_FOLDER + tileType.name().toLowerCase() + "_tile.png")));
getContentTable().add(tileImage).width(96).height(96);
Label lblDesc = new Label(hexpert.i18NBundle.get(tileType.name().toLowerCase() + "_effect"), skin);
lblDesc.setAlignment(Align.center);
getContentTable().add(lblDesc);
getContentTable().row();
}
}
java类com.badlogic.gdx.graphics.Texture的实例源码
TileEffectDialog.java 文件源码
项目:Hexpert
阅读 26
收藏 0
点赞 0
评论 0
LudumDare38.java 文件源码
项目:LD38-Compo
阅读 27
收藏 0
点赞 0
评论 0
private void createUndoButton()
{
Skin skin = new Skin();
Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
pixmap.setColor(Color.WHITE);
pixmap.fill();
skin.add("white", new Texture(pixmap));
skin.add("default", new BitmapFont());
TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
textButtonStyle.up = skin.newDrawable("white", new Color(0, 0, 0, 1));
textButtonStyle.font = skin.getFont("default");
skin.add("default", textButtonStyle);
btnUndo = new TextButton("UNDO", skin);
btnUndo.setX(70);
btnUndo.setY(Gdx.graphics.getHeight() - 25);
btnUndo.setWidth(60);
btnUndo.setVisible(true);
group.addActor(btnUndo);
}
ScreenCombat.java 文件源码
项目:enklave
阅读 21
收藏 0
点赞 0
评论 0
private void drawtopcombat(){
groupTop = new Group();
Texture lookup = managerAssets.getAssetsCombat().getTexture(NameFiles.progressbarcircular);
lookup.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
progressBarEnergy = ProgressBarEnergy.getInstance();
Image imageLeftprofile = new Image(new TextureRegion(managerAssets.getAssetsButton().get(NameFiles.buttonBack1)));
imageLeftprofile.setSize(Gdx.graphics.getWidth() * 0.15f, Gdx.graphics.getWidth() * 0.15f);
imageLeftprofile.setPosition(imageLeftprofile.getWidth() * 0.1f, Gdx.graphics.getHeight() - imageLeftprofile.getHeight() * 1.1f);
imageLeftprofile.addListener(new ClickListener(){
@Override
public void clicked(InputEvent event, float x, float y) {
if(InformationProfile.getInstance().getDateUserGame().getEnklaveCombatId() == -1)
gameManager.setScreen(gameManager.screenEnklave);
else
dialogExit("You can't out from combat!");
}
});
groupTop.addActor(imageLeftprofile);
}
Water.java 文件源码
项目:water2d-libgdx
阅读 30
收藏 0
点赞 0
评论 0
/**
* Constructor that allows to specify if there is an effect of waves and splash particles.
* @param waves Specifies whether the object will have waves
* @param splashParticles Specifies whether the object will have splash particles
*/
public Water(boolean waves, boolean splashParticles) {
this.waves = waves;
this.splashParticles = splashParticles;
this.fixturePairs = new HashSet<Pair<Fixture, Fixture>>();
this.setDebugMode(false);
if (waves) {
textureWater = new TextureRegion(new Texture(Gdx.files.internal("water.png")));
polyBatch = new PolygonSpriteBatch();
}
if (splashParticles) {
textureDrop = new Texture(Gdx.files.internal("drop.png"));
spriteBatch = new SpriteBatch();
particles = new ArrayList<Particle>();
}
shapeBatch = new ShapeRenderer();
shapeBatch.setColor(0, 0.5f, 1, 1);
}
Maps.java 文件源码
项目:Mindustry
阅读 21
收藏 0
点赞 0
评论 0
public void saveAndReload(Map map, Pixmap out){
if(map.pixmap != null && out != map.pixmap && map.texture != null){
map.texture.dispose();
map.texture = new Texture(out);
}else if (out == map.pixmap){
map.texture.draw(out, 0, 0);
}
map.pixmap = out;
if(map.texture == null) map.texture = new Texture(map.pixmap);
if(map.id == -1){
if(mapNames.containsKey(map.name)){
map.id = mapNames.get(map.name).id;
}else{
map.id = ++lastID;
}
}
if(!Settings.has("hiscore" + map.name)){
Settings.defaults("hiscore" + map.name, 0);
}
saveCustomMap(map);
Vars.ui.levels.reload();
}
TestCamera.java 文件源码
项目:GDX-Engine
阅读 28
收藏 0
点赞 0
评论 0
@Override
public void create() {
rotationSpeed = 0.5f;
mesh = new Mesh(true, 4, 6,
new VertexAttribute(VertexAttributes.Usage.Position, 3,"attr_Position"),
new VertexAttribute(Usage.TextureCoordinates, 2, "attr_texCoords"));
texture = new Texture(Gdx.files.internal("data/Jellyfish.jpg"));
mesh.setVertices(new float[] {
-1024f, -1024f, 0, 0, 1,
1024f, -1024f, 0, 1, 1,
1024f, 1024f, 0, 1, 0,
-1024f, 1024f, 0, 0, 0
});
mesh.setIndices(new short[] { 0, 1, 2, 2, 3, 0 });
cam = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
xScale = Gdx.graphics.getWidth()/(float)TARGET_WIDTH;
yScale = Gdx.graphics.getHeight()/(float)TARGET_HEIGHT;
font = loadBitmapFont("default.fnt", "default.png");
scale = Math.min(xScale, yScale);
cam.zoom = 1/scale;
// cam.project(start_position);
cam.position.set(0, 0, 0);
batch = new SpriteBatch();
}
TreeWindow.java 文件源码
项目:libgdx_ui_editor
阅读 31
收藏 0
点赞 0
评论 0
@Override
public void addActor(ActorAddEvent event) {
Actor actor = event.actor;
StringBuilder item_name = new StringBuilder();
item_name.append(actor.getName()==null?"":actor.getName());
item_name.append("[");
item_name.append(EditorManager.getInstance()
.getActorType(actor).getSimpleName());
item_name.append("]");
Tree.Node item = createNodeItem(actor,item_name.toString());
item.setIcon(new TextureRegionDrawable(new TextureRegion(new Texture(
Gdx.files.internal("icon/Label_16.png")))));
item.getActor().setTouchable(Touchable.disabled);
if (actor.getParent() instanceof MainWindow){
stageNode.add(item);
}else {
Tree.Node parentNode = stageNode.findNode(actor.getParent());
if (parentNode!=null) parentNode.add(item);
}
tree.getSelection().choose(item);
}
BuildingScoreDialog.java 文件源码
项目:Hexpert
阅读 22
收藏 0
点赞 0
评论 0
public BuildingScoreDialog(Hexpert hexpert, Skin skin) {
super(hexpert, skin, false);
getContentTable().defaults().pad(15);
Label.LabelStyle lblStyle = skin.get("bigger", Label.LabelStyle.class);
Label lblExplaination = new Label(hexpert.i18NBundle.get("tut_score"), skin);
lblExplaination.setWrap(true);
lblExplaination.setAlignment(Align.center);
getContentTable().add(lblExplaination).colspan(8).width(8*160);
lblExplaination.setWrap(true);
getContentTable().row();
for (int i = 1; i < BuildingType.values().length; i++) {
BuildingType buildingType = BuildingType.values()[i];
Image image = new Image(new TextureRegion((Texture)
hexpert.assetManager.get(SPRITE_FOLDER + buildingType.name().toLowerCase() + "_min.png")));
getContentTable().add(image).width(160).height(160);
Label lblScore = new Label(Integer.toString(buildingType.getScore()), lblStyle);
lblScore.setAlignment(Align.center);
getContentTable().add(lblScore).expand();
if (i % 4 == 0)
getContentTable().row();
}
}
GameCenter.java 文件源码
项目:curiosone-app
阅读 22
收藏 0
点赞 0
评论 0
public GameCenter(Chat game){
this.game = game;
/*Camera Settings*/
camera = new OrthographicCamera();
camera.setToOrtho(false,480,800);
camera.position.set(480/2,800/2,0);
/*Button Areas*/
wordTiles = new Rectangle(480/2-250/2,800/2,250,55);
Arkanoid = new Rectangle(480/2-250/2,800/2-60,250,55);
WordCrush = new Rectangle(480/2-250/2,800/2-120,250,55);
EndlessRoad = new Rectangle(480/2-250/2,800/2-180,250,55);
bottone4 = new Rectangle(480/2-250/2,800/2-240,250,55);
buttonTexture = new Texture("green_button00.png");
touch = new Vector3();
}
CustomizeMenuScreen.java 文件源码
项目:feup-lpoo-armadillo
阅读 17
收藏 0
点赞 0
评论 0
/**
* Function used to create the Skins' Buttons and Labels and associate them to a given table, organized.
* It also adds Listeners to the Skins' Buttons.
*
* @param table Table where the Skins' Labels and Buttons will be organized.
*/
private void createSkins(Table table) {
for (int i = 0; i < game.getNumSkins(); ++i) {
//Adding Buttons and Labels to the Arrays
skinButtons.add(new Button(new TextureRegionDrawable(new TextureRegion(game.getAssetManager().get("big_skins/skin" + (i < 10 ? "0" : "") + i + ".png", Texture.class)))));
skinLabels.add(new Label("Current", skin1));
final int j = i; //Needed for Listener initialization
skinButtons.get(i).addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
setCurrentLabel(j);
}
});
table.add(skinButtons.get(i)).size(BUTTON_SIZE, BUTTON_SIZE).pad(IMAGE_EDGE);
}
table.row();
for (int i = 0; i < game.getNumSkins(); ++i)
table.add(skinLabels.get(i));
initializeCurrentSkin();
}
DrawTextureComponent.java 文件源码
项目:SpaceChaos
阅读 21
收藏 0
点赞 0
评论 0
public void setTexture(Texture texture, boolean setNewDimension) {
Texture oldTexture = this.texture;
this.texture = texture;
// set dimension of texture
setDimension(texture.getWidth(), texture.getHeight());
if (setNewDimension) {
// update width and height
this.positionComponent.setDimension(texture.getWidth(), texture.getHeight());
if (this.texture != null) {
// update dimension
this.width = this.texture.getWidth();
this.height = this.texture.getHeight();
}
}
this.textureChangedListenerList.stream().forEach(listener -> {
listener.onTextureChanged(oldTexture, this.texture);
});
}
GameScreen.java 文件源码
项目:CursedEcho
阅读 18
收藏 0
点赞 0
评论 0
public GameScreen(String playerName) {
camera = new Camera();
player = new Player(playerName,0,0,"Players/player.png");
controller = new CursedEchoController(player);
stage = new Stage();
map = GameUtils.getGame().assetHandler.get("World/grass.png",Texture.class);
camera.setToOrtho(false,Gdx.graphics.getWidth()/2,Gdx.graphics.getHeight()/2);
camera.update();
switch(Gdx.app.getType()) {
case Android:
controller.addTouchPad(stage);
break;
default:
break;
}
}
SkinLoader.java 文件源码
项目:Klooni1010
阅读 23
收藏 0
点赞 0
评论 0
static Skin loadSkin() {
String folder = "ui/x" + bestMultiplier + "/";
// Base skin
Skin skin = new Skin(Gdx.files.internal("skin/uiskin.json"));
// Nine patches
final int border = (int)(28 * bestMultiplier);
skin.add("button_up", new NinePatch(new Texture(
Gdx.files.internal(folder + "button_up.png")), border, border, border, border));
skin.add("button_down", new NinePatch(new Texture(
Gdx.files.internal(folder + "button_down.png")), border, border, border, border));
for (String id : ids) {
skin.add(id + "_texture", new Texture(Gdx.files.internal(folder + id + ".png")));
}
folder = "font/x" + bestMultiplier + "/";
skin.add("font", new BitmapFont(Gdx.files.internal(folder + "geosans-light64.fnt")));
skin.add("font_small", new BitmapFont(Gdx.files.internal(folder + "geosans-light32.fnt")));
skin.add("font_bonus", new BitmapFont(Gdx.files.internal(folder + "the-next-font.fnt")));
return skin;
}
AssetsRooms.java 文件源码
项目:enklave
阅读 24
收藏 0
点赞 0
评论 0
public AssetsRooms() {
manager = new AssetManager();
manager.load(NameFiles.topenklaveimage,Texture.class);
manager.load(NameFiles.noselectRooms,Texture.class);
manager.load(NameFiles.selectroombottom,Texture.class);
manager.load(NameFiles.selectroomleft,Texture.class);
manager.load(NameFiles.selectroomright,Texture.class);
manager.load(NameFiles.txtSelectRoom,Texture.class);
manager.load(NameFiles.imageArrowBottom,Texture.class);
manager.load(NameFiles.imageArrowRight,Texture.class);
manager.load(NameFiles.imagePulse,Texture.class);
manager.load(NameFiles.extensionImgBackground,Texture.class);
manager.load(NameFiles.borderImageBlue,Texture.class);
manager.load(NameFiles.borderUpdown,Texture.class);
manager.load(NameFiles.progressbarcircular,Texture.class);
manager.load(NameFiles.imageBarrack,Texture.class);
manager.load(NameFiles.imageCommCenter,Texture.class);
manager.load(NameFiles.imageLaboratory,Texture.class);
manager.load(NameFiles.frameEnk,Texture.class);
}
PowerupFactory.java 文件源码
项目:SpaceChaos
阅读 24
收藏 0
点赞 0
评论 0
/**
* Creates a new power up entity.
*
* @param ecs
* entity component system
* @param x
* x start position
* @param y
* y start position
* @param texture
* texture
* @return power up entity
*/
public static Entity createPowerup(EntityManager ecs, float x, float y, Texture texture) {
// create new entity
Entity powerupEntity = new Entity(ecs);
// every entity requires a position component
powerupEntity.addComponent(new PositionComponent(x, y), PositionComponent.class);
// add texture component to draw texture
powerupEntity.addComponent(new DrawTextureComponent(texture, texture.getWidth() / 2, texture.getHeight() / 2),
DrawTextureComponent.class);
// add collision component, so entity can collide with other space
// shuttles or meteorites
powerupEntity.addComponent(new CollisionComponent(), CollisionComponent.class);
powerupEntity.getComponent(CollisionComponent.class)
.addInnerShape(new CCircle(texture.getWidth() / 2, texture.getHeight() / 2, texture.getWidth() / 2));
//avoid camera shake on collision and sounds on collision
powerupEntity.addComponent(new AvoidCollisionCameraShakeComponent(), AvoidCollisionCameraShakeComponent.class);
powerupEntity.addComponent(new AvoidCollisionSoundComponent(), AvoidCollisionSoundComponent.class);
return powerupEntity;
}
CreditsScreen.java 文件源码
项目:SpaceChaos
阅读 27
收藏 0
点赞 0
评论 0
@Override
protected void onInit(ScreenBasedGame game, AssetManager assetManager) {
// load assets
assetManager.load(MUSIC_PATH, Music.class);
assetManager.load(BACKGROUND_IMAGE_PATH, Texture.class);
assetManager.finishLoadingAsset(MUSIC_PATH);
assetManager.finishLoadingAsset(BACKGROUND_IMAGE_PATH);
// get assets
this.music = assetManager.get(MUSIC_PATH, Music.class);
this.bgTexture = assetManager.get(BACKGROUND_IMAGE_PATH, Texture.class);
// generate fonts
this.titleFont = BitmapFontFactory.createFont("./data/font/spartakus/SparTakus.ttf", 48, Color.WHITE,
Color.BLUE, 3);
// this.font2 =
// BitmapFontFactory.createFont("./data/font/spartakus/SparTakus.ttf",
// 48, Color.RED, Color.WHITE, 3);
this.font1 = BitmapFontFactory.createFont("./data/font/arial/arial.ttf", 18, Color.WHITE);
this.font2 = BitmapFontFactory.createFont("./data/font/arial/arial-bold.ttf", 24, Color.WHITE, Color.RED, 3);
// generate credits text array
try {
this.generateCreditLines();
} catch (IOException e) {
e.printStackTrace();
// TODO: remove this line and handle exception with exception window
System.exit(0);
}
Gdx.input.setInputProcessor(null);
}
GameOver.java 文件源码
项目:Flappy-Baranus
阅读 28
收藏 0
点赞 0
评论 0
public GameOver(GameStateManager gsm, int score) {
super(gsm);
this.score = score;
camera.setToOrtho(false, FlappyBaran.WIDTH / 2, FlappyBaran.HEIGHT / 2);
background = new Texture("backgrnd.jpg");
gameover = new Texture("gameover.png");
font = new BitmapFont();
prefs = Gdx.app.getPreferences("FlappyBaran");
if (!prefs.contains("highScore")) {
prefs.putInteger("highScore", 0);
}
prevHighScore = getHighScore();
if (prevHighScore < this.score) {
setHighScore(this.score);
highscore = this.score;
} else {
highscore = prevHighScore;
}
}
AssetService.java 文件源码
项目:penguins-in-space
阅读 36
收藏 0
点赞 0
评论 0
public void loadTextures() {
assetManager.load(SkinAsset.UISKIN, Skin.class);
assetManager.load(TextureAsset.PLAYER_DEFAULT, Texture.class);
assetManager.load(TextureAsset.POWERUP_RANDOM, Texture.class);
assetManager.load(TextureAsset.POWERUP_MISSILE, Texture.class);
assetManager.load(TextureAsset.POWERUP_ARMOR, Texture.class);
assetManager.load(TextureAsset.POWERUP_MULTISHOT, Texture.class);
assetManager.load(TextureAsset.POWERUP_BOMB, Texture.class);
assetManager.load(TextureAsset.PLAYER_INVULNERABLE, Texture.class);
assetManager.load(TextureAsset.OBSTACLE, Texture.class);
assetManager.load(TextureAsset.PROJECTILE, Texture.class);
assetManager.load(TextureAsset.OBSTACLE_EXPLOSION, Texture.class);
assetManager.load(TextureAsset.PLAYER_RED, Texture.class);
assetManager.load(TextureAsset.PLAYER_BLUE, Texture.class);
assetManager.load(TextureAsset.PLAYER_GREEN, Texture.class);
assetManager.load(TextureAsset.PLAYER_YELLOW, Texture.class);
assetManager.load(TextureAsset.TOUCH_BACKGROUND, Texture.class);
assetManager.load(TextureAsset.TOUCH_KNOB, Texture.class);
assetManager.load(TextureAsset.BOMB, Texture.class);
assetManager.load(TextureAsset.BOMB_EXPLOSION, Texture.class);
assetManager.load(TextureAsset.EXPLOSION, Texture.class);
assetManager.load(TextureAsset.MISSILE, Texture.class);
assetManager.update();
}
TutorialDialog.java 文件源码
项目:enklave
阅读 27
收藏 0
点赞 0
评论 0
public Group createPuls(float x, float y){
grPuls = new Group();
Texture txt = managerAssets.getAssetsTutorial().getTexture(NameFiles.circlePulsTutorial);
Image image = new Image(new TextureRegion(txt));
Vector2 crop = Scaling.fit.apply(txt.getWidth(),txt.getHeight(),WIDTH,HEIGHT);
image.setSize(crop.x * 0.135f, crop.y * 0.135f);
image.setPosition(x, y);
grPuls.addActor(image);
txt = managerAssets.getAssetsTutorial().getTexture(NameFiles.PulsCircleScalable);
Image puls = new Image(new TextureRegion(txt));
crop = Scaling.fit.apply(txt.getWidth(),txt.getHeight(),WIDTH,HEIGHT);
puls.setPosition(image.getRight() - image.getWidth() / 2, image.getTop() - image.getHeight() / 2);
puls.setSize(1, 1);
MoveToAction move = new MoveToAction();
move.setDuration(1);
move.setPosition(image.getRight() - image.getWidth() / 2 - crop.x*0.085f, image.getTop() - image.getHeight() / 2 - crop.y*0.085f);
MoveToAction mo = new MoveToAction();
mo.setDuration(0);
mo.setPosition(image.getRight() - image.getWidth() / 2, image.getTop() - image.getHeight() / 2);
ScaleToAction scale = new ScaleToAction();
scale.setScale(WIDTH*0.17f);
scale.setDuration(1);
ScaleToAction sc = new ScaleToAction();
sc.setDuration(0);
sc.setScale(0);
RepeatAction repeat = new RepeatAction();
repeat.setCount(RepeatAction.FOREVER);
repeat.setAction(new SequenceAction(scale, sc));
puls.addAction(repeat);
RepeatAction r = new RepeatAction();
r.setCount(RepeatAction.FOREVER);
r.setAction(new SequenceAction(move, mo));
puls.addAction(r);
grPuls.addActor(puls);
return grPuls;
}
DrawableMap.java 文件源码
项目:Climatar
阅读 25
收藏 0
点赞 0
评论 0
public TerrainTileRenderer(List<List<Integer>> world,
int tileSize) {
this.world = world;
this.tileSize = tileSize;
// build the tile map with the tile specifications
Texture tilesTexture = new Texture(Gdx.files.internal("tiles.png"));
tilesTexture.getTextureData().prepare();
this.tilesPixmap = tilesTexture.getTextureData().consumePixmap();
this.tileRegions = TextureRegion.split(tilesTexture, tileSize, tileSize);
if (tilesTexture.getTextureData().disposePixmap()) {
tilesTexture.dispose();
}
}
TileData.java 文件源码
项目:LD38-Compo
阅读 28
收藏 0
点赞 0
评论 0
public void setBuilding(BuildingType buildingType) {
this.buildingType = buildingType;
switch (buildingType)
{
case HOUSE:
setTexture(AssetLoader.assetManager.get("house.png", Texture.class));
break;
case WIND:
setTexture(AssetLoader.assetManager.get("wind.png", Texture.class));
break;
case FARM:
setTexture(AssetLoader.assetManager.get("farm.png", Texture.class));
break;
case MINE:
setTexture(AssetLoader.assetManager.get("mine.png", Texture.class));
break;
case FACTORY:
setTexture(AssetLoader.assetManager.get("factory.png", Texture.class));
break;
case MARKET:
setTexture(AssetLoader.assetManager.get("market.png", Texture.class));
break;
case BANK:
setTexture(AssetLoader.assetManager.get("bank.png", Texture.class));
break;
case ROCKET:
setTexture(AssetLoader.assetManager.get("rocket.png", Texture.class));
break;
case NONE:
setTexture(null);
break;
}
}
TestScreen.java 文件源码
项目:ShootMe
阅读 19
收藏 0
点赞 0
评论 0
@Override
public void show() { //"wie" der Constructor
SM.input.setInputProcessor(this);
batch = new SpriteBatch();
img = new Texture("assets/guenter_right.png");
imagePos = new Vector2(0, 0);
imagePosMovement = new Vector2(0,0);
}
UpgradePack.java 文件源码
项目:Parasites-of-HellSpace
阅读 21
收藏 0
点赞 0
评论 0
public UpgradePack()
{
posX = MathUtils.random(350)+ 50;
posY = Gdx.graphics.getHeight();
speed = 150f;
texture = AssetLoader.assetManager.get("upgrade.png", Texture.class);
powerUpSound = AssetLoader.assetManager.get("powerupsnd.wav", Sound.class);
sprite = new Sprite(texture);
sprite.setOriginCenter();
sprite.setScale(0.7f);
sprite.setPosition(posX, posY);
}
Tile.java 文件源码
项目:JGame
阅读 38
收藏 0
点赞 0
评论 0
public void Install(Installed object) {
this.object = object;
for (Tile.SolidTiles i : Tile.SolidTiles.values()) {
if (i.name().equals(object.name())) {
this.solid = true;
}
}
this.hasObject = true;
this.installImg = new Texture(this.object.toString().toLowerCase() + ".png");
this.InstallID = Installed.valueOf(this.object.toString()).ordinal();
this.installing = false;
this.preinstall = false;
}
Bird.java 文件源码
项目:Flappy-Baranus
阅读 31
收藏 0
点赞 0
评论 0
public Bird(int x, int y){
position = new Vector3(x, y, 0);
velosity = new Vector3(0, 0, 0);
texture = new Texture("Sheep-Animated-Gif4.png");
birdAnimation = new Animation(new TextureRegion(texture), FRAME_COUNT, 0.9f);
bounds = new Rectangle(x, y, texture.getWidth() / FRAME_COUNT, texture.getHeight());
flap = Gdx.audio.newSound(Gdx.files.internal("sfx_wing.ogg"));
}
Entity.java 文件源码
项目:project-divine-intervention
阅读 31
收藏 0
点赞 0
评论 0
public Entity(Texture t, float x, float y){
texture = t;
position = new Vector2(x , y);
if(t !=null) {
size = new Vector2(texture.getWidth(), texture.getHeight());
body = new Rectangle(x, y, texture.getWidth(), texture.getHeight());
}
else System.out.println("[Entity] WARNING: SIZE and BODY are null, be sure to set them elsewhere.");
}
ThrowableNonSplashAttackSpell.java 文件源码
项目:MMORPG_Prototype
阅读 25
收藏 0
点赞 0
评论 0
public ThrowableNonSplashAttackSpell(OffensiveSpell spell, Texture lookout, long id, Monster source, GameObjectsContainer linkedContainer, PacketsSender packetsSender)
{
super(lookout, id, linkedContainer, packetsSender);
this.spell = spell;
this.source = source;
this.packetsSender = packetsSender;
}
XmlUtils.java 文件源码
项目:libgdx_ui_editor
阅读 27
收藏 0
点赞 0
评论 0
public static void parseButton(VisImageButton button, XmlReader.Element element){
String upPath = element.get("up");
String downPath = element.get("down");
String checkPath = element.get("check");
Drawable up = new TextureRegionDrawable(new TextureRegion(new Texture(Config.getImageFilePath(upPath))));
Drawable down = new TextureRegionDrawable(new TextureRegion(new Texture(Config.getImageFilePath(downPath))));
Drawable checked = new TextureRegionDrawable(new TextureRegion(new Texture(Config.getImageFilePath(checkPath))));
VisImageButton.VisImageButtonStyle buttonStyle = new VisImageButton.VisImageButtonStyle(
up,down,checked,up,down,checked
);
button.setStyle(buttonStyle);
attr2Button(button, new String[]{upPath, downPath, checkPath});
}
Chapa.java 文件源码
项目:FlappyChapa
阅读 19
收藏 0
点赞 0
评论 0
public Chapa(int x, int y) {
position = new Vector3(x, y, 0);
velocity = new Vector3(0, 0, 0);
texture = new Texture("chapaanimation.png");
birdAnimation = new Animation(new TextureRegion(texture), 3, 0.5f);
bounds = new Rectangle(x, y, texture.getWidth() / 3, texture.getHeight());
initSounds();
}
PlayState.java 文件源码
项目:FlappyChapa
阅读 23
收藏 0
点赞 0
评论 0
public PlayState(GameStateManager gsm) {
super(gsm);
score = 0;
chapa = new Chapa(50, 300);
camera.setToOrtho(false, FlappyChapa.WIDTH / 2, FlappyChapa.HEIGHT / 2);
Texture texture = new Texture("bg.png");
backGround = new org.academiadecodigo.bootcamp.sprites.Background(camera);
backGround.start();
ground = new Texture("ground.png");
/*table = new Table();
table.setPosition(camera.position.x,camera.position.y);
//table.setBounds(camera.position.x,camera.position.y,camera.viewportWidth,camera.viewportHeight/10);
table.setFillParent(true);*/
scoreLabel = new Label(String.format("%06d", score), new Label.LabelStyle(new BitmapFont(), Color.WHITE));
scoreLabel.setPosition(camera.position.x,0);
startTime = TimeUtils.nanoTime();
anto = new Anto(camera);
// groundPos1 = new Vector2(camera.position.x - camera.viewportWidth / 2, GROUND_Y_OFFSET);
// groundPos2 = new Vector2((camera.position.x - camera.viewportWidth / 2) + ground.getWidth(), GROUND_Y_OFFSET);
tubes = new Array<Tube>();
for (int i = 0; i < TUBE_COUNT; i++) {
tubes.add(new Tube(i * (TUBE_SPACING + Tube.TUBE_WIDTH)));
}
music = Gdx.audio.newMusic(Gdx.files.internal("bigSmoke_justAudio.mp3"));
music.setLooping(true);
music.setVolume(0.5f);
music.play();
}