conflit
BIN
core/assets/arrow0-0.png
Normal file
After Width: | Height: | Size: 783 B |
BIN
core/assets/arrow0-1.png
Normal file
After Width: | Height: | Size: 792 B |
BIN
core/assets/arrow0-2.png
Normal file
After Width: | Height: | Size: 786 B |
BIN
core/assets/arrow0-3.png
Normal file
After Width: | Height: | Size: 777 B |
Before Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
Before Width: | Height: | Size: 136 B After Width: | Height: | Size: 136 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.5 KiB |
|
@ -1,7 +1,6 @@
|
||||||
package sagittarius;
|
package sagittarius;
|
||||||
|
|
||||||
import com.badlogic.gdx.Game;
|
import com.badlogic.gdx.Game;
|
||||||
import com.badlogic.gdx.Gdx;
|
|
||||||
import com.kotcrab.vis.ui.VisUI;
|
import com.kotcrab.vis.ui.VisUI;
|
||||||
import com.badlogic.gdx.audio.Music;
|
import com.badlogic.gdx.audio.Music;
|
||||||
import sagittarius.view.*;
|
import sagittarius.view.*;
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package sagittarius.model;
|
package sagittarius.model;
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import com.badlogic.gdx.files.FileHandle;
|
import com.badlogic.gdx.files.FileHandle;
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.graphics.Pixmap;
|
import com.badlogic.gdx.graphics.Pixmap;
|
||||||
|
@ -32,7 +34,7 @@ public class Arrow extends EntityQuad {
|
||||||
|
|
||||||
private Sound arrowLandedSound = Gdx.audio.newSound(Gdx.files.internal("core/assets/sounds/sf_fleche_plante_01.mp3"));
|
private Sound arrowLandedSound = Gdx.audio.newSound(Gdx.files.internal("core/assets/sounds/sf_fleche_plante_01.mp3"));
|
||||||
private Sound arrowHitSound = Gdx.audio.newSound(Gdx.files.internal("core/assets/sounds/VOXScrm_Cri wilhelm (ID 0477)_LS.wav"));
|
private Sound arrowHitSound = Gdx.audio.newSound(Gdx.files.internal("core/assets/sounds/VOXScrm_Cri wilhelm (ID 0477)_LS.wav"));
|
||||||
private Texture texture;
|
private ArrayList<Texture> texture;
|
||||||
|
|
||||||
// ---------- CONSTRUCTORs ----------
|
// ---------- CONSTRUCTORs ----------
|
||||||
|
|
||||||
|
@ -47,30 +49,41 @@ public class Arrow extends EntityQuad {
|
||||||
super(0, 1, shooter.getColor(), shooter.getPosition());
|
super(0, 1, shooter.getColor(), shooter.getPosition());
|
||||||
this.velocity = new Vector2(power, 0).setAngleDeg(angle);
|
this.velocity = new Vector2(power, 0).setAngleDeg(angle);
|
||||||
this.acceleration = new Vector2();
|
this.acceleration = new Vector2();
|
||||||
this.setOrigin(80, 2);
|
this.setOrigin(40, 2);
|
||||||
this.setSize(100, 4);
|
this.setSize(50, 4);
|
||||||
this.force = computeForce();
|
this.force = computeForce();
|
||||||
this.landed = false;
|
this.landed = false;
|
||||||
|
|
||||||
if (!preview) {
|
if (!preview) {
|
||||||
Pixmap pm = new Pixmap(new FileHandle("core/assets/arrow" + MathUtils.random(2) + ".png"));
|
texture = new ArrayList<>();
|
||||||
pm.setBlending(Pixmap.Blending.None);
|
String path = "core/assets/arrow" + MathUtils.random(2);
|
||||||
for (int x = 0; x < pm.getWidth(); x++) {
|
|
||||||
for (int y = 0; y < pm.getHeight(); y++) {
|
int i = 0;
|
||||||
|
while (true) {
|
||||||
Color pc = new Color();
|
try {
|
||||||
Color.rgba8888ToColor(pc, pm.getPixel(x, y));
|
Pixmap pm = new Pixmap(new FileHandle(path + "-" + i + ".png"));
|
||||||
|
pm.setBlending(Pixmap.Blending.None);
|
||||||
if (pc.r == 1 && pc.g == 1 && pc.b == 1) {
|
for (int x = 0; x < pm.getWidth(); x++) {
|
||||||
pc.r = getColor().r;
|
for (int y = 0; y < pm.getHeight(); y++) {
|
||||||
pc.g = getColor().g;
|
|
||||||
pc.b = getColor().b;
|
Color pc = new Color();
|
||||||
|
Color.rgba8888ToColor(pc, pm.getPixel(x, y));
|
||||||
|
|
||||||
|
if (pc.r == 1 && pc.g == 1 && pc.b == 1) {
|
||||||
|
pc.r = getColor().r;
|
||||||
|
pc.g = getColor().g;
|
||||||
|
pc.b = getColor().b;
|
||||||
|
}
|
||||||
|
|
||||||
|
pm.drawPixel(x, y, Color.rgba8888(pc));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
texture.add(new Texture(pm));
|
||||||
pm.drawPixel(x, y, Color.rgba8888(pc));
|
i++;
|
||||||
|
} catch (com.badlogic.gdx.utils.GdxRuntimeException e) {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
texture = new Texture(pm);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -112,8 +125,9 @@ public class Arrow extends EntityQuad {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Batch batch, float parentAlpha) {
|
public void draw(Batch batch, float parentAlpha) {
|
||||||
batch.draw(texture, getPosition().x - 0.8f * getWidth(), getPosition().y - getHeight()/2 - 10, 0.8f * this.getWidth(), this.getHeight()/2 + 10, getWidth(), 20 + getHeight(),
|
int i = (int) (TTL * 3) % texture.size();
|
||||||
1, 1, getRotation(), 0, 0, texture.getWidth(), texture.getHeight(), false, false);
|
batch.draw(texture.get(i), getPosition().x - getOriginX(), getPosition().y - getWidth()/2, getOriginX(), getWidth()/2, getWidth(), getWidth(),
|
||||||
|
1, 1, getRotation(), 0, 0, texture.get(i).getWidth(), texture.get(i).getHeight(), false, false);
|
||||||
super.draw(batch, parentAlpha);
|
super.draw(batch, parentAlpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,6 +222,7 @@ public class Arrow extends EntityQuad {
|
||||||
GameScreen.setFocus(GameScreen.playerCurrent);
|
GameScreen.setFocus(GameScreen.playerCurrent);
|
||||||
// Make a sound when an arrow touched
|
// Make a sound when an arrow touched
|
||||||
|
|
||||||
|
GameScreen.removePlayer(player);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import com.badlogic.gdx.math.MathUtils;
|
||||||
import com.badlogic.gdx.math.Vector2;
|
import com.badlogic.gdx.math.Vector2;
|
||||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||||
import com.badlogic.gdx.audio.Sound;
|
import com.badlogic.gdx.audio.Sound;
|
||||||
import com.badlogic.gdx.files.*;
|
|
||||||
|
|
||||||
import sagittarius.view.GameScreen;
|
import sagittarius.view.GameScreen;
|
||||||
import sagittarius.SagittariusGame;
|
import sagittarius.SagittariusGame;
|
||||||
|
|
|
@ -3,7 +3,6 @@ package sagittarius.view;
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
||||||
import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener;
|
import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener;
|
||||||
import com.badlogic.gdx.utils.Align;
|
|
||||||
import com.kotcrab.vis.ui.VisUI;
|
import com.kotcrab.vis.ui.VisUI;
|
||||||
import com.kotcrab.vis.ui.widget.VisCheckBox;
|
import com.kotcrab.vis.ui.widget.VisCheckBox;
|
||||||
import com.kotcrab.vis.ui.widget.VisTable;
|
import com.kotcrab.vis.ui.widget.VisTable;
|
||||||
|
@ -66,7 +65,6 @@ public class ResumeScreen extends BaseScreen {
|
||||||
SagittariusGame.music.stop();
|
SagittariusGame.music.stop();
|
||||||
SagittariusGame.disableMusic = true;
|
SagittariusGame.disableMusic = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!disableMusic.isChecked() && ! SagittariusGame.music.isPlaying()){
|
else if (!disableMusic.isChecked() && ! SagittariusGame.music.isPlaying()){
|
||||||
SagittariusGame.music.play();
|
SagittariusGame.music.play();
|
||||||
SagittariusGame.disableMusic = false;
|
SagittariusGame.disableMusic = false;
|
||||||
|
|