Renaming before uploading new code
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package io.anuke.moment;
|
||||
package io.anuke.mindustry;
|
||||
|
||||
import static io.anuke.moment.world.TileType.tilesize;
|
||||
import static io.anuke.mindustry.world.TileType.tilesize;
|
||||
|
||||
import com.badlogic.gdx.Application.ApplicationType;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
@@ -12,11 +12,11 @@ import com.badlogic.gdx.math.MathUtils;
|
||||
import com.badlogic.gdx.math.Rectangle;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
|
||||
import io.anuke.moment.ai.Pathfind;
|
||||
import io.anuke.moment.entities.TileEntity;
|
||||
import io.anuke.moment.resource.ItemStack;
|
||||
import io.anuke.moment.world.Tile;
|
||||
import io.anuke.moment.world.TileType;
|
||||
import io.anuke.mindustry.ai.Pathfind;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.resource.ItemStack;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.TileType;
|
||||
import io.anuke.ucore.core.*;
|
||||
import io.anuke.ucore.entities.*;
|
||||
import io.anuke.ucore.graphics.Atlas;
|
||||
@@ -39,52 +39,53 @@ public class Control extends RendererModule<Moment>{
|
||||
setPixelation();
|
||||
buffers.add("shadow", (int) (Gdx.graphics.getWidth() / cameraScale), (int) (Gdx.graphics.getHeight() / cameraScale));
|
||||
|
||||
USound.load("shoot.wav", "place.wav", "explosion.wav", "enemyshoot.wav", "corexplode.wav", "break.wav", "spawn.wav", "flame.wav");
|
||||
UMusic.load("1.mp3", "2.mp3", "3.mp3");
|
||||
UMusic.shuffleAll();
|
||||
Sounds.load("shoot.wav", "place.wav", "explosion.wav", "enemyshoot.wav", "corexplode.wav", "break.wav", "spawn.wav", "flame.wav");
|
||||
Musics.load("1.mp3", "2.mp3", "3.mp3");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(){
|
||||
Musics.shuffleAll();
|
||||
DrawContext.font = Styles.styles.font();
|
||||
|
||||
Entities.initPhysics(0, 0, main.pixsize, main.pixsize);
|
||||
|
||||
Effect.addDraw("place", 16, e -> {
|
||||
Effect.create("place", 16, e -> {
|
||||
Draw.thickness(3f - e.ifract() * 2f);
|
||||
Draw.square(e.x, e.y, TileType.tilesize / 2 + e.ifract() * 3f);
|
||||
Draw.clear();
|
||||
});
|
||||
|
||||
Effect.addDraw("spark", 10, e -> {
|
||||
Effect.create("spark", 10, e -> {
|
||||
Draw.thickness(1f);
|
||||
Draw.color(Hue.mix(Color.WHITE, Color.GRAY, e.ifract()));
|
||||
Draw.spikes(e.x, e.y, e.ifract() * 5f, 2, 8);
|
||||
Draw.clear();
|
||||
});
|
||||
|
||||
Effect.addDraw("smelt", 10, e -> {
|
||||
Effect.create("smelt", 10, e -> {
|
||||
Draw.thickness(1f);
|
||||
Draw.color(Hue.mix(Color.YELLOW, Color.RED, e.ifract()));
|
||||
Draw.spikes(e.x, e.y, e.ifract() * 5f, 2, 8);
|
||||
Draw.clear();
|
||||
});
|
||||
|
||||
Effect.addDraw("break", 12, e -> {
|
||||
Effect.create("break", 12, e -> {
|
||||
Draw.thickness(2f);
|
||||
Draw.color(Color.WHITE, Color.GRAY, e.ifract());
|
||||
Draw.spikes(e.x, e.y, e.ifract() * 5f, 2, 5);
|
||||
Draw.clear();
|
||||
});
|
||||
|
||||
Effect.addDraw("hit", 10, e -> {
|
||||
Effect.create("hit", 10, e -> {
|
||||
Draw.thickness(1f);
|
||||
Draw.color(Hue.mix(Color.WHITE, Color.ORANGE, e.ifract()));
|
||||
Draw.spikes(e.x, e.y, e.ifract() * 3f, 2, 8);
|
||||
Draw.clear();
|
||||
});
|
||||
|
||||
Effect.addDraw("explosion", 15, e -> {
|
||||
Effect.create("explosion", 15, e -> {
|
||||
Draw.thickness(2f);
|
||||
Draw.color(Hue.mix(Color.ORANGE, Color.GRAY, e.ifract()));
|
||||
Draw.spikes(e.x, e.y, 2f + e.ifract() * 3f, 4, 6);
|
||||
@@ -92,7 +93,7 @@ public class Control extends RendererModule<Moment>{
|
||||
Draw.clear();
|
||||
});
|
||||
|
||||
Effect.addDraw("coreexplosion", 13, e -> {
|
||||
Effect.create("coreexplosion", 13, e -> {
|
||||
Draw.thickness(3f-e.ifract()*2f);
|
||||
Draw.color(Hue.mix(Color.ORANGE, Color.WHITE, e.ifract()));
|
||||
Draw.spikes(e.x, e.y, 5f + e.ifract() * 40f, 6, 6);
|
||||
@@ -100,21 +101,21 @@ public class Control extends RendererModule<Moment>{
|
||||
Draw.clear();
|
||||
});
|
||||
|
||||
Effect.addDraw("spawn", 23, e -> {
|
||||
Effect.create("spawn", 23, e -> {
|
||||
Draw.thickness(2f);
|
||||
Draw.color(Hue.mix(Color.DARK_GRAY, Color.SCARLET, e.ifract()));
|
||||
Draw.circle(e.x, e.y, 7f - e.ifract() * 6f);
|
||||
Draw.clear();
|
||||
});
|
||||
|
||||
Effect.addDraw("ind", 100, e -> {
|
||||
Effect.create("ind", 100, e -> {
|
||||
Draw.thickness(3f);
|
||||
Draw.color("royal");
|
||||
Draw.circle(e.x, e.y, 3);
|
||||
Draw.clear();
|
||||
});
|
||||
|
||||
Effect.addDraw("respawn", main.respawntime, e -> {
|
||||
Effect.create("respawn", main.respawntime, e -> {
|
||||
Draw.tcolor(Color.SCARLET);
|
||||
Draw.tscl(0.25f);
|
||||
Draw.text("Respawning in " + (int)((e.lifetime-e.time)/60), e.x, e.y);
|
||||
@@ -161,7 +162,7 @@ public class Control extends RendererModule<Moment>{
|
||||
|
||||
void input(){
|
||||
|
||||
if(UInput.keyUp("rotate"))
|
||||
if(Inputs.keyUp("rotate"))
|
||||
main.rotation++;
|
||||
|
||||
main.rotation %= 4;
|
||||
@@ -170,14 +171,8 @@ public class Control extends RendererModule<Moment>{
|
||||
main.recipe = null;
|
||||
Cursors.restoreCursor();
|
||||
}
|
||||
|
||||
//TODO
|
||||
//if(UInput.keyUp(Keys.G)){
|
||||
// new Enemy(0).set(main.player.x, main.player.y).add();
|
||||
//}
|
||||
//new FlameEnemy(0).set(main.player.x, main.player.y).add();
|
||||
|
||||
if(UInput.buttonUp(Buttons.LEFT) && main.recipe != null && validPlace(tilex(), tiley(), main.recipe.result) && !get(UI.class).hasMouse()){
|
||||
if(Inputs.buttonUp(Buttons.LEFT) && main.recipe != null && validPlace(tilex(), tiley(), main.recipe.result) && !get(UI.class).hasMouse()){
|
||||
Tile tile = main.tile(tilex(), tiley());
|
||||
if(tile == null)
|
||||
return; //just in ase
|
||||
@@ -189,7 +184,7 @@ public class Control extends RendererModule<Moment>{
|
||||
|
||||
Effects.effect("place", roundx(), roundy());
|
||||
Effects.shake(2f, 2f);
|
||||
USound.play("place");
|
||||
Sounds.play("place");
|
||||
|
||||
for(ItemStack stack : main.recipe.requirements){
|
||||
main.removeItem(stack);
|
||||
@@ -201,13 +196,13 @@ public class Control extends RendererModule<Moment>{
|
||||
}
|
||||
}
|
||||
|
||||
if(main.recipe != null && UInput.buttonUp(Buttons.RIGHT)){
|
||||
if(main.recipe != null && Inputs.buttonUp(Buttons.RIGHT)){
|
||||
main.recipe = null;
|
||||
Cursors.restoreCursor();
|
||||
}
|
||||
|
||||
//block breaking
|
||||
if(UInput.buttonDown(Buttons.RIGHT) && cursorNear() && main.tile(tilex(), tiley()).artifical()
|
||||
if(Inputs.buttonDown(Buttons.RIGHT) && cursorNear() && main.tile(tilex(), tiley()).artifical()
|
||||
&& main.tile(tilex(), tiley()).block() != TileType.core){
|
||||
Tile tile = main.tile(tilex(), tiley());
|
||||
breaktime += delta();
|
||||
@@ -217,7 +212,7 @@ public class Control extends RendererModule<Moment>{
|
||||
tile.setBlock(TileType.air);
|
||||
Pathfind.updatePath();
|
||||
breaktime = 0f;
|
||||
USound.play("break");
|
||||
Sounds.play("break");
|
||||
}
|
||||
}else{
|
||||
breaktime = 0f;
|
||||
@@ -226,19 +221,19 @@ public class Control extends RendererModule<Moment>{
|
||||
}
|
||||
|
||||
float roundx(){
|
||||
return Mathf.round2(UGraphics.mouseWorldPos().x, TileType.tilesize);
|
||||
return Mathf.round2(Graphics.mouseWorld().x, TileType.tilesize);
|
||||
}
|
||||
|
||||
float roundy(){
|
||||
return Mathf.round2(UGraphics.mouseWorldPos().y, TileType.tilesize);
|
||||
return Mathf.round2(Graphics.mouseWorld().y, TileType.tilesize);
|
||||
}
|
||||
|
||||
int tilex(){
|
||||
return Mathf.scl2(UGraphics.mouseWorldPos().x, TileType.tilesize);
|
||||
return Mathf.scl2(Graphics.mouseWorld().x, TileType.tilesize);
|
||||
}
|
||||
|
||||
int tiley(){
|
||||
return Mathf.scl2(UGraphics.mouseWorldPos().y, TileType.tilesize);
|
||||
return Mathf.scl2(Graphics.mouseWorld().y, TileType.tilesize);
|
||||
}
|
||||
|
||||
boolean validPlace(int x, int y, TileType type){
|
||||
@@ -278,13 +273,15 @@ public class Control extends RendererModule<Moment>{
|
||||
}
|
||||
|
||||
if(!main.paused)
|
||||
Entities.update();
|
||||
Entities.update();
|
||||
|
||||
input();
|
||||
|
||||
if(main.core.block() == TileType.core)
|
||||
camera.position.set(main.player.x, main.player.y, 0f);
|
||||
else
|
||||
camera.position.set(main.core.worldx(), main.core.worldy(), 0f);
|
||||
|
||||
clampCamera(-tilesize / 2f, -tilesize / 2f, main.pixsize - tilesize / 2f, main.pixsize - tilesize / 2f);
|
||||
|
||||
drawDefault();
|
||||
@@ -344,8 +341,8 @@ public class Control extends RendererModule<Moment>{
|
||||
Entities.draw();
|
||||
|
||||
if(main.recipe != null && !get(UI.class).hasMouse()){
|
||||
float x = Mathf.round2(UGraphics.mouseWorldPos().x, tilesize);
|
||||
float y = Mathf.round2(UGraphics.mouseWorldPos().y, tilesize);
|
||||
float x = Mathf.round2(Graphics.mouseWorld().x, tilesize);
|
||||
float y = Mathf.round2(Graphics.mouseWorld().y, tilesize);
|
||||
|
||||
boolean valid = validPlace(tilex(), tiley(), main.recipe.result);
|
||||
|
||||
@@ -374,7 +371,7 @@ public class Control extends RendererModule<Moment>{
|
||||
}
|
||||
|
||||
//block breaking
|
||||
if(UInput.buttonDown(Buttons.RIGHT) && cursorNear()){
|
||||
if(Inputs.buttonDown(Buttons.RIGHT) && cursorNear()){
|
||||
Tile tile = main.tile(tilex(), tiley());
|
||||
if(tile.artifical() && tile.block() != TileType.core){
|
||||
Draw.color(Color.YELLOW, Color.SCARLET, breaktime / breakdur);
|
||||
@@ -1,21 +1,18 @@
|
||||
package io.anuke.moment;
|
||||
package io.anuke.mindustry;
|
||||
|
||||
import com.badlogic.gdx.Input.Keys;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.ObjectMap;
|
||||
|
||||
import io.anuke.moment.ai.Pathfind;
|
||||
import io.anuke.moment.entities.*;
|
||||
import io.anuke.moment.resource.Item;
|
||||
import io.anuke.moment.resource.ItemStack;
|
||||
import io.anuke.moment.resource.Recipe;
|
||||
import io.anuke.moment.world.Generator;
|
||||
import io.anuke.moment.world.Tile;
|
||||
import io.anuke.moment.world.TileType;
|
||||
import io.anuke.ucore.core.KeyBinds;
|
||||
import io.anuke.ucore.core.Settings;
|
||||
import io.anuke.ucore.core.USound;
|
||||
import io.anuke.ucore.entities.Effects;
|
||||
import io.anuke.mindustry.ai.Pathfind;
|
||||
import io.anuke.mindustry.entities.*;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.resource.ItemStack;
|
||||
import io.anuke.mindustry.resource.Recipe;
|
||||
import io.anuke.mindustry.world.Generator;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.TileType;
|
||||
import io.anuke.ucore.core.*;
|
||||
import io.anuke.ucore.entities.Entities;
|
||||
import io.anuke.ucore.modules.ModuleController;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
@@ -138,7 +135,7 @@ public class Moment extends ModuleController<Moment>{
|
||||
|
||||
public void coreDestroyed(){
|
||||
Effects.shake(5, 6);
|
||||
USound.play("corexplode");
|
||||
Sounds.play("corexplode");
|
||||
for(int i = 0; i < 16; i ++){
|
||||
Timers.run(i*2, ()->{
|
||||
Effects.effect("explosion", core.worldx()+Mathf.range(40), core.worldy()+Mathf.range(40));
|
||||
@@ -186,7 +183,7 @@ public class Moment extends ModuleController<Moment>{
|
||||
|
||||
public void runWave(){
|
||||
int amount = wave;
|
||||
USound.play("spawn");
|
||||
Sounds.play("spawn");
|
||||
|
||||
for(int i = 0; i < amount; i ++){
|
||||
int pos = i;
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.anuke.moment;
|
||||
package io.anuke.mindustry;
|
||||
|
||||
import static io.anuke.moment.world.TileType.tilesize;
|
||||
import static io.anuke.mindustry.world.TileType.tilesize;
|
||||
|
||||
import java.util.function.BooleanSupplier;
|
||||
|
||||
@@ -11,10 +11,10 @@ import com.badlogic.gdx.graphics.Texture.TextureWrap;
|
||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
|
||||
import io.anuke.moment.entities.Enemy;
|
||||
import io.anuke.moment.resource.*;
|
||||
import io.anuke.moment.world.Tile;
|
||||
import io.anuke.moment.world.TileType;
|
||||
import io.anuke.mindustry.entities.Enemy;
|
||||
import io.anuke.mindustry.resource.*;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.TileType;
|
||||
import io.anuke.ucore.core.*;
|
||||
import io.anuke.ucore.modules.SceneModule;
|
||||
import io.anuke.ucore.scene.Scene;
|
||||
@@ -28,7 +28,7 @@ import io.anuke.ucore.util.Timers;
|
||||
|
||||
public class UI extends SceneModule<Moment>{
|
||||
Table itemtable;
|
||||
PrefsDialog prefs;
|
||||
SettingsDialog prefs;
|
||||
KeybindDialog keys;
|
||||
Dialog about, menu, restart, tutorial;
|
||||
Texture conveyor = new Texture("sprites/conveyor.png"), conveyort = new Texture("sprites/conveyort.png");
|
||||
@@ -73,11 +73,6 @@ public class UI extends SceneModule<Moment>{
|
||||
Draw.text("[#f1de60]-( Mindustry )-", w/2, h-10);
|
||||
|
||||
Draw.tscl(0.5f);
|
||||
|
||||
|
||||
|
||||
|
||||
//Draw.rect("conveyor", w/2, h/2, 1000, 1000);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -105,7 +100,7 @@ public class UI extends SceneModule<Moment>{
|
||||
}
|
||||
scene.getBatch().end();
|
||||
|
||||
if(UInput.keyUp("menu")){
|
||||
if(Inputs.keyUp("menu")){
|
||||
if(menu.getScene() != null){
|
||||
menu.hide();
|
||||
main.paused = false;
|
||||
@@ -130,7 +125,7 @@ public class UI extends SceneModule<Moment>{
|
||||
@Override
|
||||
public void init(){
|
||||
|
||||
prefs = new PrefsDialog("Settings");
|
||||
prefs = new SettingsDialog();
|
||||
|
||||
prefs.sliderPref("screenshake", "Screen Shake", 4, 0, 12, i -> {
|
||||
return (i / 4f) + "x";
|
||||
@@ -476,18 +471,18 @@ public class UI extends SceneModule<Moment>{
|
||||
}
|
||||
|
||||
float roundx(){
|
||||
return Mathf.round2(UGraphics.mouseWorldPos().x, TileType.tilesize);
|
||||
return Mathf.round2(Graphics.mouseWorld().x, TileType.tilesize);
|
||||
}
|
||||
|
||||
float roundy(){
|
||||
return Mathf.round2(UGraphics.mouseWorldPos().y, TileType.tilesize);
|
||||
return Mathf.round2(Graphics.mouseWorld().y, TileType.tilesize);
|
||||
}
|
||||
|
||||
int tilex(){
|
||||
return Mathf.scl2(UGraphics.mouseWorldPos().x, TileType.tilesize);
|
||||
return Mathf.scl2(Graphics.mouseWorld().x, TileType.tilesize);
|
||||
}
|
||||
|
||||
int tiley(){
|
||||
return Mathf.scl2(UGraphics.mouseWorldPos().y, TileType.tilesize);
|
||||
return Mathf.scl2(Graphics.mouseWorld().y, TileType.tilesize);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package io.anuke.moment.ai;
|
||||
package io.anuke.mindustry.ai;
|
||||
|
||||
import com.badlogic.gdx.ai.pfa.Heuristic;
|
||||
|
||||
import io.anuke.moment.world.Tile;
|
||||
import io.anuke.moment.world.TileType;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.TileType;
|
||||
|
||||
public class MHueristic implements Heuristic<Tile>{
|
||||
//so this means that the cost of going through solids is 10x going through non solids
|
||||
@@ -1,11 +1,11 @@
|
||||
package io.anuke.moment.ai;
|
||||
package io.anuke.mindustry.ai;
|
||||
|
||||
import com.badlogic.gdx.ai.pfa.Connection;
|
||||
import com.badlogic.gdx.ai.pfa.indexed.IndexedGraph;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
|
||||
import io.anuke.moment.Moment;
|
||||
import io.anuke.moment.world.Tile;
|
||||
import io.anuke.mindustry.Moment;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
|
||||
/**Tilegraph that ignores player-made tiles.*/
|
||||
public class PassTileGraph implements IndexedGraph<Tile>{
|
||||
@@ -1,13 +1,13 @@
|
||||
package io.anuke.moment.ai;
|
||||
package io.anuke.mindustry.ai;
|
||||
|
||||
import com.badlogic.gdx.ai.pfa.DefaultGraphPath;
|
||||
import com.badlogic.gdx.ai.pfa.indexed.IndexedAStarPathFinder;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
|
||||
import io.anuke.moment.Moment;
|
||||
import io.anuke.moment.entities.Enemy;
|
||||
import io.anuke.moment.world.Tile;
|
||||
import io.anuke.mindustry.Moment;
|
||||
import io.anuke.mindustry.entities.Enemy;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.ucore.entities.Entities;
|
||||
import io.anuke.ucore.entities.Entity;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.anuke.moment.ai;
|
||||
package io.anuke.mindustry.ai;
|
||||
|
||||
import com.badlogic.gdx.ai.pfa.Connection;
|
||||
|
||||
import io.anuke.moment.world.Tile;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
|
||||
public class TileConnection implements Connection{
|
||||
Tile a, b;
|
||||
@@ -1,11 +1,11 @@
|
||||
package io.anuke.moment.ai;
|
||||
package io.anuke.mindustry.ai;
|
||||
|
||||
import com.badlogic.gdx.ai.pfa.Connection;
|
||||
import com.badlogic.gdx.ai.pfa.indexed.IndexedGraph;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
|
||||
import io.anuke.moment.Moment;
|
||||
import io.anuke.moment.world.Tile;
|
||||
import io.anuke.mindustry.Moment;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
|
||||
public class TileGraph implements IndexedGraph<Tile>{
|
||||
private Array<Connection<Tile>> tempConnections = new Array<Connection<Tile>>();
|
||||
@@ -1,4 +1,4 @@
|
||||
package io.anuke.moment.entities;
|
||||
package io.anuke.mindustry.entities;
|
||||
|
||||
import io.anuke.ucore.core.Draw;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.anuke.moment.entities;
|
||||
package io.anuke.mindustry.entities;
|
||||
|
||||
import io.anuke.moment.Moment;
|
||||
import io.anuke.moment.world.Tile;
|
||||
import io.anuke.moment.world.TileType;
|
||||
import io.anuke.mindustry.Moment;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.TileType;
|
||||
import io.anuke.ucore.entities.BulletEntity;
|
||||
import io.anuke.ucore.entities.Entity;
|
||||
import io.anuke.ucore.entities.SolidEntity;
|
||||
@@ -12,9 +12,8 @@ public class Bullet extends BulletEntity{
|
||||
BulletType type;
|
||||
|
||||
public Bullet(BulletType type, Entity owner, float x, float y, float angle){
|
||||
super(owner, type.speed, angle);
|
||||
super(type, owner, angle);
|
||||
set(x, y);
|
||||
this.lifetime = type.lifetime;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@@ -33,7 +32,7 @@ public class Bullet extends BulletEntity{
|
||||
tile.entity.collide(this) && !tile.entity.dead){
|
||||
tile.entity.collision(this);
|
||||
remove();
|
||||
type.collide(this);
|
||||
type.removed(this);
|
||||
}
|
||||
|
||||
super.update();
|
||||
@@ -42,7 +41,7 @@ public class Bullet extends BulletEntity{
|
||||
@Override
|
||||
public void collision(SolidEntity other){
|
||||
super.collision(other);
|
||||
type.collide(this);
|
||||
type.removed(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1,40 +1,43 @@
|
||||
package io.anuke.moment.entities;
|
||||
package io.anuke.mindustry.entities;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
|
||||
import io.anuke.ucore.core.Draw;
|
||||
import io.anuke.ucore.entities.Effects;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.entities.BaseBulletType;
|
||||
|
||||
public enum BulletType{
|
||||
stone(1.5f, 2){
|
||||
public abstract class BulletType extends BaseBulletType<Bullet>{
|
||||
public static final BulletType
|
||||
|
||||
stone = new BulletType(1.5f, 2){
|
||||
public void draw(Bullet b){
|
||||
Draw.color("gray");
|
||||
Draw.square(b.x, b.y, 1f);
|
||||
Draw.clear();
|
||||
}
|
||||
},
|
||||
iron(1.7f, 2){
|
||||
iron = new BulletType(1.7f, 2){
|
||||
public void draw(Bullet b){
|
||||
Draw.color("gray");
|
||||
Draw.rect("bullet", b.x, b.y, b.angle());
|
||||
Draw.clear();
|
||||
}
|
||||
},
|
||||
sniper(3f, 17){
|
||||
sniper = new BulletType(3f, 17){
|
||||
public void draw(Bullet b){
|
||||
Draw.color("light gray");
|
||||
Draw.rect("bullet", b.x, b.y, b.angle());
|
||||
Draw.clear();
|
||||
}
|
||||
},
|
||||
small(1.5f, 1){
|
||||
small = new BulletType(1.5f, 1){
|
||||
public void draw(Bullet b){
|
||||
Draw.color("orange");
|
||||
Draw.rect("bullet", b.x, b.y, b.angle());
|
||||
Draw.clear();
|
||||
}
|
||||
},
|
||||
smallfast(1.6f, 2){
|
||||
smallfast = new BulletType(1.6f, 2){
|
||||
Color color = new Color(0x8b5ec9ff);
|
||||
public void draw(Bullet b){
|
||||
Draw.color(color);
|
||||
@@ -42,7 +45,7 @@ public enum BulletType{
|
||||
Draw.clear();
|
||||
}
|
||||
},
|
||||
flame(0.6f, 4){
|
||||
flame = new BulletType(0.6f, 4){
|
||||
public void draw(Bullet b){
|
||||
Draw.color(Color.YELLOW, Color.SCARLET, b.time/lifetime);
|
||||
float size = 6f-b.time/lifetime*5f;
|
||||
@@ -50,7 +53,7 @@ public enum BulletType{
|
||||
Draw.clear();
|
||||
}
|
||||
},
|
||||
flameshot(0.5f, 3){
|
||||
flameshot = new BulletType(0.5f, 3){
|
||||
public void draw(Bullet b){
|
||||
Draw.color(Color.ORANGE, Color.SCARLET, b.time/lifetime);
|
||||
float size = 6f-b.time/lifetime*5f;
|
||||
@@ -58,25 +61,22 @@ public enum BulletType{
|
||||
Draw.clear();
|
||||
}
|
||||
},
|
||||
shot(2.4f, 2){
|
||||
shot = new BulletType(2.4f, 2){
|
||||
{lifetime=40;}
|
||||
public void draw(Bullet b){
|
||||
Draw.color(Color.GOLD);
|
||||
Draw.rect("bullet", b.x, b.y, b.angle());
|
||||
Draw.clear();
|
||||
}
|
||||
};;
|
||||
public float speed;
|
||||
public int damage;
|
||||
public float lifetime = 60;
|
||||
};
|
||||
|
||||
private BulletType(float speed, int damage){
|
||||
this.speed = speed;
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
public void collide(Bullet b){
|
||||
@Override
|
||||
public void removed(Bullet b){
|
||||
Effects.effect("hit", b);
|
||||
}
|
||||
public void draw(Bullet b){}
|
||||
}
|
||||
@@ -1,13 +1,14 @@
|
||||
package io.anuke.moment.entities;
|
||||
package io.anuke.mindustry.entities;
|
||||
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
|
||||
import io.anuke.moment.Control;
|
||||
import io.anuke.moment.Moment;
|
||||
import io.anuke.moment.ai.Pathfind;
|
||||
import io.anuke.moment.world.TileType;
|
||||
import io.anuke.mindustry.Control;
|
||||
import io.anuke.mindustry.Moment;
|
||||
import io.anuke.mindustry.ai.Pathfind;
|
||||
import io.anuke.mindustry.world.TileType;
|
||||
import io.anuke.ucore.core.Draw;
|
||||
import io.anuke.ucore.core.USound;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Sounds;
|
||||
import io.anuke.ucore.entities.*;
|
||||
import io.anuke.ucore.util.Timers;
|
||||
|
||||
@@ -56,7 +57,7 @@ public class Enemy extends DestructibleEntity{
|
||||
if(target != null){
|
||||
if(Timers.get(this, reload)){
|
||||
shoot();
|
||||
USound.play(shootsound);
|
||||
Sounds.play(shootsound);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -77,7 +78,7 @@ public class Enemy extends DestructibleEntity{
|
||||
public void onDeath(){
|
||||
Effects.effect("explosion", this);
|
||||
Effects.shake(3f, 4f);
|
||||
USound.play("explosion");
|
||||
Sounds.play("explosion");
|
||||
remove();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package io.anuke.moment.entities;
|
||||
package io.anuke.mindustry.entities;
|
||||
|
||||
import io.anuke.ucore.core.Draw;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package io.anuke.moment.entities;
|
||||
package io.anuke.mindustry.entities;
|
||||
|
||||
import io.anuke.ucore.core.Draw;
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
package io.anuke.moment.entities;
|
||||
package io.anuke.mindustry.entities;
|
||||
|
||||
import com.badlogic.gdx.Input.Buttons;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
|
||||
import io.anuke.moment.Control;
|
||||
import io.anuke.moment.Moment;
|
||||
import io.anuke.moment.UI;
|
||||
import io.anuke.ucore.core.Draw;
|
||||
import io.anuke.ucore.core.UInput;
|
||||
import io.anuke.ucore.core.USound;
|
||||
import io.anuke.mindustry.Control;
|
||||
import io.anuke.mindustry.Moment;
|
||||
import io.anuke.mindustry.UI;
|
||||
import io.anuke.ucore.core.*;
|
||||
import io.anuke.ucore.entities.DestructibleEntity;
|
||||
import io.anuke.ucore.entities.Effects;
|
||||
import io.anuke.ucore.util.Angles;
|
||||
import io.anuke.ucore.util.Timers;
|
||||
|
||||
@@ -58,22 +55,22 @@ public class Player extends DestructibleEntity{
|
||||
|
||||
vector.set(0, 0);
|
||||
|
||||
if(UInput.keyDown("up"))
|
||||
if(Inputs.keyDown("up"))
|
||||
vector.y += speed;
|
||||
if(UInput.keyDown("down"))
|
||||
if(Inputs.keyDown("down"))
|
||||
vector.y -= speed;
|
||||
if(UInput.keyDown("left"))
|
||||
if(Inputs.keyDown("left"))
|
||||
vector.x -= speed;
|
||||
if(UInput.keyDown("right"))
|
||||
if(Inputs.keyDown("right"))
|
||||
vector.x += speed;
|
||||
|
||||
reload -= delta;
|
||||
|
||||
boolean shooting = UInput.buttonDown(Buttons.LEFT) && Moment.i.recipe == null && !Moment.module(UI.class).hasMouse();
|
||||
boolean shooting = Inputs.buttonDown(Buttons.LEFT) && Moment.i.recipe == null && !Moment.module(UI.class).hasMouse();
|
||||
|
||||
if(shooting && reload <= 0){
|
||||
weapon.shoot(this);
|
||||
USound.play("shoot");
|
||||
Sounds.play("shoot");
|
||||
reload = weapon.reload;
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
package io.anuke.moment.entities;
|
||||
package io.anuke.mindustry.entities;
|
||||
|
||||
import com.badlogic.gdx.utils.DelayedRemovalArray;
|
||||
import com.badlogic.gdx.utils.ObjectMap;
|
||||
|
||||
import io.anuke.moment.Moment;
|
||||
import io.anuke.moment.ai.Pathfind;
|
||||
import io.anuke.moment.resource.Item;
|
||||
import io.anuke.moment.world.Tile;
|
||||
import io.anuke.moment.world.TileType;
|
||||
import io.anuke.ucore.core.USound;
|
||||
import io.anuke.ucore.entities.Effects;
|
||||
import io.anuke.mindustry.Moment;
|
||||
import io.anuke.mindustry.ai.Pathfind;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.TileType;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Sounds;
|
||||
import io.anuke.ucore.entities.Entity;
|
||||
|
||||
public class TileEntity extends Entity{
|
||||
@@ -42,7 +42,7 @@ public class TileEntity extends Entity{
|
||||
Effects.shake(4f, 4f);
|
||||
Effects.effect("explosion", this);
|
||||
|
||||
USound.play("break");
|
||||
Sounds.play("break");
|
||||
}
|
||||
|
||||
public void collision(Bullet other){
|
||||
@@ -1,4 +1,4 @@
|
||||
package io.anuke.moment.entities;
|
||||
package io.anuke.mindustry.entities;
|
||||
|
||||
import io.anuke.ucore.entities.Entity;
|
||||
import io.anuke.ucore.util.Angles;
|
||||
@@ -1,4 +1,4 @@
|
||||
package io.anuke.moment.resource;
|
||||
package io.anuke.mindustry.resource;
|
||||
|
||||
public enum Item{
|
||||
stone, iron, coal, steel;
|
||||
@@ -1,4 +1,4 @@
|
||||
package io.anuke.moment.resource;
|
||||
package io.anuke.mindustry.resource;
|
||||
|
||||
public class ItemStack{
|
||||
public Item item;
|
||||
@@ -1,10 +1,10 @@
|
||||
package io.anuke.moment.resource;
|
||||
package io.anuke.mindustry.resource;
|
||||
|
||||
import static io.anuke.moment.resource.Section.*;
|
||||
import static io.anuke.mindustry.resource.Section.*;
|
||||
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
|
||||
import io.anuke.moment.world.TileType;
|
||||
import io.anuke.mindustry.world.TileType;
|
||||
|
||||
public enum Recipe{
|
||||
stonewall(distribution, TileType.stonewall, stack(Item.stone, 5)),
|
||||
@@ -1,4 +1,4 @@
|
||||
package io.anuke.moment.resource;
|
||||
package io.anuke.mindustry.resource;
|
||||
|
||||
public enum Section{
|
||||
defense, production, distribution;
|
||||
@@ -1,11 +1,11 @@
|
||||
package io.anuke.moment.world;
|
||||
package io.anuke.mindustry.world;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.Pixmap;
|
||||
import com.badlogic.gdx.math.MathUtils;
|
||||
|
||||
import io.anuke.moment.Moment;
|
||||
import io.anuke.mindustry.Moment;
|
||||
import io.anuke.ucore.noise.Noise;
|
||||
|
||||
public class Generator{
|
||||
@@ -1,7 +1,7 @@
|
||||
package io.anuke.moment.world;
|
||||
package io.anuke.mindustry.world;
|
||||
|
||||
import io.anuke.moment.Moment;
|
||||
import io.anuke.moment.entities.TileEntity;
|
||||
import io.anuke.mindustry.Moment;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
|
||||
public class Tile{
|
||||
private static Tile[] tiles = new Tile[4];
|
||||
@@ -1,16 +1,17 @@
|
||||
package io.anuke.moment.world;
|
||||
package io.anuke.mindustry.world;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.math.MathUtils;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
|
||||
import io.anuke.moment.Moment;
|
||||
import io.anuke.moment.entities.*;
|
||||
import io.anuke.moment.entities.TileEntity.ItemPos;
|
||||
import io.anuke.moment.resource.Item;
|
||||
import io.anuke.mindustry.Moment;
|
||||
import io.anuke.mindustry.entities.*;
|
||||
import io.anuke.mindustry.entities.TileEntity.ItemPos;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.ucore.core.Draw;
|
||||
import io.anuke.ucore.core.USound;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Sounds;
|
||||
import io.anuke.ucore.entities.*;
|
||||
import io.anuke.ucore.graphics.Hue;
|
||||
import io.anuke.ucore.util.Angles;
|
||||
@@ -564,7 +565,7 @@ public enum TileType{
|
||||
if(enemy != null){
|
||||
tile.entity.rotation = MathUtils.lerpAngleDeg(tile.entity.rotation, Angles.predictAngle(tile.worldx(), tile.worldy(), enemy.x, enemy.y, enemy.xvelocity, enemy.yvelocity, bullet.speed - 0.1f), 0.2f);
|
||||
if(Timers.get(tile, reload)){
|
||||
USound.play("shoot");
|
||||
Sounds.play("shoot");
|
||||
shoot(tile);
|
||||
tile.entity.shots--;
|
||||
}
|
||||
Reference in New Issue
Block a user