mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-13 12:16:53 +07:00
Added respawn animation on game start
This commit is contained in:
parent
e534a6b7fc
commit
24e7d755eb
Binary file not shown.
Before Width: | Height: | Size: 567 B After Width: | Height: | Size: 580 B |
Binary file not shown.
Before Width: | Height: | Size: 111 KiB After Width: | Height: | Size: 111 KiB |
@ -135,11 +135,9 @@ public class Control extends Module{
|
|||||||
|
|
||||||
Events.on(PlayEvent.class, () -> {
|
Events.on(PlayEvent.class, () -> {
|
||||||
for(Player player : players){
|
for(Player player : players){
|
||||||
player.set(world.getSpawnX(), world.getSpawnY());
|
player.dead = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Core.camera.position.set(world.getSpawnX(), world.getSpawnY(), 0);
|
|
||||||
|
|
||||||
state.set(State.playing);
|
state.set(State.playing);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -6,9 +6,9 @@ import com.badlogic.gdx.utils.TimeUtils;
|
|||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
import io.anuke.mindustry.content.Mechs;
|
import io.anuke.mindustry.content.Mechs;
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
import io.anuke.mindustry.entities.bullet.BulletType;
|
|
||||||
import io.anuke.mindustry.entities.Player;
|
import io.anuke.mindustry.entities.Player;
|
||||||
import io.anuke.mindustry.entities.SyncEntity;
|
import io.anuke.mindustry.entities.SyncEntity;
|
||||||
|
import io.anuke.mindustry.entities.bullet.BulletType;
|
||||||
import io.anuke.mindustry.gen.CallServer;
|
import io.anuke.mindustry.gen.CallServer;
|
||||||
import io.anuke.mindustry.io.Version;
|
import io.anuke.mindustry.io.Version;
|
||||||
import io.anuke.mindustry.net.*;
|
import io.anuke.mindustry.net.*;
|
||||||
@ -22,7 +22,6 @@ import io.anuke.mindustry.world.Block;
|
|||||||
import io.anuke.mindustry.world.Build;
|
import io.anuke.mindustry.world.Build;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
import io.anuke.ucore.entities.BaseBulletType;
|
|
||||||
import io.anuke.ucore.entities.Entities;
|
import io.anuke.ucore.entities.Entities;
|
||||||
import io.anuke.ucore.entities.EntityGroup;
|
import io.anuke.ucore.entities.EntityGroup;
|
||||||
import io.anuke.ucore.modules.Module;
|
import io.anuke.ucore.modules.Module;
|
||||||
@ -106,7 +105,7 @@ public class NetServer extends Module{
|
|||||||
player.name = packet.name;
|
player.name = packet.name;
|
||||||
player.uuid = uuid;
|
player.uuid = uuid;
|
||||||
player.mech = packet.mobile ? Mechs.standardShip : Mechs.standard;
|
player.mech = packet.mobile ? Mechs.standardShip : Mechs.standard;
|
||||||
player.set(world.getSpawnX(), world.getSpawnY());
|
player.dead = true;
|
||||||
player.setNet(player.x, player.y);
|
player.setNet(player.x, player.y);
|
||||||
player.setNet(player.x, player.y);
|
player.setNet(player.x, player.y);
|
||||||
player.color.set(packet.color);
|
player.color.set(packet.color);
|
||||||
|
@ -55,15 +55,6 @@ public class World extends Module{
|
|||||||
public Pathfinder pathfinder(){
|
public Pathfinder pathfinder(){
|
||||||
return pathfinder;
|
return pathfinder;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO proper spawnpoints!
|
|
||||||
public float getSpawnX(){
|
|
||||||
return width() * tilesize/2f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getSpawnY(){
|
|
||||||
return height() * tilesize/2f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean solid(int x, int y){
|
public boolean solid(int x, int y){
|
||||||
Tile tile = tile(x, y);
|
Tile tile = tile(x, y);
|
||||||
|
@ -133,16 +133,10 @@ public class Player extends Unit implements BlockBuilder {
|
|||||||
@Override
|
@Override
|
||||||
public void onRemoteDeath(){
|
public void onRemoteDeath(){
|
||||||
dead = true;
|
dead = true;
|
||||||
respawning = true;
|
respawning = false;
|
||||||
Effects.effect(ExplosionFx.explosion, this);
|
Effects.effect(ExplosionFx.explosion, this);
|
||||||
Effects.shake(4f, 5f, this);
|
Effects.shake(4f, 5f, this);
|
||||||
Effects.sound("die", this);
|
Effects.sound("die", this);
|
||||||
|
|
||||||
Timers.run(respawnduration + 5f, () -> {
|
|
||||||
heal();
|
|
||||||
set(world.getSpawnX(), world.getSpawnY());
|
|
||||||
interpolator.target.set(x, y);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -166,7 +166,7 @@ public class NetworkIO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
player.set(world.getSpawnX(), world.getSpawnY());
|
player.dead = true;
|
||||||
|
|
||||||
world.endMapLoad();
|
world.endMapLoad();
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ import io.anuke.ucore.graphics.Lines;
|
|||||||
import io.anuke.ucore.util.EnumSet;
|
import io.anuke.ucore.util.EnumSet;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
|
import static io.anuke.mindustry.Vars.debug;
|
||||||
import static io.anuke.mindustry.Vars.state;
|
import static io.anuke.mindustry.Vars.state;
|
||||||
|
|
||||||
public class CoreBlock extends StorageBlock {
|
public class CoreBlock extends StorageBlock {
|
||||||
@ -77,8 +78,6 @@ public class CoreBlock extends StorageBlock {
|
|||||||
size * Vars.tilesize /2f);
|
size * Vars.tilesize /2f);
|
||||||
|
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
|
|
||||||
//Draw.rect(name + (!entity.solid ? "-top-open" : "-top"), tile.drawx(), tile.drawy());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,6 +137,11 @@ public class CoreBlock extends StorageBlock {
|
|||||||
entity.time += Timers.delta();
|
entity.time += Timers.delta();
|
||||||
entity.progress += 1f / Vars.respawnduration;
|
entity.progress += 1f / Vars.respawnduration;
|
||||||
|
|
||||||
|
//instant build for fast testing.
|
||||||
|
if(debug){
|
||||||
|
entity.progress = 1f;
|
||||||
|
}
|
||||||
|
|
||||||
if(entity.progress >= 1f){
|
if(entity.progress >= 1f){
|
||||||
Effects.effect(Fx.spawn, entity);
|
Effects.effect(Fx.spawn, entity);
|
||||||
entity.progress = 0;
|
entity.progress = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user