Added rotated effects for chain guns

This commit is contained in:
Anuken 2017-11-16 23:16:25 -05:00
parent f2e5873cb6
commit abb6cb9e9f
12 changed files with 73 additions and 10 deletions

View File

@ -79,7 +79,7 @@ project(":core") {
apply plugin: "java"
dependencies {
compile 'com.github.anuken:ucore:deacbf0568'
compile 'com.github.anuken:ucore:ea3563b5e4'
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-ai:1.8.1"
}

View File

@ -25,6 +25,15 @@ public class EffectCreator{
});
});
Effects.create("chainshot", 9f, e -> {
Draw.color(Color.WHITE, lightOrange, e.ifract());
Draw.thick(e.fract()*4f);
Draw.lineAngle(e.x, e.y, e.rotation, e.fract()*7f);
Draw.thick(e.fract()*2f);
Draw.lineAngle(e.x, e.y, e.rotation, e.fract()*10f);
Draw.reset();
});
Effects.create("shockwave", 10f, e -> {
Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.ifract());
Draw.thick(e.fract()*2f + 0.2f);

View File

@ -34,6 +34,13 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
Draw.reset();
}
},
chain = new BulletType(2f, 8){
public void draw(Bullet b){
Draw.color("gray");
Draw.rect("bullet", b.x, b.y, b.angle());
Draw.reset();
}
},
sniper = new BulletType(3f, 23){
public void draw(Bullet b){
Draw.color(Color.LIGHT_GRAY);

View File

@ -78,7 +78,6 @@ import io.anuke.ucore.entities.Entity;
* Item ID (byte)
* Item amount (int)
* Additional tile entity data (varies, check the TileEntity classes)
*
*/
public class SaveIO{
/**Save file version ID. Should be incremented every breaking release.*/

View File

@ -1,6 +1,5 @@
package io.anuke.mindustry.ui;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.Timer;
import com.badlogic.gdx.utils.Timer.Task;
@ -53,8 +52,8 @@ public class LoadDialog extends FloatingDialog{
button.add(info).padBottom(2).padTop(6);
button.row();
button.addImage("white", Color.GRAY)
.growX().height(3f).pad(4f).units(Unit.dp);
//button.addImage("white", Color.GRAY)
//.growX().height(3f).pad(4f).units(Unit.dp);
button.row();
modifyButton(button, slot);

View File

@ -1,6 +1,7 @@
package io.anuke.mindustry.world.blocks;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.math.Vector2;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.entities.BulletType;
@ -11,6 +12,7 @@ import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.types.defense.LaserTurret;
import io.anuke.mindustry.world.blocks.types.defense.PowerTurret;
import io.anuke.mindustry.world.blocks.types.defense.Turret;
import io.anuke.ucore.core.Effects;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.util.Angles;
import io.anuke.ucore.util.Mathf;
@ -168,13 +170,30 @@ public class WeaponBlocks{
inaccuracy = 7f;
formalName = "chain turret";
range = 60f;
reload = 40f;
bullet = BulletType.shell;
ammo = Item.coal;
reload = 10f;
bullet = BulletType.chain;
ammo = Item.stone; //TODO
health = 430;
ammoMultiplier = 10;
width = height = 2;
}
@Override
protected void shoot(Tile tile){
TurretEntity entity = tile.entity();
Vector2 offset = getPlaceOffset();
float len = 8;
float space = 4f;
Angles.vector.set(len, -space).rotate(entity.rotation);
bullet(tile, entity.rotation);
Effects.effect("chainshot", tile.worldx() + Angles.x() + offset.x, tile.worldy()+ Angles.y() + offset.y, entity.rotation);
Angles.vector.set(len, space).rotate(entity.rotation);
bullet(tile, entity.rotation);
Effects.effect("chainshot", tile.worldx() + Angles.x() + offset.x, tile.worldy()+ Angles.y() + offset.y, entity.rotation);
}
},
titanturret = new Turret("titancannon"){

View File

@ -0,0 +1,15 @@
package io.anuke.ucore.function;
import com.badlogic.gdx.utils.Pool.Poolable;
public class DelayRun implements Poolable{
public float delay;
public Callable run;
public Callable finish;
@Override
public void reset(){
delay = 0;
run = finish = null;
}
}

View File

@ -3,5 +3,5 @@ package io.anuke.ucore.function;
import com.badlogic.gdx.graphics.Color;
public interface EffectProvider{
public void createEffect(String name, Color color, float x, float y);
public void createEffect(String name, Color color, float x, float y, float rotation);
}

View File

@ -0,0 +1,5 @@
package io.anuke.ucore.function;
public interface Event{
}

View File

@ -0,0 +1,5 @@
package io.anuke.ucore.function;
public interface ISegmentConsumer{
public void accept(int x, int y, int x2, int y2);
}

View File

@ -1,5 +1,5 @@
package io.anuke.ucore.function;
public interface SegmentConsumer{
public void accept(int x, int y, int x2, int y2);
public void accept(float x, float y, float x2, float y2);
}

View File

@ -0,0 +1,5 @@
package io.anuke.ucore.function;
public interface TriPosConsumer{
public void accept(int x, int y, int z);
}