Fixed bundle settings, edited basic guns, removed weapon display
This commit is contained in:
@@ -16,6 +16,7 @@ import io.anuke.mindustry.graphics.Fx;
|
||||
import io.anuke.mindustry.input.AndroidInput;
|
||||
import io.anuke.mindustry.input.DesktopInput;
|
||||
import io.anuke.mindustry.input.InputHandler;
|
||||
import io.anuke.mindustry.io.BundleGen;
|
||||
import io.anuke.mindustry.io.Saves;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
@@ -75,6 +76,8 @@ public class Control extends Module{
|
||||
private boolean controlling;
|
||||
|
||||
public Control(){
|
||||
BundleGen.cleanBundles(Gdx.files.internal("bundles/bundle.properties"));
|
||||
|
||||
if(Mindustry.args.contains("-debug", false))
|
||||
Vars.debug = true;
|
||||
|
||||
@@ -225,6 +228,11 @@ public class Control extends Module{
|
||||
|
||||
weapons.add(Weapon.blaster);
|
||||
player.weaponLeft = player.weaponRight = weapons.first();
|
||||
|
||||
if(debug){
|
||||
weapons.add(Weapon.triblaster);
|
||||
player.weaponLeft = player.weaponRight = weapons.peek();
|
||||
}
|
||||
|
||||
lastUpdated = -1;
|
||||
wave = 1;
|
||||
|
||||
@@ -282,16 +282,36 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
|
||||
Draw.reset();
|
||||
}
|
||||
},
|
||||
shot = new BulletType(2.4f, 4){
|
||||
{lifetime = 40;}
|
||||
shot = new BulletType(2.7f, 4){
|
||||
{
|
||||
lifetime = 40;
|
||||
}
|
||||
|
||||
public void draw(Bullet b){
|
||||
Draw.color(lightGold);
|
||||
Draw.rect("bullet", b.x, b.y, b.angle());
|
||||
Draw.color(Color.WHITE, lightOrange, b.fract()/2f + 0.25f);
|
||||
Draw.thick(1.5f);
|
||||
Draw.lineAngle(b.x, b.y, b.angle(), 3f);
|
||||
Draw.reset();
|
||||
}
|
||||
},
|
||||
spread = new BulletType(2.4f, 6) {
|
||||
{
|
||||
lifetime = 50;
|
||||
}
|
||||
|
||||
public void draw(Bullet b) {
|
||||
float size = 3f - b.ifract()*1f;
|
||||
|
||||
Draw.color(Color.PURPLE, Color.WHITE, 0.8f);
|
||||
Draw.thick(1f);
|
||||
Draw.circle(b.x, b.y, size);
|
||||
Draw.reset();
|
||||
}
|
||||
},
|
||||
multishot = new BulletType(2.5f, 3){
|
||||
{lifetime=40;}
|
||||
{
|
||||
lifetime = 40;
|
||||
}
|
||||
public void draw(Bullet b){
|
||||
Draw.color(Color.SKY);
|
||||
Draw.rect("bullet", b.x, b.y, b.angle());
|
||||
|
||||
@@ -100,13 +100,13 @@ public class Player extends DestructibleEntity implements Syncable{
|
||||
|
||||
if(!isAndroid) {
|
||||
for (boolean b : new boolean[]{true, false}) {
|
||||
Weapon weapon = b ? weaponLeft : weaponRight;
|
||||
Angles.translation(angle + Mathf.sign(b) * -50f, 3.5f);
|
||||
String name = b ? weaponLeft.name : weaponRight.name;
|
||||
float s = 5f;
|
||||
if(snap){
|
||||
Draw.rect(name, (int)x + Angles.x(), (int)y + Angles.y(), s, s, angle- 90);
|
||||
Draw.rect(weapon.name, (int)x + Angles.x(), (int)y + Angles.y(), s, s, angle- 90);
|
||||
}else{
|
||||
Draw.rect(name, x + Angles.x(), y + Angles.y(), s, s, angle - 90);
|
||||
Draw.rect(weapon.name, x + Angles.x(), y + Angles.y(), s, s, angle - 90);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package io.anuke.mindustry.graphics;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.Colors;
|
||||
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.ucore.core.Draw;
|
||||
import io.anuke.ucore.core.Effects.Effect;
|
||||
@@ -350,24 +349,16 @@ public class Fx{
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
shoot = new Effect(8, e -> {
|
||||
laserShoot = new Effect(8, e -> {
|
||||
Draw.thickness(1f);
|
||||
Draw.color(Color.WHITE, Color.GOLD, e.ifract());
|
||||
Draw.spikes(e.x, e.y, e.ifract() * 2f, 2, 5);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
shoot2 = new Effect(8, e -> {
|
||||
Draw.thickness(1f);
|
||||
Draw.color(Color.WHITE, Color.SKY, e.ifract());
|
||||
Draw.color(Color.WHITE, lightOrange, e.ifract());
|
||||
Draw.spikes(e.x, e.y, e.ifract() * 2f, 1, 5);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
shoot3 = new Effect(8, e -> {
|
||||
Draw.thickness(1f);
|
||||
Draw.color(Color.WHITE, Color.GOLD, e.ifract());
|
||||
Draw.spikes(e.x, e.y, e.ifract() * 2f, 1, 5);
|
||||
|
||||
spreadShoot = new Effect(12, e -> {
|
||||
Draw.color(Color.WHITE, Color.PURPLE, e.ifract());
|
||||
Draw.lineShot(e.x, e.y, e.rotation, 3, e.fract(), 9f, 3.5f, 0.8f);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
@@ -460,7 +451,6 @@ public class Fx{
|
||||
|
||||
dashsmoke = new Effect(30, e -> {
|
||||
Draw.color(Color.CORAL, Color.GRAY, e.ifract());
|
||||
//Draw.alpha(e.fract());
|
||||
float size = e.fract()*4f;
|
||||
Draw.rect("circle", e.x, e.y, size, size);
|
||||
Draw.reset();
|
||||
@@ -472,13 +462,6 @@ public class Fx{
|
||||
Draw.circle(e.x, e.y, 7f - e.ifract() * 6f);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
ind = new Effect(100, e -> {
|
||||
Draw.thickness(3f);
|
||||
Draw.color(Color.ROYAL);
|
||||
Draw.circle(e.x, e.y, 3);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
respawn = new Effect(Vars.respawnduration, e -> {
|
||||
Draw.tcolor(Color.SCARLET);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.anuke.mindustry.io;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.files.FileHandle;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.Vars;
|
||||
@@ -21,6 +22,17 @@ import io.anuke.ucore.util.Mathf;
|
||||
public class BundleGen {
|
||||
private static FileHandle file;
|
||||
|
||||
public static void cleanBundles(FileHandle file){
|
||||
String[] strings = file.readString().split("\n");
|
||||
FileHandle out = Gdx.files.absolute("/home/anuke/out.properties");
|
||||
out.writeString("", false);
|
||||
for(String string : strings){
|
||||
if(!string.contains(".description")){
|
||||
out.writeString(string + "\n", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void buildBundle(FileHandle file){
|
||||
BundleGen.file = file;
|
||||
|
||||
|
||||
@@ -16,20 +16,21 @@ import io.anuke.ucore.util.Mathf;
|
||||
public class Weapon extends Upgrade{
|
||||
public static final Weapon
|
||||
|
||||
blaster = new Weapon("blaster", 15, BulletType.shot){
|
||||
blaster = new Weapon("blaster", 12, BulletType.shot){
|
||||
{
|
||||
effect = Fx.shoot3;
|
||||
effect = Fx.laserShoot;
|
||||
}
|
||||
},
|
||||
triblaster = new Weapon("triblaster", 13, BulletType.shot){
|
||||
triblaster = new Weapon("triblaster", 18, BulletType.spread){
|
||||
{
|
||||
shots = 3;
|
||||
effect = Fx.shoot;
|
||||
effect = Fx.spreadShoot;
|
||||
roundrobin = true;
|
||||
}
|
||||
},
|
||||
multigun = new Weapon("multigun", 6, BulletType.multishot){
|
||||
{
|
||||
effect = Fx.shoot2;
|
||||
effect = Fx.laserShoot;
|
||||
inaccuracy = 6f;
|
||||
}
|
||||
},
|
||||
@@ -52,14 +53,24 @@ public class Weapon extends Upgrade{
|
||||
shake = 2f;
|
||||
}
|
||||
};
|
||||
|
||||
/**weapon reload in frames*/
|
||||
float reload;
|
||||
/**type of bullet shot*/
|
||||
BulletType type;
|
||||
/**sound made when shooting*/
|
||||
String shootsound = "shoot";
|
||||
/**amount of shots per fire*/
|
||||
int shots = 1;
|
||||
/**spacing in degrees between multiple shots, if applicable*/
|
||||
float spacing = 12f;
|
||||
/**inaccuracy of degrees of each shot*/
|
||||
float inaccuracy = 0f;
|
||||
/**intensity and duration of each shot's screen shake*/
|
||||
float shake = 0f;
|
||||
/**effect displayed when shooting*/
|
||||
Effect effect;
|
||||
/**whether to shoot the weapons in different arms one after another, rather an all at once*/
|
||||
boolean roundrobin = false;
|
||||
|
||||
private Weapon(String name, float reload, BulletType type){
|
||||
super(name);
|
||||
@@ -69,16 +80,19 @@ public class Weapon extends Upgrade{
|
||||
|
||||
public void update(Player p, boolean left){
|
||||
if(Timers.get(p, "reload"+left, reload)){
|
||||
if(left && roundrobin){
|
||||
Timers.reset(p, "reload" + false, reload/2f);
|
||||
}
|
||||
float ang = Angles.mouseAngle(p.x, p.y);
|
||||
Angles.translation(ang + Mathf.sign(left) * -70f, 2f);
|
||||
Angles.translation(ang + Mathf.sign(left) * -60f, 3f);
|
||||
shoot(p, p.x + Angles.x(), p.y + Angles.y(), Angles.mouseAngle(p.x + Angles.x(), p.y + Angles.y()));
|
||||
}
|
||||
}
|
||||
|
||||
void shootInternal(Player p, float x, float y, float rotation){
|
||||
Angles.shotgun(shots, 12f, rotation, f -> bullet(p, x, y, f + Mathf.range(inaccuracy)));
|
||||
Angles.shotgun(shots, spacing, rotation, f -> bullet(p, x, y, f + Mathf.range(inaccuracy)));
|
||||
Angles.translation(rotation, 3f);
|
||||
if(effect != null) Effects.effect(effect, x + Angles.x(), y + Angles.y());
|
||||
if(effect != null) Effects.effect(effect, x + Angles.x(), y + Angles.y(), rotation);
|
||||
Effects.shake(shake, shake, x, y);
|
||||
Effects.sound(shootsound, x, y);
|
||||
}
|
||||
|
||||
@@ -1,77 +1,11 @@
|
||||
package io.anuke.mindustry.ui.fragments;
|
||||
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.core.GameState;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.resource.Weapon;
|
||||
import io.anuke.ucore.core.Core;
|
||||
import io.anuke.ucore.core.Draw;
|
||||
import io.anuke.ucore.core.Inputs;
|
||||
import io.anuke.ucore.scene.ui.ButtonGroup;
|
||||
import io.anuke.ucore.scene.ui.ImageButton;
|
||||
import io.anuke.ucore.scene.ui.Tooltip;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class WeaponFragment implements Fragment{
|
||||
Table weapontable;
|
||||
|
||||
public void build(){
|
||||
weapontable = Core.scene.table();
|
||||
weapontable.bottom().left();
|
||||
weapontable.setVisible(()-> !GameState.is(State.menu));
|
||||
|
||||
if(android){
|
||||
weapontable.remove();
|
||||
}
|
||||
}
|
||||
|
||||
public void update(){
|
||||
weapontable.clearChildren();
|
||||
|
||||
ButtonGroup<ImageButton> group = new ButtonGroup<>();
|
||||
group.setMaxCheckCount(2);
|
||||
|
||||
weapontable.defaults().size(58, 62);
|
||||
|
||||
for(Weapon weapon : control.getWeapons()){
|
||||
ImageButton button = new ImageButton(Draw.region(weapon.name), "toggle");
|
||||
button.getImageCell().size(8*5);
|
||||
|
||||
group.add(button);
|
||||
|
||||
button.clicked(()->{
|
||||
//if(weapon == player.weapon) return;
|
||||
if(Inputs.keyDown("weapon_alt_select")){
|
||||
player.weaponRight = weapon;
|
||||
}else {
|
||||
player.weaponLeft = weapon;
|
||||
}
|
||||
button.setChecked(true);
|
||||
Vars.netClient.handleWeaponSwitch();
|
||||
});
|
||||
|
||||
button.update(() -> button.setChecked(weapon == player.weaponLeft || weapon == player.weaponRight)); //TODO
|
||||
|
||||
weapontable.add(button);
|
||||
|
||||
Table tiptable = new Table();
|
||||
String description = weapon.description;
|
||||
|
||||
tiptable.background("button");
|
||||
tiptable.add(weapon.localized(), 0.5f).left().padBottom(3f);
|
||||
|
||||
tiptable.row();
|
||||
tiptable.row();
|
||||
tiptable.add("[GRAY]" + description).left();
|
||||
tiptable.margin(14f);
|
||||
|
||||
Tooltip<Table> tip = new Tooltip<>(tiptable);
|
||||
|
||||
tip.setInstant(true);
|
||||
|
||||
button.addListener(tip);
|
||||
}
|
||||
@Override
|
||||
public void build(){
|
||||
|
||||
}
|
||||
|
||||
public void update(){}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user