List of usage examples for com.badlogic.gdx.scenes.scene2d.actions MoveToAction setPosition
public void setPosition(float x, float y)
From source file:actors.BasicSkel.java
public BasicSkel(float hlth, float dmg, float x, float y, int lvl, int pth, Stage stg, PlayScreen scrn) { this.setName("skeleton"); level = lvl;// w ww .j av a2 s. c o m path = pth; stage = stg; screen = scrn; health = hlth; damage = dmg; slowTimer = -1; slowed = false; reset = false; poisoned = false; notmoving = false; if (damage < 220) texture = new Texture("skelsword1.png"); if (damage < 240 && damage >= 220) texture = new Texture("skelsword2.png"); if (damage >= 240) texture = new Texture("skelsword3.png"); sprite = new Sprite(texture); sprite.setScale(0.65f); setBounds(sprite.getX(), sprite.getY(), sprite.getWidth(), sprite.getHeight()); fireEffect = new ParticleEffect(); fireEffect.load(Gdx.files.internal("fire"), Gdx.files.internal("")); fireEffect.getEmitters().first().setPosition(getX(), getY()); fireballSound = Gdx.audio.newSound(Gdx.files.internal("fireball.wav")); iceEffect = new ParticleEffect(); iceEffect.load(Gdx.files.internal("ice"), Gdx.files.internal("")); iceEffect.getEmitters().first().setPosition(getX(), getY()); poisonEffect = new ParticleEffect(); poisonEffect.load(Gdx.files.internal("poison"), Gdx.files.internal("")); poisonEffect.getEmitters().first().setPosition(getX(), getY()); emptyHealthBar = new Sprite(new Texture("emptyBar.png")); fullHealthBar = new Sprite(new Texture("fullBar.png")); ColorAction red = new ColorAction(); red.setEndColor(Color.RED); red.setDuration(1f); MoveToAction moveOff = new MoveToAction(); moveOff.setPosition(-100, -100); kill = new SequenceAction(red, moveOff); this.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { if (health != 100000 && abs(screen.player.getX() - getX()) < screen.playerRange && abs(screen.player.getY() - getY()) < screen.playerRange) { if (screen.playerSpell == 1) { health -= screen.playerDamage; stage.addActor( new Fireball(screen.player.getX(), screen.player.getY(), getX() + 16, getY() + 16)); fireballSound.play(0.8f); fireEffect.start(); } if (screen.playerSpell == 2) { health -= screen.playerDamage * 0.75; stage.addActor( new IceBolt(screen.player.getX(), screen.player.getY(), getX() + 16, getY() + 16)); fireballSound.play(0.8f); iceEffect.start(); slowTimer = 3; if (health >= 0) slowed = true; } if (screen.playerSpell == 3) { poisoned = true; stage.addActor( new IceBolt(screen.player.getX(), screen.player.getY(), getX() + 16, getY() + 16)); fireballSound.play(0.8f); poisonEffect.start(); } } if (health <= 0) { poisoned = false; setName("dead"); health = 100000; clearActions(); addAction(kill); screen.skeletonDeath.play(1.0f); screen.addGold(5); } } }); velocity = 70; //Rectangle body = new Rectangle(getX(), getY(), getWidth(), getHeight()); //ScaleByAction sba = new ScaleByAction(); //sba.setAmount(0.25f); assignMovement(x, y); }
From source file:ateamproject.kezuino.com.github.render.screens.GameScreen.java
private void createGui() { // Create pause menu. pauseMenu = new Dialog("Menu", skin); pauseMenu.setKeepWithinStage(false); TextButton bContinue = new TextButton("Doorgaan", skin); bContinue.addListener(new ClickListener() { @Override//from ww w . j av a 2 s . c om public void clicked(InputEvent event, float x, float y) { MoveToAction action = Actions.action(MoveToAction.class); action.setPosition(stage.getWidth() / 2 - pauseMenu.getWidth() / 2, stage.getHeight() + pauseMenu.getHeight()); action.setDuration(0.1f); getSession().setPauseMenuShowing(false); pauseMenu.hide(action); } }); pauseMenu.add(bContinue); TextButton bExit = new TextButton("Verlaten", skin); bExit.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { PacketKick packet = new PacketKick(PacketKick.KickReasonType.GAME, "Client afgesloten.", null); Client.getInstance().send(packet); game.setScreen(new MainScreen(game)); } }); pauseMenu.add(bExit); //Create player menu. this.playerMenu = new Dialog("Menu", skin) { }; }
From source file:ateamproject.kezuino.com.github.render.screens.GameScreen.java
public void showPauseMenu() { pauseMenu.show(stage);//from www. j ava2 s. c o m pauseMenu.setPosition(stage.getWidth() / 2 - pauseMenu.getWidth() / 2, stage.getHeight() + pauseMenu.getHeight()); MoveToAction action = Actions.action(MoveToAction.class); action.setPosition(stage.getWidth() / 2 - pauseMenu.getWidth() / 2, stage.getHeight() / 2 - pauseMenu.getHeight() / 2); action.setDuration(0.3f); action.setInterpolation(Interpolation.bounceOut); pauseMenu.addAction(action); getSession().showPauseMenu(); }
From source file:com.bagon.matchteam.mtx.scene2d.AbstractActorLight.java
License:Apache License
public void actionMoveTo(float x, float y, float duration) { // Move to a specific position by time MoveToAction action = new MoveToAction(); action.setPosition(x, y); if (duration > 0) { action.setDuration(duration);/*from w ww . j a va 2 s. c o m*/ } addAction(action); }
From source file:com.mk.apps.superm.mtx.AbstractActor.java
License:Apache License
public void actionMoveTo(float x, float y, float duration) { // Move to a specific position by time MoveToAction action = new MoveToAction(); action.setPosition(x, y); if (duration > 0.0f) { action.setDuration(duration);// w w w . jav a2s . c o m } addAction(action); }
From source file:com.mygdx.game.Facebuttons.java
public void disable() { float x = this.getX(); float y = -50f; MoveToAction action = new MoveToAction(); action.setPosition(x, y); action.setDuration(0.3f);/* w ww .j a va2s . c o m*/ this.addAction(action); enabled = false; }
From source file:com.mygdx.game.Facebuttons.java
public void enable() { float x = this.getX(); float y = _originalY; MoveToAction action = new MoveToAction(); action.setPosition(x, y); action.setDuration(0.3f);// w w w . j a va 2 s .com this.addAction(action); enabled = true; }
From source file:com.mygdx.game.Members.java
public void moveTo(float x, float y, float sec) { MoveToAction action = new MoveToAction(); action.setPosition(x, y); action.setDuration(sec);/*from ww w .ja va2 s. c o m*/ this.addAction(action); state.setAnimation(0, "walk", true); _whereToX = x; _whereToY = y; // currentState = "walkto"; }
From source file:com.mygdx.game.Members.java
public void goEat() { game.facebuttons.get(name).disable(); MoveToAction action = new MoveToAction(); action.setPosition(0.5f * (float) Gdx.graphics.getWidth(), this.getY()); action.setDuration(game.walkDuration); this.addAction(action); }
From source file:com.nicholaschirkevich.game.menu.BackButton.java
License:Apache License
public void show() { MoveToAction moveDown = new MoveToAction(); moveDown.setPosition(x, Constants.RESUME_BTTN_Y_VISIBLE); moveDown.setDuration(0.4f);/*w w w .java 2s . c o m*/ addAction(moveDown); }