List of usage examples for com.badlogic.gdx.math Vector2 Zero
Vector2 Zero
To view the source code for com.badlogic.gdx.math Vector2 Zero.
Click Source Link
From source file:com.tnf.ptm.handler.input.NoDestProvider.java
License:Apache License
@Override public Vector2 getDestSpd() { return Vector2.Zero; }
From source file:com.wotf.game.classes.Items.AirStrike.java
/** * {@inheritDoc}/* ww w. j av a 2s. c o m*/ */ @Override public void activate(Vector2 position, Vector2 mousePos, Vector2 Wind, double grav) { for (int i = 0; i <= 5; i++) { //spawn rockets and add to scene Projectile missile = new Projectile(super.getProjectileSprite(), super.getParticle()); Vector2 projectilePosition = position.cpy(); projectilePosition.x = 0 + (i * 100); projectilePosition.y = ((GameStage) this.getStage()).getHeight(); mousePos.x += (i * 100); //fire: fire from, fire towards, power, wind, gravity, radius, damage missile.fire(projectilePosition, mousePos, super.getPower(), Vector2.Zero, grav, super.getBlastRadius(), super.getDamage()); missile.updateShot(); ((GameStage) this.getStage()).addActor(missile); } }
From source file:com.wotf.game.classes.Items.Nuke.java
/** * {@inheritDoc}/*from w ww. j a va2 s . co m*/ */ @Override public void activate(Vector2 position, Vector2 mousePos, Vector2 Wind, double grav) { //spawn bullet and add to scene Projectile bullet = super.getBullet(); //set new fire from position Vector2 projectilePosition = position.cpy(); projectilePosition.y = ((GameStage) this.getStage()).getHeight() + 1; projectilePosition.x = mousePos.x; bullet.fire(projectilePosition, mousePos, super.getPower(), Vector2.Zero, 8.0, super.getBlastRadius(), super.getDamage()); bullet.updateShot(); ((GameStage) this.getStage()).addActor(bullet); }
From source file:com.wotf.game.GameStage.java
/** * Spawns a cluster of projectiles//from w ww. j a va 2 s .c o m * @param x x-coordinate of start position * @param y y-coordinate of start position */ private void fireCluster(int x, int y) { Sprite partSprite = new Sprite(new Texture(Gdx.files.internal("part.png"))); x = x - 3; for (int i = 0; i <= 4; i++) { Vector2 mousePos = new Vector2(x, y + 2); Vector2 position = new Vector2(x + i * 2, y); Projectile part = new Projectile(partSprite, tempParticleEffects); //fire: fire from, fire towards, power, wind, gravity, radius, damage part.fire(position, mousePos, 5, Vector2.Zero, 9.8, 10, 16); part.updateShot(); addActor(part); } }
From source file:ludowars.controller.EntityDriver.java
public EntityDriver() { state = new EntityDriverState(); state.moveEast = false;/*w ww .j a v a 2 s .c o m*/ state.moveNorth = false; state.moveSouth = false; state.moveWest = false; state.fire = false; state.fireSecondary = false; state.mousePosition = Vector2.Zero; }
From source file:ludowars.controller.EntityDriver.java
protected void reset() { state.moveEast = false;//from w ww . ja va 2 s . c o m state.moveNorth = false; state.moveSouth = false; state.moveWest = false; state.fire = false; state.fireSecondary = false; state.mousePosition = Vector2.Zero; }
From source file:org.destinationsol.game.gun.SolGun.java
License:Apache License
public SolGun(SolGame game, GunItem item, Vector2 relPos, boolean underShip) { myItem = item;// w w w . j a v a 2 s . co m if (myItem.config.lightOnShot) { Color lightCol = SolColor.W; ProjectileConfig projConfig = myItem.config.clipConf.projConfig; if (projConfig.bodyEffect != null) lightCol = projConfig.bodyEffect.tint; else if (projConfig.collisionEffect != null) lightCol = projConfig.collisionEffect.tint; myLightSrc = new LightSrc(game, .25f, true, 1f, Vector2.Zero, lightCol); } else { myLightSrc = null; } myRelPos = new Vector2(relPos); DraLevel level = underShip ? DraLevel.U_GUNS : DraLevel.GUNS; float texLen = myItem.config.gunLength / myItem.config.texLenPerc * 2; mySprite = new RectSprite(myItem.config.tex, texLen, 0, 0, new Vector2(relPos), level, 0, 0, SolColor.W, false); myDras = new ArrayList<Dra>(); myDras.add(mySprite); if (myLightSrc != null) myLightSrc.collectDras(myDras); }
From source file:org.destinationsol.game.gun.SolGun.java
License:Apache License
private void shoot(Vector2 gunSpd, SolGame game, float gunAngle, Vector2 muzzlePos, Faction faction, SolObject creator) {/* w w w .ja v a 2s . co m*/ Vector2 baseSpd = gunSpd; ClipConfig cc = myItem.config.clipConf; if (cc.projConfig.zeroAbsSpd) { baseSpd = Vector2.Zero; Planet np = game.getPlanetMan().getNearestPlanet(); if (np.isNearGround(muzzlePos)) { baseSpd = new Vector2(); np.calcSpdAtPos(baseSpd, muzzlePos); } } myCurrAngleVar = SolMath.approach(myCurrAngleVar, myItem.config.maxAngleVar, myItem.config.angleVarPerShot); boolean multiple = cc.projectilesPerShot > 1; for (int i = 0; i < cc.projectilesPerShot; i++) { float bulletAngle = gunAngle; if (myCurrAngleVar > 0) bulletAngle += SolMath.rnd(myCurrAngleVar); Projectile proj = new Projectile(game, bulletAngle, muzzlePos, baseSpd, faction, cc.projConfig, multiple); game.getObjMan().addObjDelayed(proj); } myCoolDown += myItem.config.timeBetweenShots; myItem.ammo--; game.getSoundMan().play(game, myItem.config.shootSound, muzzlePos, creator); }
From source file:org.destinationsol.game.particle.ParticleSrc.java
License:Apache License
private void updateSpd(SolGame game, Vector2 baseSpd, Vector2 basePos) { if (isContinuous()) { if (!isWorking()) return; } else {//www . j ava 2 s .c om if (myFloatedUp) return; myFloatedUp = true; } if (!myInheritsSpd) baseSpd = Vector2.Zero; if (!myConfig.floatsUp) { setSpd(baseSpd); return; } Planet np = game.getPlanetMan().getNearestPlanet(); Vector2 spd = np.getAdjustedEffectSpd(basePos, baseSpd); setSpd(spd); SolMath.free(spd); }
From source file:org.destinationsol.game.particle.SpecialEffects.java
License:Apache License
public void explodeShip(SolGame game, Vector2 pos, float sz) { PartMan pm = game.getPartMan();/*from w w w .ja va 2s .c o m*/ ParticleSrc smoke = new ParticleSrc(myShipExplSmoke, 2 * sz, DraLevel.PART_FG_0, new Vector2(), false, game, pos, Vector2.Zero, 0); pm.finish(game, smoke, pos); ParticleSrc fire = new ParticleSrc(myShipExplFire, .7f * sz, DraLevel.PART_FG_1, new Vector2(), false, game, pos, Vector2.Zero, 0); pm.finish(game, fire, pos); pm.blinks(pos, game, sz); }