Added new SFX, dashing, made generation FPS-independent

This commit is contained in:
Anuken
2017-12-10 17:01:14 -05:00
parent 347cae23e5
commit 5ea8f0b8e2
27 changed files with 110 additions and 44 deletions

View File

@@ -3,7 +3,6 @@ package io.anuke.mindustry.entities;
import static io.anuke.mindustry.Vars.*;
import com.badlogic.gdx.Input.Buttons;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Vector2;
@@ -26,7 +25,8 @@ public class Player extends DestructibleEntity{
public int rotation;
private Vector2 direction = new Vector2();
private float speed = 1f;
private float speed = 1.1f;
private float dashSpeed = 1.8f;
public Player(){
hitbox.setSize(5);
@@ -71,8 +71,13 @@ public class Player extends DestructibleEntity{
float speed = this.speed;
if(Vars.debug && Inputs.keyDown(Keys.SHIFT_LEFT))
speed *= 3f;
if(Inputs.keyDown("dash")){
speed = dashSpeed;
if(Vars.debug){
// speed *= 3f;
}
}
if(health < maxhealth && Timers.get(this, "regen", 50))
health ++;
@@ -88,13 +93,18 @@ public class Player extends DestructibleEntity{
if(Inputs.keyDown("right"))
vector.x += speed;
boolean shooting = Inputs.buttonDown(Buttons.LEFT) && recipe == null && !ui.hasMouse() && !Input.onConfigurable();
boolean shooting = !Inputs.keyDown("dash") && Inputs.buttonDown(Buttons.LEFT) && recipe == null && !ui.hasMouse() && !Input.onConfigurable();
if(shooting && Timers.get(this, "reload", weapon.reload)){
weapon.shoot(this);
Sounds.play(weapon.shootsound);
}
if(Inputs.keyDown("dash") && Timers.get(this, "dashfx", 3) && vector.len() > 0){
Angles.translation(direction.angle() + 180, 3f);
Effects.effect(Fx.dashsmoke, x + Angles.x(), y + Angles.y());
}
vector.limit(speed);
if(!Vars.noclip){

View File

@@ -438,6 +438,14 @@ public class Fx{
Draw.reset();
}),
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();
}),
spawn = new Effect(23, e -> {
Draw.thickness(2f);
Draw.color(Color.DARK_GRAY, Color.SCARLET, e.ifract());

View File

@@ -203,7 +203,7 @@ public class Enemy extends DestructibleEntity{
public void onDeath(){
Effects.effect(Fx.explosion, this);
Effects.shake(3f, 4f, this);
Effects.sound("explosion", this);
Effects.sound("bang2", this);
remove();
dead = true;
}

View File

@@ -83,7 +83,7 @@ public class HealerEnemy extends Enemy{
void explode(){
Bullet b = new Bullet(BulletType.blast, this, x, y, 0).add();
b.damage = BulletType.blast.damage + (tier-1) * 40;
b.damage = BulletType.blast.damage + (tier-1) * 30;
damage(999);
}