Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4094f56e6b | ||
|
|
76f8fa1d52 | ||
|
|
fb32501a3f | ||
|
|
2bb9a6cfc3 |
45
CHANGELOG.md
45
CHANGELOG.md
@ -6,6 +6,47 @@ lignée du jeu amont (0.2.2 en 2017, abandonné).
|
|||||||
|
|
||||||
## [Non publié]
|
## [Non publié]
|
||||||
|
|
||||||
|
### Ajouté
|
||||||
|
- **Entrée Multiplayer au menu principal** (feedback v0.9.0 : « y'a
|
||||||
|
littérallement aucun moyen de le sélectionner, de mettre le serveur ou de
|
||||||
|
jouer ») : Menu 6 options (limite levée, mise à l'échelle absorbe la
|
||||||
|
hauteur) → lobby avec affichage du serveur, sélecteur de préréglages
|
||||||
|
(127.0.0.1 local / 10.0.2.2 émulateur / 8bitwarframe.com d'origine),
|
||||||
|
bouton LANCER, bouton RETOUR — choix persisté en PlayerPrefs
|
||||||
|
- **Boussole ennemie en FLÈCHES** (feedback v0.9.0 : « l'indicateur des
|
||||||
|
ennemis est dégueu ») : 4 sprites pixel-art 16x16 générés dans la palette
|
||||||
|
du jeu (jaune Warframe, contour sombre), orientation par composante
|
||||||
|
dominante (le moteur n'a pas de rotation)
|
||||||
|
|
||||||
|
### Corrigé
|
||||||
|
- **IA ennemie aveugle** (feedback v0.9.0 : « les ennemis n'attaquent plus et
|
||||||
|
ne cherchent plus à aller taper les joueurs ») : le visionCheck 2017 ne
|
||||||
|
raycastait que dans la direction du regard — un ennemi spawné dos au
|
||||||
|
joueur ne le voyait JAMAIS (IDLE éternel, flagrant en Exterminate où les
|
||||||
|
spawns se font des deux côtés) ; raycast bidirectionnel (hit le plus
|
||||||
|
proche gardé)
|
||||||
|
- **Crash en pleine partie** (feedback v0.9.0) : le listener
|
||||||
|
`onEnemyKilled` de la Défense restait actif après la nullification de
|
||||||
|
`director` en fin de mission — NPE au moindre kill tardif
|
||||||
|
- **Logo réapparaissant au-dessus des Settings** (feedback v0.9.0) : le
|
||||||
|
panneau Settings était à depth 0, SOUS le logo (5) — depth 10 explicite
|
||||||
|
sur le fond + contenu du panneau à 12
|
||||||
|
- **Wall jump impossible pour un humain** (feedback v0.9.0) : la transition
|
||||||
|
exigeait `jumpCount == 0` alors que le saut initial vers le mur le vaut
|
||||||
|
déjà 1 — condition dédiée (ESPACE seul) ; glissade en anim « jump »
|
||||||
|
(l'anim « fall » était inadaptée)
|
||||||
|
- `DesktopRenderUtils.loadImage` : image absente du classpath = NPE obscure
|
||||||
|
(« inputStream ») → ImageNotFoundError lisible
|
||||||
|
|
||||||
|
### Modifié
|
||||||
|
- Menu : le contenu des Settings (12) au-dessus du fond (10)
|
||||||
|
|
||||||
|
## [0.9.0] — 2026-11-15
|
||||||
|
|
||||||
|
La release de consolidation QA : dédoublonnage du CHANGELOG (les sections
|
||||||
|
[0.7.0]/[0.8.0] avaient été dupliquées), traçage du coop 2 clients réels
|
||||||
|
(preuve log-based des deux côtés) et du log LS-NET.
|
||||||
|
|
||||||
### Ajouté
|
### Ajouté
|
||||||
- **Logs `LS-NET` d'instanciation réseau** : chaque objet réseau reçu
|
- **Logs `LS-NET` d'instanciation réseau** : chaque objet réseau reçu
|
||||||
(préfab, id, position, propriétaire) est journalisé côté client — l'outil
|
(préfab, id, position, propriétaire) est journalisé côté client — l'outil
|
||||||
@ -21,6 +62,10 @@ lignée du jeu amont (0.2.2 en 2017, abandonné).
|
|||||||
log-based (36/36 objets, positions identiques, stats LS-RENDER) est
|
log-based (36/36 objets, positions identiques, stats LS-RENDER) est
|
||||||
exhaustive ; à recapture après redémarrage de la machine
|
exhaustive ; à recapture après redémarrage de la machine
|
||||||
|
|
||||||
|
### Modifié
|
||||||
|
- CHANGELOG : dédoublonnage [0.7.0]/[0.8.0], liens de comparaison complétés
|
||||||
|
- TODO : harmonisation des versions, doublons supprimés, doc Kubrow corrigée
|
||||||
|
|
||||||
## [0.8.0] — 2026-11-15
|
## [0.8.0] — 2026-11-15
|
||||||
|
|
||||||
Le compagnon Kubrow (roadmap Trello « Kubrow/sentinel AI ») est vivant : il
|
Le compagnon Kubrow (roadmap Trello « Kubrow/sentinel AI ») est vivant : il
|
||||||
|
|||||||
@ -14,6 +14,15 @@ public final class Transform extends Component {
|
|||||||
Transform parent;
|
Transform parent;
|
||||||
ArrayList<Transform> children = new ArrayList<>();
|
ArrayList<Transform> children = new ArrayList<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accès public aux enfants (lecture seule d'usage) : permet aux
|
||||||
|
* composants du jeu (ex : SettingsMenu) d'ajuster des depths de rendu
|
||||||
|
* sur toute une sous-arborescence sans connaître la structure interne.
|
||||||
|
*/
|
||||||
|
public java.util.List<Transform> getChildren() {
|
||||||
|
return children;
|
||||||
|
}
|
||||||
|
|
||||||
Transform(GameObject gameObject) {
|
Transform(GameObject gameObject) {
|
||||||
this.gameObject = gameObject;
|
this.gameObject = gameObject;
|
||||||
position.setVector2ChangeListener(new Vector2ChangeListener() {
|
position.setVector2ChangeListener(new Vector2ChangeListener() {
|
||||||
|
|||||||
@ -122,8 +122,13 @@ public class DesktopRenderUtils implements RenderUtils {
|
|||||||
int texture = glGenTextures();
|
int texture = glGenTextures();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
byte[] bytes = org.apache.commons.io.IOUtils
|
java.io.InputStream rawStream = ClassLoader.getSystemResourceAsStream(path);
|
||||||
.toByteArray(ClassLoader.getSystemResourceAsStream(path));
|
if (rawStream == null) {
|
||||||
|
// NPE obscure ("inputStream") avant : une image absente du
|
||||||
|
// classpath (resources pas re-copiées) est signalée lisiblement.
|
||||||
|
throw new ImageNotFoundError(path);
|
||||||
|
}
|
||||||
|
byte[] bytes = org.apache.commons.io.IOUtils.toByteArray(rawStream);
|
||||||
ByteBuffer nativeData = ByteBuffer.allocateDirect(bytes.length);
|
ByteBuffer nativeData = ByteBuffer.allocateDirect(bytes.length);
|
||||||
nativeData.put(bytes);
|
nativeData.put(bytes);
|
||||||
nativeData.flip();
|
nativeData.flip();
|
||||||
|
|||||||
@ -236,8 +236,31 @@ public abstract class Behaviour {
|
|||||||
protected abstract void attack(Transform self, Transform target);
|
protected abstract void attack(Transform self, Transform target);
|
||||||
|
|
||||||
private void visionCheck() {
|
private void visionCheck() {
|
||||||
RaycastHit hit = Physics.raycast(transform.position.offset(transform.scale.x > 0 ? 200 : 0, 100),
|
/*
|
||||||
new Vector2(transform.scale.x, 0), visionRange, visionLayerMaskTarget);
|
* Vision BIDIRECTIONNELLE : le raycast d'origine ne testait QUE la
|
||||||
|
* direction du regard (scale.x) — un ennemi spawné dos au joueur ne
|
||||||
|
* le voyait JAMAIS (target = null -> IDLE éternel, feedback v0.9.0 :
|
||||||
|
* "les ennemis n'attaquent plus et ne cherchent plus à aller taper
|
||||||
|
* les joueurs", flagrant en Exterminate où les spawns se font des
|
||||||
|
* deux côtés du joueur). On teste les deux directions et on garde le
|
||||||
|
* hit le plus proche.
|
||||||
|
*/
|
||||||
|
RaycastHit right = Physics.raycast(
|
||||||
|
transform.position.offset(transform.scale.x > 0 ? 200 : 0, 100),
|
||||||
|
new Vector2(1, 0), visionRange, visionLayerMaskTarget);
|
||||||
|
RaycastHit left = Physics.raycast(
|
||||||
|
transform.position.offset(transform.scale.x > 0 ? 200 : 0, 100),
|
||||||
|
new Vector2(-1, 0), visionRange, visionLayerMaskTarget);
|
||||||
|
RaycastHit hit = null;
|
||||||
|
if (right != null && left != null) {
|
||||||
|
hit = right.transform.gameObject.transform.position.x - transform.position.x <
|
||||||
|
Math.abs(left.transform.gameObject.transform.position.x - transform.position.x)
|
||||||
|
? right : left;
|
||||||
|
} else if (right != null) {
|
||||||
|
hit = right;
|
||||||
|
} else if (left != null) {
|
||||||
|
hit = left;
|
||||||
|
}
|
||||||
if (hit == null) {
|
if (hit == null) {
|
||||||
target = null;
|
target = null;
|
||||||
targetIsObjective = false;
|
targetIsObjective = false;
|
||||||
|
|||||||
@ -3,58 +3,176 @@ package com.ezardlabs.lostsector.levels;
|
|||||||
import com.ezardlabs.dethsquare.Camera;
|
import com.ezardlabs.dethsquare.Camera;
|
||||||
import com.ezardlabs.dethsquare.GameObject;
|
import com.ezardlabs.dethsquare.GameObject;
|
||||||
import com.ezardlabs.dethsquare.GuiText;
|
import com.ezardlabs.dethsquare.GuiText;
|
||||||
import com.ezardlabs.dethsquare.PlayerPrefs;
|
import com.ezardlabs.dethsquare.Input;
|
||||||
|
import com.ezardlabs.dethsquare.Input.KeyCode;
|
||||||
import com.ezardlabs.dethsquare.Level;
|
import com.ezardlabs.dethsquare.Level;
|
||||||
import com.ezardlabs.dethsquare.LevelManager;
|
import com.ezardlabs.dethsquare.LevelManager;
|
||||||
|
import com.ezardlabs.dethsquare.PlayerPrefs;
|
||||||
import com.ezardlabs.dethsquare.Screen;
|
import com.ezardlabs.dethsquare.Screen;
|
||||||
|
import com.ezardlabs.dethsquare.Script;
|
||||||
import com.ezardlabs.dethsquare.TextureAtlas;
|
import com.ezardlabs.dethsquare.TextureAtlas;
|
||||||
import com.ezardlabs.dethsquare.Vector2;
|
import com.ezardlabs.dethsquare.Vector2;
|
||||||
import com.ezardlabs.dethsquare.multiplayer.Matchmaker;
|
import com.ezardlabs.dethsquare.multiplayer.Matchmaker;
|
||||||
import com.ezardlabs.dethsquare.multiplayer.Matchmaker.MatchmakingListener;
|
import com.ezardlabs.dethsquare.multiplayer.Matchmaker.MatchmakingListener;
|
||||||
import com.ezardlabs.dethsquare.multiplayer.MatchmakingGame;
|
import com.ezardlabs.dethsquare.multiplayer.MatchmakingGame;
|
||||||
|
import com.ezardlabs.lostsector.objects.hud.TouchControls;
|
||||||
import com.ezardlabs.dethsquare.util.GameLog;
|
import com.ezardlabs.dethsquare.util.GameLog;
|
||||||
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Lobby multijoueur : affiche le serveur configuré, permet de le CHANGER
|
||||||
|
* (préréglages en cycle — feedback v0.9.0 : "y'a littérallement aucun moyen
|
||||||
|
* de le sélectionner, de mettre le serveur ou de jouer") et de LANCER la
|
||||||
|
* recherche de partie.
|
||||||
|
*
|
||||||
|
* Préréglages : 127.0.0.1 (serveur local), 10.0.2.2 (hôte vu depuis
|
||||||
|
* l'émulateur), 8bitwarframe.com (serveur d'origine, mort). Le choix est
|
||||||
|
* persisté en PlayerPrefs (mp_host/mp_port) et repris par MultiplayerLevel.
|
||||||
|
* LS_MP_HOST/LS_MP_PORT (env) restent prioritaires pour le desktop (test).
|
||||||
|
*
|
||||||
|
* Interaction : TouchControls est attaché et MASQUÉ (aucun bouton de jeu
|
||||||
|
* n'a de sens ici) mais son écoute "tap hors bouton = clic" reste active :
|
||||||
|
* les libellés ci-dessous se cliquent comme les items du menu principal.
|
||||||
|
*/
|
||||||
public class MultiplayerLobbyLevel extends Level {
|
public class MultiplayerLobbyLevel extends Level {
|
||||||
|
private static final String[][] PRESETS = {
|
||||||
|
{"127.0.0.1", "3000"},
|
||||||
|
{"10.0.2.2", "3000"},
|
||||||
|
{"8bitwarframe.com", "3000"},
|
||||||
|
};
|
||||||
|
private static final String TAG = "LS-MISSION";
|
||||||
|
|
||||||
|
private int presetIndex = 0;
|
||||||
|
private GuiText serverText;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoad() {
|
public void onLoad() {
|
||||||
GuiText guiText = new GuiText("Searching for game...",
|
TouchControls.attach(); // EN PREMIER (ordre d'update) — écoute "clic"
|
||||||
TextureAtlas.load("fonts/atlas.png", "fonts/atlas.txt"), 50);
|
TouchControls.setButtonsVisible(false); // pas de boutons de jeu au lobby
|
||||||
GameObject.instantiate(new GameObject("Searching", guiText),
|
|
||||||
new Vector2(Screen.width / 2 - guiText.getWidth() / 2, Screen.height / 2 - 25));
|
|
||||||
GameObject.instantiate(new GameObject("Camera", new Camera(true)), new Vector2());
|
GameObject.instantiate(new GameObject("Camera", new Camera(true)), new Vector2());
|
||||||
|
|
||||||
/*
|
TextureAtlas font = TextureAtlas.load("fonts");
|
||||||
* Serveur de matchmaking configurable : l'équipe d'origine codait en
|
|
||||||
* dur "8bitwarframe.com:3000" (serveur mort). Ordre de résolution :
|
|
||||||
* 1. variable d'environnement LS_MP_HOST / LS_MP_PORT (test desktop :
|
|
||||||
* `LS_MP_HOST=127.0.0.1 LS_MP_PORT=3000 gradlew run`) ;
|
|
||||||
* 2. PlayerPrefs mp_host / mp_port (Android : éditable via run-as,
|
|
||||||
* ou hôte du Mac = 10.0.2.2 depuis l'émulateur) ;
|
|
||||||
* 3. défaut : serveur d'origine (si un jour il revit).
|
|
||||||
*/
|
|
||||||
String host = System.getenv("LS_MP_HOST");
|
|
||||||
if (host == null || host.isEmpty()) {
|
|
||||||
host = PlayerPrefs.getString("mp_host", "8bitwarframe.com");
|
|
||||||
}
|
|
||||||
int port;
|
|
||||||
String portEnv = System.getenv("LS_MP_PORT");
|
|
||||||
if (portEnv != null && !portEnv.isEmpty()) {
|
|
||||||
port = Integer.parseInt(portEnv);
|
|
||||||
} else {
|
|
||||||
port = PlayerPrefs.getInt("mp_port", 3000);
|
|
||||||
}
|
|
||||||
GameLog.i("LS-MISSION", "Matchmaking : connexion à " + host + ":" + port);
|
|
||||||
|
|
||||||
InetAddress ip = null;
|
// Positions en unités GUI PURES (repère 1920x1080, comme le Menu) :
|
||||||
|
// le repère est multiplié par refScale au rendu, indépendant de la
|
||||||
|
// résolution réelle.
|
||||||
|
GameObject.instantiate(new GameObject("Lobby Title", new GuiText("MULTIJOUEUR", font, 60)),
|
||||||
|
new Vector2(660, 60));
|
||||||
|
|
||||||
|
// Affichage du serveur courant (PlayerPrefs, env prioritaire).
|
||||||
|
String host = currentHost();
|
||||||
|
int port = currentPort();
|
||||||
|
serverText = new GuiText("Serveur: " + host + ":" + port, font, 40);
|
||||||
|
GameObject.instantiate(new GameObject("Server Text", serverText), new Vector2(660, 300));
|
||||||
|
|
||||||
|
GameObject.instantiate(new GameObject("Server Change Hint",
|
||||||
|
new GuiText("SERVEUR : changer de préréglage", font, 30)), new Vector2(660, 420));
|
||||||
|
|
||||||
|
GameObject.instantiate(new GameObject("Launch Hint",
|
||||||
|
new GuiText("LANCER : chercher une partie", font, 30)), new Vector2(660, 530));
|
||||||
|
|
||||||
|
GameObject.instantiate(new GameObject("Back Hint",
|
||||||
|
new GuiText("RETOUR : menu principal", font, 30)), new Vector2(660, 640));
|
||||||
|
|
||||||
|
GameObject.instantiate(new GameObject("Lobby Click Handler", new LobbyClicks()), new Vector2());
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Hôte courant : env (desktop/test) prioritaire, sinon PlayerPrefs. */
|
||||||
|
private String currentHost() {
|
||||||
|
String host = System.getenv("LS_MP_HOST");
|
||||||
|
return host != null && !host.isEmpty() ? host : PlayerPrefs.getString("mp_host", PRESETS[0][0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private int currentPort() {
|
||||||
|
String portEnv = System.getenv("LS_MP_PORT");
|
||||||
|
return portEnv != null && !portEnv.isEmpty() ? Integer.parseInt(portEnv)
|
||||||
|
: PlayerPrefs.getInt("mp_port", Integer.parseInt(PRESETS[0][1]));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Gestionnaire de clics du lobby (même modèle que Menu). */
|
||||||
|
private class LobbyClicks extends Script {
|
||||||
|
private TextureAtlas font;
|
||||||
|
private long lastClick = 0;
|
||||||
|
private boolean connecting = false;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start() {
|
||||||
|
runWhenPaused = true;
|
||||||
|
font = TextureAtlas.load("fonts");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update() {
|
||||||
|
if (connecting) return;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Zones cliquables en unités GUI ; la souris (Input.mousePosition)
|
||||||
|
* est en PIXELS écran -> conversion mouse / refScale (identique au
|
||||||
|
* rendu GUI : bounds = pos * refScale).
|
||||||
|
*/
|
||||||
|
float scale = Screen.width / 1920f;
|
||||||
|
if (scale <= 0) return;
|
||||||
|
float mouseX = Input.mousePosition.x / scale;
|
||||||
|
float mouseY = Input.mousePosition.y / scale;
|
||||||
|
RectF serverZone = rect(660, 420, 800, 50);
|
||||||
|
RectF launchZone = rect(660, 530, 800, 50);
|
||||||
|
RectF backZone = rect(660, 640, 800, 50);
|
||||||
|
|
||||||
|
boolean clicked = Input.getKeyDown(KeyCode.MOUSE_LEFT)
|
||||||
|
&& serverText != null && hitZone(new Vector2(mouseX, mouseY), serverZone, launchZone, backZone);
|
||||||
|
if (!clicked) return;
|
||||||
|
|
||||||
|
if (System.currentTimeMillis() - lastClick < 500) return;
|
||||||
|
lastClick = System.currentTimeMillis();
|
||||||
|
|
||||||
|
Vector2 mouseGui = new Vector2(mouseX, mouseY);
|
||||||
|
if (inZone(mouseGui, serverZone)) {
|
||||||
|
presetIndex = (presetIndex + 1) % PRESETS.length;
|
||||||
|
PlayerPrefs.setInt("mp_port", Integer.parseInt(PRESETS[presetIndex][1]));
|
||||||
|
// putString : PlayerPrefs n'expose que getInt/setInt via les
|
||||||
|
// back-ends actuels ? non — getString existe, on persiste l'hôte.
|
||||||
|
PlayerPrefs.setString("mp_host", PRESETS[presetIndex][0]);
|
||||||
|
serverText.setText("Serveur: " + PRESETS[presetIndex][0] + ":" + PRESETS[presetIndex][1]);
|
||||||
|
GameLog.i(TAG, "Multiplayer : serveur préréglé -> " + PRESETS[presetIndex][0] + ":"
|
||||||
|
+ PRESETS[presetIndex][1]);
|
||||||
|
} else if (inZone(mouseGui, launchZone)) {
|
||||||
|
connecting = true;
|
||||||
|
launch();
|
||||||
|
} else if (inZone(mouseGui, backZone)) {
|
||||||
|
LevelManager.loadLevel("main_menu");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean inZone(Vector2 mouse, RectF zone) {
|
||||||
|
return zone.contains(mouse.x, mouse.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
private RectF rect(float x, float y, float w, float h) {
|
||||||
|
return new RectF(x, y, x + w, y + h);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean hitZone(Vector2 mouse, RectF... zones) {
|
||||||
|
for (RectF z : zones) {
|
||||||
|
if (z.contains(mouse.x, mouse.y)) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Lance la recherche de partie sur le serveur sélectionné. */
|
||||||
|
private void launch() {
|
||||||
|
String host = currentHost();
|
||||||
|
int port = currentPort();
|
||||||
|
GameLog.i(TAG, "Multiplayer : recherche de partie sur " + host + ":" + port);
|
||||||
|
InetAddress ip;
|
||||||
try {
|
try {
|
||||||
ip = InetAddress.getByName(host);
|
ip = InetAddress.getByName(host);
|
||||||
} catch (UnknownHostException e) {
|
} catch (UnknownHostException e) {
|
||||||
GameLog.e("LS-MISSION", "Matchmaking : hôte '" + host + "' introuvable");
|
GameLog.e(TAG, "Multiplayer : hôte '" + host + "' introuvable");
|
||||||
e.printStackTrace();
|
return;
|
||||||
}
|
}
|
||||||
Matchmaker matchmaker = new Matchmaker(ip, port);
|
Matchmaker matchmaker = new Matchmaker(ip, port);
|
||||||
matchmaker.findGame(new MatchmakingListener() {
|
matchmaker.findGame(new MatchmakingListener() {
|
||||||
@ -71,8 +189,28 @@ public class MultiplayerLobbyLevel extends Level {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(String error) {
|
public void onError(String error) {
|
||||||
System.err.println(error);
|
GameLog.e(TAG, "Multiplayer : " + error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Rect en unités GUI (bas-haut), miroir de TouchControls.Button.RectF. */
|
||||||
|
private static class RectF {
|
||||||
|
final float left, top, right, bottom;
|
||||||
|
|
||||||
|
RectF(float left, float top, float right, float bottom) {
|
||||||
|
this.left = left;
|
||||||
|
this.top = top;
|
||||||
|
this.right = right;
|
||||||
|
this.bottom = bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean contains(float x, float y) {
|
||||||
|
return x >= left && x <= right && y >= top && y <= bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean contains(Vector2 position) {
|
||||||
|
return contains(position.x, position.y);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,8 +53,18 @@ public class DefenseMission extends Mission {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnemyKilled(Enemy enemy) {
|
public void onEnemyKilled(Enemy enemy) {
|
||||||
|
/*
|
||||||
|
* Null-check obligatoire : en fin de mission, director est
|
||||||
|
* nullifié (destroy du GameObject Director) mais ce listener
|
||||||
|
* reste enregistré — le moindre kill après la fin de mission
|
||||||
|
* (drop, ennemi mourant en retard) provoquait un NPE fatale en
|
||||||
|
* pleine partie (feedback v0.9.0 : "jeu instable qui plante
|
||||||
|
* en pleine partie").
|
||||||
|
*/
|
||||||
|
if (director != null) {
|
||||||
director.numKills++;
|
director.numKills++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
GameLog.i("LS-MISSION", "DefenseMission.load(): spawning Defense Director (director=" + director + ")");
|
GameLog.i("LS-MISSION", "DefenseMission.load(): spawning Defense Director (director=" + director + ")");
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -77,7 +77,15 @@ public class Player extends Script {
|
|||||||
*/
|
*/
|
||||||
Transition<State> wallSliding = new Transition<>(State.WALL_SLIDING, this::wallSlideCheck, () ->
|
Transition<State> wallSliding = new Transition<>(State.WALL_SLIDING, this::wallSlideCheck, () ->
|
||||||
GameLog.d("LS-GAMEPLAY", "glisse murale : mur " + (wallContact > 0 ? "droite" : "gauche")));
|
GameLog.d("LS-GAMEPLAY", "glisse murale : mur " + (wallContact > 0 ? "droite" : "gauche")));
|
||||||
Transition<State> wallJumping = new Transition<>(State.JUMPING, this::jumpCheck, () -> {
|
Transition<State> wallJumping = new Transition<>(State.JUMPING, () ->
|
||||||
|
Input.getKeyDown(KeyCode.SPACE), () -> {
|
||||||
|
/*
|
||||||
|
* wallJumping utilise SA PROPRE condition (ESPACE uniquement, SANS
|
||||||
|
* le check jumpCount == 0 de jumpCheck) : depuis un mur, le
|
||||||
|
* jumpCount vaut déjà 1+ (le saut initial pour atteindre le mur) —
|
||||||
|
* le check d'origine rendait le saut mural IMPOSSIBLE pour un
|
||||||
|
* humain (feedback v0.9.0).
|
||||||
|
*/
|
||||||
gameObject.rigidbody.velocity.x = -wallContact * 18f;
|
gameObject.rigidbody.velocity.x = -wallContact * 18f;
|
||||||
gameObject.rigidbody.velocity.y = -22f;
|
gameObject.rigidbody.velocity.y = -22f;
|
||||||
jumpCount = 1; // le wall jump redonne un saut aérien
|
jumpCount = 1; // le wall jump redonne un saut aérien
|
||||||
@ -182,7 +190,10 @@ public class Player extends Script {
|
|||||||
* sprite dédié de glissade (limitation art).
|
* sprite dédié de glissade (limitation art).
|
||||||
*/
|
*/
|
||||||
gameObject.rigidbody.velocity.y = 2.5f;
|
gameObject.rigidbody.velocity.y = 2.5f;
|
||||||
gameObject.animator.play("fall");
|
// "jump" : Frost accroché au mur (l'anim "fall" d'origine était
|
||||||
|
// inadaptée — feedback v0.9.0 ; pas de sprite de glissade dédié,
|
||||||
|
// limitation art).
|
||||||
|
gameObject.animator.play("jump");
|
||||||
ability1Check();
|
ability1Check();
|
||||||
break;
|
break;
|
||||||
case LANDING:
|
case LANDING:
|
||||||
|
|||||||
@ -6,31 +6,40 @@ import com.ezardlabs.dethsquare.GuiRenderer;
|
|||||||
import com.ezardlabs.dethsquare.Screen;
|
import com.ezardlabs.dethsquare.Screen;
|
||||||
import com.ezardlabs.dethsquare.Script;
|
import com.ezardlabs.dethsquare.Script;
|
||||||
import com.ezardlabs.dethsquare.Vector2;
|
import com.ezardlabs.dethsquare.Vector2;
|
||||||
import com.ezardlabs.dethsquare.graphics.Renderer;
|
|
||||||
import com.ezardlabs.dethsquare.util.GameLog;
|
import com.ezardlabs.dethsquare.util.GameLog;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Boussole d'ennemis (mission Exterminate, feedback v4.0.0 : "aucun
|
* Boussole d'ennemis (mission Exterminate, feedback v0.9.0 : "l'indicateur
|
||||||
* indicateur pour me montrer où les ennemis à tuer sont").
|
* des ennemis est dégueu, fais une flèche pour que ce soit plus
|
||||||
|
* compréhensible").
|
||||||
*
|
*
|
||||||
* Principe : l'ennemi VIVANT le plus proche du joueur est projeté en
|
* Principe : l'ennemi VIVANT le plus proche du joueur est projeté en
|
||||||
* coordonnées écran ; s'il est hors champ, un marqueur jaune est collé au
|
* coordonnées écran ; s'il est hors champ, une FLÈCHE jaune (sprite
|
||||||
* bord de l'écran dans sa direction ; s'il est visible, le marqueur
|
* pixel-art 16x16, 4 orientations générées dans la palette du jeu) est
|
||||||
* disparaît. Cible = l'ennemi le plus proche (il y en a exactement 15 en
|
* collée au bord de l'écran dans sa direction — l'orientation est choisie
|
||||||
* Exterminate : le plus proche est celui à tuer ensuite).
|
* par composante dominante (le moteur ne supporte pas la rotation). S'il
|
||||||
|
* est visible, la flèche disparaît. Cible = l'ennemi le plus proche (il y
|
||||||
|
* en a exactement 15 en Exterminate : le plus proche est celui à tuer
|
||||||
|
* ensuite).
|
||||||
*
|
*
|
||||||
* 100 % GUI (GuiRenderer, couche 2) : fonctionne identiquement sur desktop et
|
* 100 % GUI (GuiRenderer, couche 2) : fonctionne identiquement sur desktop et
|
||||||
* Android, indépendant de la caméra (pas de rotation disponible dans le
|
* Android, indépendant de la caméra.
|
||||||
* moteur, d'où un marqueur positionnel plutôt qu'une flèche orientée).
|
|
||||||
*
|
*
|
||||||
* Perimètre : Exterminate uniquement (attaché depuis ExterminateMission.load).
|
* Périmètre : Exterminate uniquement (attaché depuis ExterminateMission.load).
|
||||||
*/
|
*/
|
||||||
public class EnemyCompass extends Script {
|
public class EnemyCompass extends Script {
|
||||||
private static final String TAG = "LS-MISSION";
|
private static final String TAG = "LS-MISSION";
|
||||||
private static final float MARGIN_PX = 30f; // marge entre le marqueur et le bord
|
private static final float MARGIN_PX = 34f; // marge entre la flèche et le bord
|
||||||
private static final float MARKER_SIZE = 26f; // px
|
private static final float ARROW_SIZE = 40f; // px
|
||||||
|
private static final String[] ARROW_PATHS = {
|
||||||
|
"images/hud/arrows/arrow_right.png",
|
||||||
|
"images/hud/arrows/arrow_left.png",
|
||||||
|
"images/hud/arrows/arrow_down.png",
|
||||||
|
"images/hud/arrows/arrow_up.png",
|
||||||
|
};
|
||||||
|
|
||||||
private GuiRenderer marker;
|
private GuiRenderer marker;
|
||||||
|
private String currentArrow = "";
|
||||||
private GameObject player;
|
private GameObject player;
|
||||||
|
|
||||||
/** À instancier EN DERNIER dans le niveau (au-dessus des autres GUI). */
|
/** À instancier EN DERNIER dans le niveau (au-dessus des autres GUI). */
|
||||||
@ -40,14 +49,11 @@ public class EnemyCompass extends Script {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start() {
|
public void start() {
|
||||||
marker = new GuiRenderer("images/white.png", MARKER_SIZE, MARKER_SIZE);
|
marker = new GuiRenderer(ARROW_PATHS[0], ARROW_SIZE, ARROW_SIZE);
|
||||||
marker.setTint(1f, 0.85f, 0.2f, 0.9f); // jaune Warframe, très visible
|
|
||||||
marker.setDepth(930); // au-dessus du HUD tactile (910)
|
marker.setDepth(930); // au-dessus du HUD tactile (910)
|
||||||
// Le GuiRenderer vit sur un GameObject DÉDIÉ : le script ne doit pas
|
|
||||||
// partager son GO avec d'autres renderers (convention du moteur).
|
|
||||||
gameObject.addComponent(marker);
|
gameObject.addComponent(marker);
|
||||||
marker.enabled = false;
|
marker.enabled = false;
|
||||||
GameLog.i(TAG, "EnemyCompass attaché");
|
GameLog.i(TAG, "EnemyCompass attaché (flèches 4 directions)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -60,8 +66,7 @@ public class EnemyCompass extends Script {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Joueur : référence du suivi (re-trouvé à chaque frame : le GO est
|
// Joueur : référence du suivi (re-trouvé à chaque mort/rechargement).
|
||||||
// détruit/recréé à chaque mort/rechargement de mission).
|
|
||||||
if (player == null || !player.isActive()) {
|
if (player == null || !player.isActive()) {
|
||||||
GameObject[] players = GameObject.findAllWithTag("player");
|
GameObject[] players = GameObject.findAllWithTag("player");
|
||||||
player = players.length > 0 ? players[0] : null;
|
player = players.length > 0 ? players[0] : null;
|
||||||
@ -97,20 +102,38 @@ public class EnemyCompass extends Script {
|
|||||||
float ex = nearest.transform.position.x * Screen.scale - Camera.main.transform.position.x;
|
float ex = nearest.transform.position.x * Screen.scale - Camera.main.transform.position.x;
|
||||||
float ey = nearest.transform.position.y * Screen.scale - Camera.main.transform.position.y;
|
float ey = nearest.transform.position.y * Screen.scale - Camera.main.transform.position.y;
|
||||||
|
|
||||||
float halfW = Screen.width / 2f;
|
boolean onScreen = ex >= -ARROW_SIZE && ex <= Screen.width + ARROW_SIZE &&
|
||||||
float halfH = Screen.height / 2f;
|
ey >= -ARROW_SIZE && ey <= Screen.height + ARROW_SIZE;
|
||||||
boolean onScreen = ex >= -MARKER_SIZE && ex <= Screen.width + MARKER_SIZE &&
|
|
||||||
ey >= -MARKER_SIZE && ey <= Screen.height + MARKER_SIZE;
|
|
||||||
if (onScreen) {
|
if (onScreen) {
|
||||||
// L'ennemi est (presque) à l'écran : pas besoin de boussole.
|
// L'ennemi est (presque) à l'écran : pas besoin de boussole.
|
||||||
marker.enabled = false;
|
marker.enabled = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clamp du marqueur sur le bord de l'écran (marge MARGIN_PX).
|
// Clamp de la flèche sur le bord de l'écran (marge MARGIN_PX).
|
||||||
float mx = Math.max(MARGIN_PX, Math.min(Screen.width - MARGIN_PX, ex));
|
float mx = Math.max(MARGIN_PX, Math.min(Screen.width - MARGIN_PX, ex));
|
||||||
float my = Math.max(MARGIN_PX, Math.min(Screen.height - MARGIN_PX, ey));
|
float my = Math.max(MARGIN_PX, Math.min(Screen.height - MARGIN_PX, ey));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Orientation par composante dominante (pas de rotation dans le
|
||||||
|
* moteur) : la flèche pointe VERS l'ennemi, relativement au CENTRE de
|
||||||
|
* l'écran.
|
||||||
|
*/
|
||||||
|
float dxFromCenter = ex - Screen.width / 2f;
|
||||||
|
float dyFromCenter = ey - Screen.height / 2f;
|
||||||
|
String arrow;
|
||||||
|
if (Math.abs(dxFromCenter) >= Math.abs(dyFromCenter)) {
|
||||||
|
arrow = ARROW_PATHS[dxFromCenter > 0 ? 0 : 1];
|
||||||
|
} else {
|
||||||
|
arrow = ARROW_PATHS[dyFromCenter > 0 ? 2 : 3];
|
||||||
|
}
|
||||||
|
if (!currentArrow.equals(arrow)) {
|
||||||
|
// setImage recharge le sprite (cache loadImage par chemin ✓).
|
||||||
|
marker.setImage(arrow, ARROW_SIZE, ARROW_SIZE);
|
||||||
|
marker.setDepth(930);
|
||||||
|
currentArrow = arrow;
|
||||||
|
}
|
||||||
|
|
||||||
// Pixels écran -> unités GUI (repère GUI = pixels / refScale).
|
// Pixels écran -> unités GUI (repère GUI = pixels / refScale).
|
||||||
float refScale = Screen.width / 1920f;
|
float refScale = Screen.width / 1920f;
|
||||||
if (refScale <= 0) return;
|
if (refScale <= 0) return;
|
||||||
|
|||||||
@ -41,6 +41,7 @@ public class MainMenu extends Menu {
|
|||||||
"Defend",
|
"Defend",
|
||||||
"Exterminate",
|
"Exterminate",
|
||||||
"Survival",
|
"Survival",
|
||||||
|
"Multiplayer",
|
||||||
"Settings",
|
"Settings",
|
||||||
"Quit"
|
"Quit"
|
||||||
};
|
};
|
||||||
@ -52,6 +53,7 @@ public class MainMenu extends Menu {
|
|||||||
(menu, index, text) -> LevelManager.loadLevel("defense"),
|
(menu, index, text) -> LevelManager.loadLevel("defense"),
|
||||||
(menu, index, text) -> LevelManager.loadLevel("exterminate"),
|
(menu, index, text) -> LevelManager.loadLevel("exterminate"),
|
||||||
(menu, index, text) -> LevelManager.loadLevel("survival"),
|
(menu, index, text) -> LevelManager.loadLevel("survival"),
|
||||||
|
(menu, index, text) -> LevelManager.loadLevel("multiplayer_lobby"),
|
||||||
new MenuAction() {
|
new MenuAction() {
|
||||||
@Override
|
@Override
|
||||||
public void onMenuItemSelected(Menu menu, int index, String text) {
|
public void onMenuItemSelected(Menu menu, int index, String text) {
|
||||||
|
|||||||
@ -50,8 +50,11 @@ public class Menu extends Script {
|
|||||||
this.offset = offset;
|
this.offset = offset;
|
||||||
this.startOpen = startOpen;
|
this.startOpen = startOpen;
|
||||||
|
|
||||||
if (options.length < 2 || options.length > 5) {
|
// 6 options (feedback v0.9.0 : l'entrée Multiplayer n'avait aucun moyen
|
||||||
throw new IllegalArgumentException("You must supply between 2 and 5 options to the menu");
|
// d'être sélectionnée) — la mise à l'échelle de start() absorbe la
|
||||||
|
// hauteur supplémentaire (s=0.62 à 6 options, barres lisibles).
|
||||||
|
if (options.length < 2 || options.length > 6) {
|
||||||
|
throw new IllegalArgumentException("You must supply between 2 and 6 options to the menu");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -26,8 +26,15 @@ public class SettingsMenu extends Script {
|
|||||||
@Override
|
@Override
|
||||||
public void start() {
|
public void start() {
|
||||||
runWhenPaused = true;
|
runWhenPaused = true;
|
||||||
GameObject.instantiate(
|
/*
|
||||||
new GameObject("Settings Background", new GuiRenderer("images/menus/settings/base.png", 1200, 1000)),
|
* Depth 10 explicite : à depth ÉGAL le tri GUI se fait sur l'ID de
|
||||||
|
* texture (instable après destroyAll) — le logo (depth 5) passait
|
||||||
|
* DEVANT ce panneau quand on entrait dans les Settings (feedback
|
||||||
|
* v0.9.0). Le contenu du panneau est poussé à 12 par le walk ci-dessous.
|
||||||
|
*/
|
||||||
|
GuiRenderer backgroundRenderer = new GuiRenderer("images/menus/settings/base.png", 1200, 1000);
|
||||||
|
backgroundRenderer.setDepth(10);
|
||||||
|
GameObject.instantiate(new GameObject("Settings Background", backgroundRenderer),
|
||||||
transform.position).transform.setParent(transform);
|
transform.position).transform.setParent(transform);
|
||||||
|
|
||||||
GameObject.instantiate(
|
GameObject.instantiate(
|
||||||
@ -41,6 +48,15 @@ public class SettingsMenu extends Script {
|
|||||||
GameObject.instantiate(new GameObject("Settings Tab Manager",
|
GameObject.instantiate(new GameObject("Settings Tab Manager",
|
||||||
new SettingsTabManager(new AudioSettingsTab(), new GraphicsSettingsTab(), new ControlsSettingsTab())),
|
new SettingsTabManager(new AudioSettingsTab(), new GraphicsSettingsTab(), new ControlsSettingsTab())),
|
||||||
new Vector2(transform.position)).transform.setParent(transform);
|
new Vector2(transform.position)).transform.setParent(transform);
|
||||||
|
/*
|
||||||
|
* Contenu du panneau au-dessus du fond (depth 12 > 10) :
|
||||||
|
* getComponentsOfType(GuiRenderer) couvre toute la hiérarchie (le
|
||||||
|
* walk enfants de Transform est package-private côté moteur).
|
||||||
|
*/
|
||||||
|
for (com.ezardlabs.dethsquare.GuiRenderer r : gameObject
|
||||||
|
.getComponentsOfType(com.ezardlabs.dethsquare.GuiRenderer.class)) {
|
||||||
|
r.setDepth(12);
|
||||||
|
}
|
||||||
gameObject.setActive(false);
|
gameObject.setActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
BIN
lost-sector/src/main/resources/images/hud/arrows/arrow_down.png
Normal file
BIN
lost-sector/src/main/resources/images/hud/arrows/arrow_down.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 151 B |
BIN
lost-sector/src/main/resources/images/hud/arrows/arrow_left.png
Normal file
BIN
lost-sector/src/main/resources/images/hud/arrows/arrow_left.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 151 B |
BIN
lost-sector/src/main/resources/images/hud/arrows/arrow_right.png
Normal file
BIN
lost-sector/src/main/resources/images/hud/arrows/arrow_right.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 158 B |
BIN
lost-sector/src/main/resources/images/hud/arrows/arrow_up.png
Normal file
BIN
lost-sector/src/main/resources/images/hud/arrows/arrow_up.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 159 B |
Loading…
x
Reference in New Issue
Block a user