Compare commits
No commits in common. "v0.5.0" and "v0.4.0" have entirely different histories.
53
CHANGELOG.md
53
CHANGELOG.md
@ -6,59 +6,6 @@ lignée du jeu amont (0.2.2 en 2017, abandonné).
|
|||||||
|
|
||||||
## [Non publié]
|
## [Non publié]
|
||||||
|
|
||||||
### Ajouté
|
|
||||||
- **Spawner d'ennemis Exterminate** (style Warframe : les ennemis apparaissent
|
|
||||||
autour du joueur, 3 max vivants, jusqu'à 15 — "no more, no less", TODO
|
|
||||||
2017 résolu pour de bon)
|
|
||||||
- **BOSS Ambulas** (Moa d'assaut canonique Warframe, réutilise les assets
|
|
||||||
ShockwaveMoa ×2.5, 40 PV) : remplace la vague 5 en Défense (toutes les 5
|
|
||||||
vagues), spawn à mi-mission en Exterminate (10/15 kills)
|
|
||||||
- Logs IA des ennemis sur changement d'état (LS-AI : IDLE → TRACKING…)
|
|
||||||
- Log de spawn d'ennemis (LS-MAP : contenu des objectgroups TMX)
|
|
||||||
- Menu principal : entrée **Survival** (le niveau existait mais était
|
|
||||||
inatteignable depuis le menu)
|
|
||||||
- Exterminate : écran de victoire "Mission accomplished" + retour menu
|
|
||||||
(même boucle que la Défense — `completeMission` seul ne montrait rien)
|
|
||||||
- Boussole d'ennemis (**EnemyCompass**) en Exterminate : marqueur jaune au
|
|
||||||
bord de l'écran vers l'ennemi le plus proche hors champ, caché quand il est
|
|
||||||
visible (feedback v4.0.0 : « aucun indicateur ») — cross-platform
|
|
||||||
- HUD tactile : bouton **FIRE** agrandi (×1.25, geste principal de combat) ;
|
|
||||||
**pouvoirs 1-4 en rangée horizontale en bas au centre** (atteignables en
|
|
||||||
pleine course) ; boîtes de boutons plus contrastées (alpha 0.65)
|
|
||||||
- HUD Survival : compteur de temps "Time: m:ss" (QA)
|
|
||||||
- Anti-régression : logs `LS-GAMEPLAY` sur toutes les actions du joueur
|
|
||||||
|
|
||||||
### Corrigé
|
|
||||||
- **Aucun ennemi ne spawnait en Exterminate/Survival procédural** (feedback
|
|
||||||
v4.0.0 : « je vois aucun ennemi ») : les segments procéduraux nomment leur
|
|
||||||
objectgroup "spawns" mais le moteur ne cherchait que "enemies" — les deux
|
|
||||||
noms sont désormais acceptés
|
|
||||||
- **`NavMesh.getNavPoint` crashait** (ArrayIndexOutOfBounds) pour un ennemi
|
|
||||||
hors de la grille du NavMesh (spawn en bord de carte) — clamp aux bornes
|
|
||||||
- **Menu pause mort en Exterminate et Survival** (feedback v4.0.0) :
|
|
||||||
`instantiateMenus` n'était appelé que par la Défense depuis 2017 — le
|
|
||||||
bouton II injectait ESCAPE dans le vide ; désormais static et câblé partout
|
|
||||||
- **Logo LOST SECTOR passant au-dessus du panneau Settings** après une
|
|
||||||
défaite (feedback v4.0.0) : le tri GUI à depth égal se faisait sur l'ID de
|
|
||||||
texture (dépendant de l'ordre de chargement des textures, instable après
|
|
||||||
`destroyAll`) — depths explicites (logo 5, barres 8, surlignages 9, textes
|
|
||||||
10, settings 10+)
|
|
||||||
- **Menu principal débordant avec 5 options** (QA) : mise à l'échelle
|
|
||||||
uniforme sous le logo + marge basse 40 gui (barre de geste Android)
|
|
||||||
- **Crash sur glyphe absent** : un label contenant un caractère absent de la
|
|
||||||
police bitmap (ex : « / » dans un libellé) tuait le jeu — le caractère est
|
|
||||||
désormais sauté avec log
|
|
||||||
- `CameraMovement` : suivait la cible en monde non-multiplié par
|
|
||||||
`Screen.scale` (ne rendait correctement qu'à l'échelle 1 du desktop 2017) —
|
|
||||||
classe réparée et documentée (sans usage actuel, SmartCamera partout)
|
|
||||||
- HUD tactile masqué quand un menu est ouvert (chevauchait le menu principal
|
|
||||||
et les menus pause ; touches relâchées pour éviter les touches bloquées)
|
|
||||||
|
|
||||||
### Modifié
|
|
||||||
- « Play » → « Survival/Defend » → **« Defend »** dans le menu principal
|
|
||||||
(feedback v4.0.0 : « Survival Defend » créait une confusion avec Survival)
|
|
||||||
- `SpriteNotFoundInAtlasError` rendue package-private (catchable par GuiText)
|
|
||||||
|
|
||||||
## [0.4.0] — 2026-11-15
|
## [0.4.0] — 2026-11-15
|
||||||
|
|
||||||
La mission Exterminate (code mort depuis 2017) devient jouable, le HUD
|
La mission Exterminate (code mort depuis 2017) devient jouable, le HUD
|
||||||
|
|||||||
42
TODO.md
42
TODO.md
@ -1,47 +1,5 @@
|
|||||||
# TODO — Portage Lost Sector & reprise des chantiers d'origine
|
# TODO — Portage Lost Sector & reprise des chantiers d'origine
|
||||||
|
|
||||||
## ⚠️ Retours utilisateur (traçage obligatoire — directive AGENTS.md)
|
|
||||||
|
|
||||||
Retours sur la **v4.0.0 Android** (le joueur teste les releases ; plusieurs
|
|
||||||
retours concernent des états pré-0.5.0) :
|
|
||||||
|
|
||||||
- [x] Pouvoirs 1-4 : les mettre À L'HORIZONTALE en bas au centre (atteignables
|
|
||||||
en course) — FAIT (TouchControls, rangée CENTRE)
|
|
||||||
- [x] Tir à distance impossible en 4.0.0 (pas de bouton) — FAIT (bouton FIRE,
|
|
||||||
agrandi ×1.25 ; tir visuel confirmé émulateur)
|
|
||||||
- [x] Exterminate : « je vois aucun ennemi et aucune flèche ou indicateur » —
|
|
||||||
FAIT (deux bugs racine) : les segments procéduraux nomment leur
|
|
||||||
objectgroup "spawns" (moteur ne cherchait que "enemies" → zéro spawn
|
|
||||||
d'ennemis), et NavMesh.getNavPoint crashait hors grille. EnemyCompass
|
|
||||||
(marqueur au bord) ajouté. Confirmé émulateur : combat Prova/Dera ✓
|
|
||||||
- [x] Pause inopérante en Exterminate — FAIT : EscMenu absent de ce mode
|
|
||||||
(instantiateMenus non appelé depuis 2017), câblé ; Survival aussi
|
|
||||||
- [x] Timer de Survival manquant (QA) — FAIT (HUD "Time: m:ss")
|
|
||||||
⚠️ vérification visuelle restante : bloquée par l'outillage (émulateur
|
|
||||||
AVD zombie + permissions macOS pour les clics desktop) — code identique
|
|
||||||
au compteur "Enemies killed" déjà vérifié
|
|
||||||
- [x] Contraste des boîtes de boutons (QA) — FAIT (alpha 0.45 → 0.65)
|
|
||||||
- [x] Marge basse du menu (QA : Quit rogné par la barre de geste) — FAIT
|
|
||||||
(bottomMargin 40 gui dans le calcul d'échelle)
|
|
||||||
- [x] Renommer « Play » en « Survival/Defend » — FAIT (libellé clair : la
|
|
||||||
mission Défense, pas la Survival)
|
|
||||||
- [x] Wall glide + wall jump (core du gameplay Warframe) — FAIT (états
|
|
||||||
WALL_SLIDING + saut mural propelé opposé, logs LS-GAMEPLAY) ;
|
|
||||||
à confirmer visuellement en jeu
|
|
||||||
- [x] **Logo LOST SECTOR passe au-dessus du panneau Settings** (arrivé après
|
|
||||||
une défaite en Play → retour menu) — FAIT (v0.5.0) : cause confirmée =
|
|
||||||
tri GUI par textureName à depth égal (instable après destroyAll) →
|
|
||||||
depths explicites (logo 5, barres 8, surlignages 9, textes 10,
|
|
||||||
settings 10+) ; vérifié par QA finale
|
|
||||||
- [ ] Divers QA : flash de bouce du Lanka « flèche placeholder » (art 2017,
|
|
||||||
à redessiner si assets), drone sous la hit-zone pause (conflit
|
|
||||||
d'interaction accepté, documenté), HUD Survival sans compteur de
|
|
||||||
« vagues » (optionnel)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
# TODO — Portage Lost Sector & reprise des chantiers d'origine
|
|
||||||
|
|
||||||
Feuille de route consolidée : **①** la roadmap Trello originale de l'équipe
|
Feuille de route consolidée : **①** la roadmap Trello originale de l'équipe
|
||||||
(2017-2018, reconstruite depuis l'export JSON du board), **②** ce que révèlent
|
(2017-2018, reconstruite depuis l'export JSON du board), **②** ce que révèlent
|
||||||
les autres dépôts de l'org GitHub (Server, Matchmaking-Server, Website,
|
les autres dépôts de l'org GitHub (Server, Matchmaking-Server, Website,
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
package com.ezardlabs.dethsquare;
|
package com.ezardlabs.dethsquare;
|
||||||
|
|
||||||
import com.ezardlabs.dethsquare.TextureAtlas.Sprite;
|
import com.ezardlabs.dethsquare.TextureAtlas.Sprite;
|
||||||
import com.ezardlabs.dethsquare.util.GameLog;
|
|
||||||
|
|
||||||
public class GuiText extends Component implements Bounded {
|
public class GuiText extends Component implements Bounded {
|
||||||
private final RectF bounds = new RectF();
|
private final RectF bounds = new RectF();
|
||||||
@ -156,20 +155,7 @@ public class GuiText extends Component implements Bounded {
|
|||||||
s = font.getSprite("colon");
|
s = font.getSprite("colon");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
try {
|
s = font.getSprite(String.valueOf(text.charAt(i)));
|
||||||
s = font.getSprite(String.valueOf(text.charAt(i)));
|
|
||||||
} catch (TextureAtlas.SpriteNotFoundInAtlasError e) {
|
|
||||||
/*
|
|
||||||
* Glyphe absent de l'atlas de police (ex : "/" absent du
|
|
||||||
* sprite-sheet 2017) : crash complet du jeu en 2017. On
|
|
||||||
* saute le caractère (avancement d'une espace) et on
|
|
||||||
* journalise — un label de menu ne doit jamais tuer le rendu.
|
|
||||||
*/
|
|
||||||
GameLog.w("LS-RENDER", "GuiText : glyphe '" + text.charAt(i)
|
|
||||||
+ "' absent de l'atlas '" + font.getMapPath() + "' (sauté)");
|
|
||||||
s = null;
|
|
||||||
xOffset += spaceWidth;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (s == null) continue;
|
if (s == null) continue;
|
||||||
|
|||||||
@ -113,12 +113,7 @@ public final class TextureAtlas {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
private static class SpriteNotFoundInAtlasError extends Error {
|
||||||
* package-private (anciennement private) : getSprite la lève depuis une
|
|
||||||
* API publique, GuiText la catche pour tolérer les glyphes absents de la
|
|
||||||
* police bitmap au lieu de crasher le jeu.
|
|
||||||
*/
|
|
||||||
static class SpriteNotFoundInAtlasError extends Error {
|
|
||||||
|
|
||||||
private SpriteNotFoundInAtlasError(String spriteName, String atlasPath) {
|
private SpriteNotFoundInAtlasError(String spriteName, String atlasPath) {
|
||||||
super("Sprite '" + spriteName + "' was not found in the atlas located at " + atlasPath);
|
super("Sprite '" + spriteName + "' was not found in the atlas located at " + atlasPath);
|
||||||
|
|||||||
@ -30,7 +30,6 @@ import com.ezardlabs.lostsector.objects.Player;
|
|||||||
import com.ezardlabs.lostsector.objects.enemies.corpus.crewmen.DeraCrewman;
|
import com.ezardlabs.lostsector.objects.enemies.corpus.crewmen.DeraCrewman;
|
||||||
import com.ezardlabs.lostsector.objects.enemies.corpus.crewmen.ProvaCrewman;
|
import com.ezardlabs.lostsector.objects.enemies.corpus.crewmen.ProvaCrewman;
|
||||||
import com.ezardlabs.lostsector.objects.enemies.corpus.crewmen.SupraCrewman;
|
import com.ezardlabs.lostsector.objects.enemies.corpus.crewmen.SupraCrewman;
|
||||||
import com.ezardlabs.lostsector.objects.enemies.corpus.moas.Ambulas;
|
|
||||||
import com.ezardlabs.lostsector.objects.enemies.corpus.moas.ShockwaveMoa;
|
import com.ezardlabs.lostsector.objects.enemies.corpus.moas.ShockwaveMoa;
|
||||||
import com.ezardlabs.lostsector.objects.environment.Door;
|
import com.ezardlabs.lostsector.objects.environment.Door;
|
||||||
import com.ezardlabs.lostsector.objects.environment.LaserDoor;
|
import com.ezardlabs.lostsector.objects.environment.LaserDoor;
|
||||||
@ -160,14 +159,6 @@ public class Game extends BaseGame {
|
|||||||
new NetworkAnimator()),
|
new NetworkAnimator()),
|
||||||
() -> new GameObject("Shockwave Moa", new Renderer(), new Animator(), new Collider(200, 200),
|
() -> new GameObject("Shockwave Moa", new Renderer(), new Animator(), new Collider(200, 200),
|
||||||
new Rigidbody(), new NetworkTransform(), new NetworkRenderer(), new NetworkAnimator()));
|
new Rigidbody(), new NetworkTransform(), new NetworkRenderer(), new NetworkAnimator()));
|
||||||
/*
|
|
||||||
* BOSS Ambulas (Moa d'assaut canonique) : collider doublé (échelle
|
|
||||||
* 2.5 appliquée dans Ambulas.start). Pas de composants réseau : le
|
|
||||||
* boss est purement solo (le multi 2017 est hors service).
|
|
||||||
*/
|
|
||||||
PrefabManager.addPrefab("ambulas",
|
|
||||||
() -> new GameObject("Ambulas", new Renderer(), new Animator(), new Collider(500, 500),
|
|
||||||
new Rigidbody(), new Ambulas()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerPickupPrefabs() {
|
private void registerPickupPrefabs() {
|
||||||
|
|||||||
@ -159,14 +159,7 @@ public class NavMesh {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static NavPoint getNavPoint(float x, float y) {
|
public static NavPoint getNavPoint(float x, float y) {
|
||||||
/*
|
return navPoints[Math.round(x / 100f)][Math.round(y / 100f) + 1];
|
||||||
* Clamp aux bornes : un ennemi hors de la grille (spawn en l'air au
|
|
||||||
* bord de la carte, ou poussé hors champ) provoquait un
|
|
||||||
* ArrayIndexOutOfBounds fatal — on renvoie le point le plus proche.
|
|
||||||
*/
|
|
||||||
int i = Math.max(0, Math.min(navPoints.length - 1, Math.round(x / 100f)));
|
|
||||||
int j = Math.max(0, Math.min(navPoints[0].length - 1, Math.round(y / 100f) + 1));
|
|
||||||
return navPoints[i][j];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int count = 0;
|
private static int count = 0;
|
||||||
|
|||||||
@ -8,7 +8,6 @@ import com.ezardlabs.dethsquare.Mathf;
|
|||||||
import com.ezardlabs.dethsquare.Physics;
|
import com.ezardlabs.dethsquare.Physics;
|
||||||
import com.ezardlabs.dethsquare.Physics.RaycastHit;
|
import com.ezardlabs.dethsquare.Physics.RaycastHit;
|
||||||
import com.ezardlabs.dethsquare.StateMachine;
|
import com.ezardlabs.dethsquare.StateMachine;
|
||||||
import com.ezardlabs.dethsquare.util.GameLog;
|
|
||||||
import com.ezardlabs.dethsquare.StateMachine.Transition;
|
import com.ezardlabs.dethsquare.StateMachine.Transition;
|
||||||
import com.ezardlabs.dethsquare.Time;
|
import com.ezardlabs.dethsquare.Time;
|
||||||
import com.ezardlabs.dethsquare.Transform;
|
import com.ezardlabs.dethsquare.Transform;
|
||||||
@ -117,16 +116,7 @@ public abstract class Behaviour {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final void update() {
|
public final void update() {
|
||||||
State previousState = stateMachine.getState();
|
|
||||||
stateMachine.update();
|
stateMachine.update();
|
||||||
// IA : log sur CHANGEMENT d'état uniquement (jamais par frame —
|
|
||||||
// politique de logs throttlés AGENTS.md). Identifie l'ennemi par son
|
|
||||||
// nom de GameObject (ex "Dera Crewman #12").
|
|
||||||
if (stateMachine.getState() != previousState) {
|
|
||||||
GameLog.d("LS-AI", (transform.gameObject.name) + " : " + previousState
|
|
||||||
+ " -> " + stateMachine.getState()
|
|
||||||
+ (target != null ? " (cible " + target.gameObject.name + ")" : ""));
|
|
||||||
}
|
|
||||||
if (Time.frameCount % 60 == 0) {
|
if (Time.frameCount % 60 == 0) {
|
||||||
if (targetIsObjective || path == null || path.length == 0) {
|
if (targetIsObjective || path == null || path.length == 0) {
|
||||||
visionCheck();
|
visionCheck();
|
||||||
|
|||||||
@ -20,17 +20,8 @@ public class MainMenuLevel extends Level {
|
|||||||
GameObject.instantiate(new GameObject("Camera", new Camera(true), new AudioListener(),
|
GameObject.instantiate(new GameObject("Camera", new Camera(true), new AudioListener(),
|
||||||
new AudioSource(new AudioClip("audio/menu.ogg"), true, AudioGroup.MUSIC)), new Vector2());
|
new AudioSource(new AudioClip("audio/menu.ogg"), true, AudioGroup.MUSIC)), new Vector2());
|
||||||
|
|
||||||
/*
|
GameObject.instantiate(new GameObject("Logo", new GuiRenderer("images/menus/main/logo.png", 900, 225)),
|
||||||
* Depth 5 explicite : le tri GUI est layer << 61 | depth << 24 |
|
new Vector2(510, 15));
|
||||||
* textureName — à depth ÉGAL (0), l'ordre dépend de l'ID numérique de
|
|
||||||
* la texture, donc de l'ordre de chargement (instable après un
|
|
||||||
* destroyAll : retour au menu après une défaite rechargeait les
|
|
||||||
* textures dans un autre ordre et le logo passait DEVANT le panneau
|
|
||||||
* Settings, feedback v4.0.0). Depth 5 = derrière tout le menu.
|
|
||||||
*/
|
|
||||||
GuiRenderer logoRenderer = new GuiRenderer("images/menus/main/logo.png", 900, 225);
|
|
||||||
logoRenderer.setDepth(5);
|
|
||||||
GameObject.instantiate(new GameObject("Logo", logoRenderer), new Vector2(510, 15));
|
|
||||||
|
|
||||||
GameObject.instantiate(new GameObject("Main Menu", new MainMenu()), new Vector2());
|
GameObject.instantiate(new GameObject("Main Menu", new MainMenu()), new Vector2());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,6 @@ import com.ezardlabs.dethsquare.TextureAtlas;
|
|||||||
import com.ezardlabs.dethsquare.Vector2;
|
import com.ezardlabs.dethsquare.Vector2;
|
||||||
import com.ezardlabs.dethsquare.multiplayer.Network;
|
import com.ezardlabs.dethsquare.multiplayer.Network;
|
||||||
import com.ezardlabs.lostsector.SurvivalManager;
|
import com.ezardlabs.lostsector.SurvivalManager;
|
||||||
import com.ezardlabs.lostsector.missions.Mission;
|
|
||||||
import com.ezardlabs.lostsector.objects.hud.TouchControls;
|
import com.ezardlabs.lostsector.objects.hud.TouchControls;
|
||||||
import com.ezardlabs.lostsector.camera.SmartCamera;
|
import com.ezardlabs.lostsector.camera.SmartCamera;
|
||||||
import com.ezardlabs.lostsector.map.MapManager;
|
import com.ezardlabs.lostsector.map.MapManager;
|
||||||
@ -27,10 +26,6 @@ public class SurvivalLevel extends Level {
|
|||||||
GameObject.instantiate(new GameObject("Camera", new Camera(true), new SmartCamera(player.transform, 1000,
|
GameObject.instantiate(new GameObject("Camera", new Camera(true), new SmartCamera(player.transform, 1000,
|
||||||
new Vector2(100, 100))), MapManager.playerSpawn);
|
new Vector2(100, 100))), MapManager.playerSpawn);
|
||||||
|
|
||||||
// Menu pause (EscMenu) — absent en 2017 : le bouton pause du HUD
|
|
||||||
// tactile était mort dans ce mode (feedback v4.0.0).
|
|
||||||
Mission.instantiateMenus();
|
|
||||||
|
|
||||||
survivalManager = new SurvivalManager(MapManager.enemySpawns);
|
survivalManager = new SurvivalManager(MapManager.enemySpawns);
|
||||||
GameObject.instantiate(new GameObject("SurvivalManager", survivalManager), new Vector2());
|
GameObject.instantiate(new GameObject("SurvivalManager", survivalManager), new Vector2());
|
||||||
|
|
||||||
@ -61,28 +56,5 @@ public class SurvivalLevel extends Level {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}), new Vector2(10, 10));
|
}), new Vector2(10, 10));
|
||||||
|
|
||||||
/*
|
|
||||||
* Compteur de temps de survie (QA v0.4.0 : "sur une mission de
|
|
||||||
* survie, l'absence de compteur de temps est une lacune de lisibilité
|
|
||||||
* gameplay"). Unités GUI (indépendant de la résolution).
|
|
||||||
*/
|
|
||||||
final long survivalStart = System.currentTimeMillis();
|
|
||||||
GameObject.instantiate(new GameObject("Survival Timer", new GuiText("", fontTA, 40), new
|
|
||||||
Script() {
|
|
||||||
private GuiText guiText;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void start() {
|
|
||||||
guiText = gameObject.getComponent(GuiText.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void update() {
|
|
||||||
int seconds = (int) ((System.currentTimeMillis() - survivalStart) / 1000f);
|
|
||||||
guiText.setText("Time: " + seconds / 60 + ":" +
|
|
||||||
String.format("%02d", seconds % 60));
|
|
||||||
}
|
|
||||||
}), new Vector2(460, 10));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -396,15 +396,9 @@ public class MapManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TextureAtlas ta = TextureAtlas.load("images/environment/atlas.png", "images/environment/atlas.txt");
|
TextureAtlas ta = TextureAtlas.load("images/environment/atlas.png", "images/environment/atlas.txt");
|
||||||
/*
|
|
||||||
* Le groupe des spawns porte DEUX noms selon les cartes : "enemies"
|
|
||||||
* dans les TMX classiques (defense0) mais "spawns" dans les segments
|
|
||||||
* procéduraux — résultat : AUCUN ennemi ne spawnait jamais en
|
|
||||||
* Exterminate/Survival procédural (feedback v4.0.0).
|
|
||||||
*/
|
|
||||||
ObjectGroup enemyObjectGroup = null;
|
ObjectGroup enemyObjectGroup = null;
|
||||||
for(ObjectGroup objectGroup : map.getObjectGroups()) {
|
for(ObjectGroup objectGroup : map.getObjectGroups()) {
|
||||||
if(objectGroup.getName().equals("enemies") || objectGroup.getName().equals("spawns")) {
|
if(objectGroup.getName().equals("enemies")) {
|
||||||
enemyObjectGroup = objectGroup;
|
enemyObjectGroup = objectGroup;
|
||||||
} else if(!objectGroup.getName().equals("connectors")) {
|
} else if(!objectGroup.getName().equals("connectors")) {
|
||||||
instantiateObjects(objectGroup.getObjects(), ta, offset);
|
instantiateObjects(objectGroup.getObjects(), ta, offset);
|
||||||
@ -513,7 +507,6 @@ public class MapManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void instantiateEnemies(TMXObject[] objects, Vector2 offset) {
|
public static void instantiateEnemies(TMXObject[] objects, Vector2 offset) {
|
||||||
GameLog.i("LS-MAP", "instantiateEnemies : " + objects.length + " objet(s) dans l'objectgroup");
|
|
||||||
for(TMXObject object : objects) {
|
for(TMXObject object : objects) {
|
||||||
Vector2 pos = new Vector2((object.getX() + offset.x * TILE_SIZE) * MAP_SCALE, (object.getY() + offset.y * TILE_SIZE) * MAP_SCALE);
|
Vector2 pos = new Vector2((object.getX() + offset.x * TILE_SIZE) * MAP_SCALE, (object.getY() + offset.y * TILE_SIZE) * MAP_SCALE);
|
||||||
switch(object.getType()) {
|
switch(object.getType()) {
|
||||||
|
|||||||
@ -171,25 +171,9 @@ public class DefenseMission extends Mission {
|
|||||||
stateMachine.addState(State.TEXT,
|
stateMachine.addState(State.TEXT,
|
||||||
new Transition<>(State.WAVE, () -> System.currentTimeMillis() - time >= textTime, () -> {
|
new Transition<>(State.WAVE, () -> System.currentTimeMillis() - time >= textTime, () -> {
|
||||||
waveNumText.gameObject.setActive(false);
|
waveNumText.gameObject.setActive(false);
|
||||||
|
numEnemies = getNumberOfEnemies(waveNum);
|
||||||
numKills = 0;
|
numKills = 0;
|
||||||
/*
|
SpawnPoint.spawnWave(numEnemies, spawnProbabilities);
|
||||||
* BOSS Ambulas : toutes les 5 vagues, la vague est
|
|
||||||
* remplacée par le boss seul (feedback utilisateur :
|
|
||||||
* "ajoute des boss — fin de vagues"). numKills == 1
|
|
||||||
* referme la vague (la transition WAVE -> INTERLUDE
|
|
||||||
* compare numKills à numEnemies : on aligne
|
|
||||||
* numEnemies = 1 pour une vague-boss).
|
|
||||||
*/
|
|
||||||
if (waveNum % 5 == 0) {
|
|
||||||
GameLog.i("LS-MISSION", "BOSS : vague " + waveNum + " remplacée par Ambulas");
|
|
||||||
numEnemies = 1;
|
|
||||||
LinkedHashMap<String, Float> bossProbabilities = new LinkedHashMap<>();
|
|
||||||
bossProbabilities.put("ambulas", 1f);
|
|
||||||
SpawnPoint.spawnWave(1, bossProbabilities);
|
|
||||||
} else {
|
|
||||||
numEnemies = getNumberOfEnemies(waveNum);
|
|
||||||
SpawnPoint.spawnWave(numEnemies, spawnProbabilities);
|
|
||||||
}
|
|
||||||
}));
|
}));
|
||||||
stateMachine.addState(State.WAVE, new Transition<>(State.INTERLUDE, () -> numKills == numEnemies,
|
stateMachine.addState(State.WAVE, new Transition<>(State.INTERLUDE, () -> numKills == numEnemies,
|
||||||
() -> time = System.currentTimeMillis()));
|
() -> time = System.currentTimeMillis()));
|
||||||
|
|||||||
@ -7,8 +7,6 @@ import com.ezardlabs.dethsquare.AudioManager.AudioGroup;
|
|||||||
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.LevelManager;
|
|
||||||
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.prefabs.PrefabManager;
|
import com.ezardlabs.dethsquare.prefabs.PrefabManager;
|
||||||
@ -17,8 +15,6 @@ import com.ezardlabs.lostsector.map.MapManager;
|
|||||||
import com.ezardlabs.lostsector.map.procedural.MapConfig;
|
import com.ezardlabs.lostsector.map.procedural.MapConfig;
|
||||||
import com.ezardlabs.lostsector.missions.Mission.EnemyStatusListener;
|
import com.ezardlabs.lostsector.missions.Mission.EnemyStatusListener;
|
||||||
import com.ezardlabs.lostsector.objects.enemies.Enemy;
|
import com.ezardlabs.lostsector.objects.enemies.Enemy;
|
||||||
import com.ezardlabs.lostsector.objects.hud.EnemyCompass;
|
|
||||||
import com.ezardlabs.dethsquare.util.GameLog;
|
|
||||||
import com.ezardlabs.lostsector.objects.hud.TouchControls;
|
import com.ezardlabs.lostsector.objects.hud.TouchControls;
|
||||||
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
@ -35,21 +31,20 @@ public class ExterminateMission extends Mission implements EnemyStatusListener {
|
|||||||
// load(), après le chargement de la carte.
|
// load(), après le chargement de la carte.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Probabilités d'espèce (calquées sur la Défense : 0.3/0.5/0.2).
|
|
||||||
private final LinkedHashMap<String, Float> speciesProbabilities = new LinkedHashMap<>();
|
|
||||||
|
|
||||||
private String pickSpecies() {
|
|
||||||
double rand = Math.random();
|
|
||||||
float total = 0;
|
|
||||||
for (java.util.Map.Entry<String, Float> e : speciesProbabilities.entrySet()) {
|
|
||||||
total += e.getValue();
|
|
||||||
if (rand < total) return e.getKey();
|
|
||||||
}
|
|
||||||
return "dera_crewman";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load() {
|
public void load() {
|
||||||
|
/*
|
||||||
|
* TODO 2017 résolu ("force a certain number of enemies to spawn - no
|
||||||
|
* more, no less") : SpawnPoint en mode SINGLE sur les points de spawn
|
||||||
|
* de la carte procédurale — exactement numEnemiesToKill ennemis, aucun
|
||||||
|
* de plus. Probabilités calquées sur celles de la Défense.
|
||||||
|
*/
|
||||||
|
LinkedHashMap<String, Float> spawnProbabilities = new LinkedHashMap<>();
|
||||||
|
spawnProbabilities.put("dera_crewman", 0.3f);
|
||||||
|
spawnProbabilities.put("prova_crewman", 0.5f);
|
||||||
|
spawnProbabilities.put("supra_crewman", 0.2f);
|
||||||
|
SpawnPoint.setSingleSpawnMode(numEnemiesToKill, 1000, 5000, spawnProbabilities);
|
||||||
|
|
||||||
MapManager.playerSpawn = new Vector2(20.0f, 20.0f);
|
MapManager.playerSpawn = new Vector2(20.0f, 20.0f);
|
||||||
MapConfig mapCfg = new MapConfig(MapConfig.ProceduralType.CORPUS, 16);
|
MapConfig mapCfg = new MapConfig(MapConfig.ProceduralType.CORPUS, 16);
|
||||||
MapManager.loadProceduralMap(mapCfg);
|
MapManager.loadProceduralMap(mapCfg);
|
||||||
@ -82,60 +77,6 @@ public class ExterminateMission extends Mission implements EnemyStatusListener {
|
|||||||
new AudioSource(new AudioClip("audio/theme.ogg"), true, 1, AudioGroup.MUSIC)),
|
new AudioSource(new AudioClip("audio/theme.ogg"), true, 1, AudioGroup.MUSIC)),
|
||||||
new Vector2(MapManager.playerSpawn));
|
new Vector2(MapManager.playerSpawn));
|
||||||
|
|
||||||
// Menu pause (EscMenu) — absent en 2017 : le bouton pause du HUD
|
|
||||||
// tactile était mort dans ce mode (feedback v4.0.0).
|
|
||||||
instantiateMenus();
|
|
||||||
|
|
||||||
// Boussole d'ennemis (feedback v4.0.0 : aucun indicateur de direction).
|
|
||||||
EnemyCompass.attach();
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Spawner Exterminate : les segments procéduraux n'ont AUCUN point de
|
|
||||||
* spawn d'ennemi TMX (seulement des "player_spawn", dont la logique
|
|
||||||
* 2017 ne se servait pas) — le SpawnPoint SINGLE du TODO 2017 ne
|
|
||||||
* pouvait donc jamais spawner. Style Warframe : les ennemis
|
|
||||||
* apparaissent AUTOUR DU JOUEUR (600-1200 px, en l'air), maximum 3
|
|
||||||
* vivants, jusqu'à numEnemiesToKill au total ("no more, no less" —
|
|
||||||
* TODO 2017 résolu).
|
|
||||||
*/
|
|
||||||
final LinkedHashMap<String, Float> spawnProbabilities = new LinkedHashMap<>();
|
|
||||||
speciesProbabilities.put("dera_crewman", 0.3f);
|
|
||||||
speciesProbabilities.put("prova_crewman", 0.5f);
|
|
||||||
speciesProbabilities.put("supra_crewman", 0.2f);
|
|
||||||
GameObject.instantiate(new GameObject("Exterminate Spawner", new Script() {
|
|
||||||
private long nextSpawn = 0;
|
|
||||||
private int spawned = 0;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void update() {
|
|
||||||
if (spawned >= numEnemiesToKill || System.currentTimeMillis() < nextSpawn) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
GameObject[] players = GameObject.findAllWithTag("player");
|
|
||||||
if (players.length == 0) return;
|
|
||||||
Vector2 p = players[0].transform.position;
|
|
||||||
// Compte des ennemis vivants (tag "enemy") près du joueur.
|
|
||||||
int alive = 0;
|
|
||||||
for (GameObject e : GameObject.findAllWithTag("enemy")) {
|
|
||||||
if (e.isActive() && Math.abs(e.transform.position.x - p.x) < 1500) alive++;
|
|
||||||
}
|
|
||||||
if (alive >= 3) return;
|
|
||||||
|
|
||||||
String prefab = pickSpecies();
|
|
||||||
float side = Math.random() < 0.5 ? -1f : 1f;
|
|
||||||
// Clamp x >= 200 : un spawn hors carte (x < 0) place l'ennemi
|
|
||||||
// dans le vide à gauche du monde (récupérable grâce au clamp
|
|
||||||
// du NavMesh, mais inutilement pénalisant).
|
|
||||||
float spawnX = Math.max(200f, p.x + side * (600 + (float) Math.random() * 600));
|
|
||||||
Vector2 pos = new Vector2(spawnX, p.y - 150 - (float) Math.random() * 100);
|
|
||||||
GameObject.instantiate(PrefabManager.loadPrefab(prefab), pos);
|
|
||||||
spawned++;
|
|
||||||
nextSpawn = System.currentTimeMillis() + 2000 + (long) (Math.random() * 4000);
|
|
||||||
GameLog.d("LS-MISSION", "Exterminate spawner : '" + prefab + "' en " + pos
|
|
||||||
+ " (" + spawned + "/" + numEnemiesToKill + ")");
|
|
||||||
}
|
|
||||||
}), new Vector2());
|
|
||||||
|
|
||||||
TextureAtlas fontAtlas = TextureAtlas.load("fonts/atlas.png", "fonts/atlas.txt");
|
TextureAtlas fontAtlas = TextureAtlas.load("fonts/atlas.png", "fonts/atlas.txt");
|
||||||
missionText = new GuiText("Enemies remaining: " + numEnemiesToKill, fontAtlas, 40);
|
missionText = new GuiText("Enemies remaining: " + numEnemiesToKill, fontAtlas, 40);
|
||||||
GameObject.instantiate(
|
GameObject.instantiate(
|
||||||
@ -146,58 +87,16 @@ public class ExterminateMission extends Mission implements EnemyStatusListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnemySpawned(Enemy enemy) {
|
public void onEnemySpawned(Enemy enemy) {
|
||||||
GameLog.d("LS-MISSION", "Exterminate : ennemi spawn (" + enemiesKilled + "/" +
|
|
||||||
numEnemiesToKill + " tués)");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnemyKilled(Enemy enemy) {
|
public void onEnemyKilled(Enemy enemy) {
|
||||||
missionText.setText(
|
missionText.setText(
|
||||||
"Enemies remaining: " + (numEnemiesToKill - enemiesKilled));
|
"Enemies remaining: " + (numEnemiesToKill - enemiesKilled));
|
||||||
/*
|
// Fin de mission quand le quota est atteint (aucun état de fin de jeu
|
||||||
* BOSS Ambulas : à mi-mission (10 kills sur 15), le boss spawn une
|
// dédié en 2017 : completeMission remonte aux listeners de statut).
|
||||||
* fois, directement près du joueur (SANS passer par SpawnPoint : le
|
|
||||||
* mode SINGLE de la mission compte déjà ses 15 spawns via un
|
|
||||||
* compteur statique — spawnWave le court-circuiterait). Le boss
|
|
||||||
* tué compte comme un kill normal (notifyEnemySpawn/Killed).
|
|
||||||
*/
|
|
||||||
if (enemiesKilled == 10) {
|
|
||||||
GameObject[] players = GameObject.findAllWithTag("player");
|
|
||||||
Vector2 bossPos = players.length > 0
|
|
||||||
? players[0].transform.position.offset(800, -150)
|
|
||||||
: new Vector2(500, 400);
|
|
||||||
GameObject.instantiate(PrefabManager.loadPrefab("ambulas"), bossPos);
|
|
||||||
GameLog.i("LS-MISSION", "BOSS : Ambulas spawn à 10/15 kills en " + bossPos);
|
|
||||||
}
|
|
||||||
// Fin de mission : écran de victoire puis retour menu (même boucle que
|
|
||||||
// la Défense — le completeMission seul ne montrait rien à l'écran).
|
|
||||||
if (enemiesKilled >= numEnemiesToKill) {
|
if (enemiesKilled >= numEnemiesToKill) {
|
||||||
completeMission();
|
completeMission();
|
||||||
showEndGameText();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Écran de victoire + retour automatique au menu (miroir de DefenseMission). */
|
|
||||||
private void showEndGameText() {
|
|
||||||
TextureAtlas ta = TextureAtlas.load("fonts/atlas.png", "fonts/atlas.txt");
|
|
||||||
GuiText gameOver = new GuiText("Mission accomplished", ta, 60);
|
|
||||||
GameObject.instantiate(new GameObject("Game Over", gameOver), new Vector2(
|
|
||||||
960 - gameOver.getWidth() / 2, 540 - gameOver.getFontSize() / 2));
|
|
||||||
GameObject.instantiate(new GameObject("Return to Menu", new Script() {
|
|
||||||
private long exitTime;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void start() {
|
|
||||||
exitTime = System.currentTimeMillis() + 10000;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void update() {
|
|
||||||
int timeLeft = (int) ((exitTime - System.currentTimeMillis()) / 1000f);
|
|
||||||
if (timeLeft <= 0) {
|
|
||||||
LevelManager.loadLevel("main_menu");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}), new Vector2());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,13 +42,7 @@ public abstract class Mission {
|
|||||||
new Vector2());
|
new Vector2());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
final void instantiateMenus() {
|
||||||
* STATIC et public : le menu pause (EscMenu) doit exister dans TOUTES les
|
|
||||||
* missions/niveaux. En 2017 il n'était câblé que dans DefenseMission —
|
|
||||||
* Exterminate et Survival n'avaient AUCUN menu pause (le bouton II du HUD
|
|
||||||
* tactile injecte ESCAPE dans le vide, feedback v4.0.0).
|
|
||||||
*/
|
|
||||||
public static void instantiateMenus() {
|
|
||||||
GameObject.instantiate(new GameObject("Menu", new EscMenu()), new Vector2());
|
GameObject.instantiate(new GameObject("Menu", new EscMenu()), new Vector2());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import com.ezardlabs.dethsquare.Script;
|
|||||||
import com.ezardlabs.dethsquare.Vector2;
|
import com.ezardlabs.dethsquare.Vector2;
|
||||||
import com.ezardlabs.dethsquare.prefabs.PrefabManager;
|
import com.ezardlabs.dethsquare.prefabs.PrefabManager;
|
||||||
import com.ezardlabs.lostsector.levels.MissionLevel;
|
import com.ezardlabs.lostsector.levels.MissionLevel;
|
||||||
import com.ezardlabs.dethsquare.util.GameLog;
|
|
||||||
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
@ -69,12 +68,7 @@ public class SpawnPoint extends Script {
|
|||||||
private static void spawnEnemy(Vector2 position) {
|
private static void spawnEnemy(Vector2 position) {
|
||||||
String enemyPrefab = getSpawn();
|
String enemyPrefab = getSpawn();
|
||||||
if (enemyPrefab != null) {
|
if (enemyPrefab != null) {
|
||||||
GameLog.d("LS-MISSION", "SpawnPoint : spawn '" + enemyPrefab + "' à " + position
|
GameObject.instantiate(PrefabManager.loadPrefab(getSpawn()), position);
|
||||||
+ " (mode " + mode + ", " + numEnemies + "/" + maxEnemies + ")");
|
|
||||||
GameObject.instantiate(PrefabManager.loadPrefab(enemyPrefab), position);
|
|
||||||
} else {
|
|
||||||
GameLog.w("LS-MISSION", "SpawnPoint : aucune probabilité ne correspond (spawnProbabilities="
|
|
||||||
+ (spawnProbabilities == null ? "NULL" : spawnProbabilities.size() + " entrées") + ")");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,18 +5,6 @@ import com.ezardlabs.dethsquare.Script;
|
|||||||
import com.ezardlabs.dethsquare.Transform;
|
import com.ezardlabs.dethsquare.Transform;
|
||||||
import com.ezardlabs.dethsquare.Vector2;
|
import com.ezardlabs.dethsquare.Vector2;
|
||||||
|
|
||||||
/*
|
|
||||||
* Suivi de caméra "DIRECT/SMOOTH" vers une cible.
|
|
||||||
*
|
|
||||||
* CONVENTION DE COORDONNÉES (corrigée 2026) : le pipeline de rendu dessine
|
|
||||||
* les renderers à pos * Screen.scale et la vue translate la scène de
|
|
||||||
* -camera.position — la caméra doit donc vivre en coordonnées ÉCHELLES
|
|
||||||
* (comme SmartCamera). Le code d'origine travaillait en monde brut et ne
|
|
||||||
* rendait correctement qu'à l'échelle 1 (fenêtre 1920x1080 du desktop 2017).
|
|
||||||
*
|
|
||||||
* Classe aujourd'hui sans usage dans le jeu (SmartCamera partout), conservée
|
|
||||||
* et réparée pour tout usage futur.
|
|
||||||
*/
|
|
||||||
public class CameraMovement extends Script {
|
public class CameraMovement extends Script {
|
||||||
private FollowType followType = FollowType.DIRECT;
|
private FollowType followType = FollowType.DIRECT;
|
||||||
private Transform target;
|
private Transform target;
|
||||||
@ -52,22 +40,20 @@ public class CameraMovement extends Script {
|
|||||||
|
|
||||||
public void update() {
|
public void update() {
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
// Monde -> écran : tout est multiplié par Screen.scale (la cible
|
float x = target.position.x - offset.x;
|
||||||
// et l'offset sont en unités monde, la caméra en unités écran).
|
float y = target.position.y + offset.y;
|
||||||
float x = (target.position.x - offset.x) * Screen.scale;
|
|
||||||
float y = (target.position.y + offset.y) * Screen.scale;
|
|
||||||
|
|
||||||
float cameraX;
|
float cameraX;
|
||||||
if (x < Screen.width / 2f) {
|
if (x < (Screen.width / 2) / Screen.scale) {
|
||||||
cameraX = 0;
|
cameraX = 0;
|
||||||
} else {
|
} else {
|
||||||
cameraX = x - Screen.width / 2f;
|
cameraX = x - (Screen.width / 2) / Screen.scale;
|
||||||
}
|
}
|
||||||
float cameraY;
|
float cameraY;
|
||||||
if (y < Screen.height / 2f) {
|
if (y < (Screen.height / 2) / Screen.scale) {
|
||||||
cameraY = 0;
|
cameraY = 0;
|
||||||
} else {
|
} else {
|
||||||
cameraY = y - Screen.height / 2f;
|
cameraY = y - (Screen.height / 2) / Screen.scale;
|
||||||
}
|
}
|
||||||
switch (followType) {
|
switch (followType) {
|
||||||
case DIRECT:
|
case DIRECT:
|
||||||
|
|||||||
@ -5,8 +5,7 @@ import com.ezardlabs.dethsquare.Vector2;
|
|||||||
import com.ezardlabs.lostsector.Game.DamageType;
|
import com.ezardlabs.lostsector.Game.DamageType;
|
||||||
|
|
||||||
public abstract class Entity extends Script {
|
public abstract class Entity extends Script {
|
||||||
// NB : non-final pour setHealth (boss reconfigurés après construction).
|
protected final float maxHealth;
|
||||||
protected float maxHealth;
|
|
||||||
protected float health;
|
protected float health;
|
||||||
private DamageListener damageListener;
|
private DamageListener damageListener;
|
||||||
|
|
||||||
@ -19,16 +18,6 @@ public abstract class Entity extends Script {
|
|||||||
return health;
|
return health;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Redéfinit la santé ET le maximum (santé pleine). Réservé aux boss
|
|
||||||
* reconfigurés après construction (Ambulas hérite du pool de PV d'un Moa
|
|
||||||
* standard via la chaîne de constructeurs 2017 figée en private/final).
|
|
||||||
*/
|
|
||||||
public void setHealth(float maxHealth) {
|
|
||||||
this.maxHealth = maxHealth;
|
|
||||||
this.health = maxHealth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getMaxHealth() {
|
public float getMaxHealth() {
|
||||||
return maxHealth;
|
return maxHealth;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,7 +14,6 @@ import com.ezardlabs.dethsquare.Time;
|
|||||||
import com.ezardlabs.dethsquare.Vector2;
|
import com.ezardlabs.dethsquare.Vector2;
|
||||||
import com.ezardlabs.dethsquare.animation.Animator;
|
import com.ezardlabs.dethsquare.animation.Animator;
|
||||||
import com.ezardlabs.dethsquare.graphics.Renderer;
|
import com.ezardlabs.dethsquare.graphics.Renderer;
|
||||||
import com.ezardlabs.dethsquare.util.GameLog;
|
|
||||||
import com.ezardlabs.lostsector.camera.SmartCamera;
|
import com.ezardlabs.lostsector.camera.SmartCamera;
|
||||||
import com.ezardlabs.lostsector.objects.CameraMovement;
|
import com.ezardlabs.lostsector.objects.CameraMovement;
|
||||||
import com.ezardlabs.lostsector.effects.Dust;
|
import com.ezardlabs.lostsector.effects.Dust;
|
||||||
@ -36,7 +35,6 @@ public class Player extends Script {
|
|||||||
JUMPING,
|
JUMPING,
|
||||||
DOUBLE_JUMPING,
|
DOUBLE_JUMPING,
|
||||||
FALLING,
|
FALLING,
|
||||||
WALL_SLIDING,
|
|
||||||
LANDING,
|
LANDING,
|
||||||
MELEE,
|
MELEE,
|
||||||
MELEE_WAITING,
|
MELEE_WAITING,
|
||||||
@ -45,48 +43,17 @@ public class Player extends Script {
|
|||||||
CASTING
|
CASTING
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Contact mural (glisse/wall jump, cœur du gameplay Warframe) :
|
|
||||||
* -1 = mur à gauche, +1 = mur à droite, 0 = aucun. Le contact est défini
|
|
||||||
* par onCollision (gauche/droite) et expire après quelques frames sans
|
|
||||||
* contact (les collisions ne remontent que lorsqu'il y a chevauchement).
|
|
||||||
*/
|
|
||||||
private int wallContact = 0;
|
|
||||||
private long wallContactFrame = 0;
|
|
||||||
private static final long WALL_CONTACT_LINGER_FRAMES = 6;
|
|
||||||
|
|
||||||
public Player() {
|
public Player() {
|
||||||
Transition<State> idle = new Transition<>(State.IDLE, this::idleCheck);
|
Transition<State> idle = new Transition<>(State.IDLE, this::idleCheck);
|
||||||
Transition<State> running = new Transition<>(State.RUNNING, this::runCheck);
|
Transition<State> running = new Transition<>(State.RUNNING, this::runCheck);
|
||||||
Transition<State> jumping = new Transition<>(State.JUMPING, this::jumpCheck, this::jump);
|
Transition<State> jumping = new Transition<>(State.JUMPING, this::jumpCheck, this::jump);
|
||||||
Transition<State> doubleJumping = new Transition<>(State.DOUBLE_JUMPING, this::doubleJumpCheck, this::jump);
|
Transition<State> doubleJumping = new Transition<>(State.DOUBLE_JUMPING, this::doubleJumpCheck, this::jump);
|
||||||
Transition<State> falling = new Transition<>(State.FALLING, this::fallCheck);
|
Transition<State> falling = new Transition<>(State.FALLING, this::fallCheck);
|
||||||
Transition<State> melee = new Transition<>(State.MELEE, this::meleeCheck, () ->
|
Transition<State> melee = new Transition<>(State.MELEE, this::meleeCheck);
|
||||||
GameLog.d("LS-GAMEPLAY", "mélée : coup lancé"));
|
|
||||||
Transition<State> meleeWaiting = new Transition<>(State.MELEE_WAITING,
|
Transition<State> meleeWaiting = new Transition<>(State.MELEE_WAITING,
|
||||||
() -> warframe.getMeleeWeapon().isWaiting());
|
() -> warframe.getMeleeWeapon().isWaiting());
|
||||||
Transition<State> meleeStow = new Transition<>(State.MELEE_STOW, () -> warframe.getMeleeWeapon().shouldStow());
|
Transition<State> meleeStow = new Transition<>(State.MELEE_STOW, () -> warframe.getMeleeWeapon().shouldStow());
|
||||||
Transition<State> shooting = new Transition<>(State.SHOOTING, this::shootCheck, () ->
|
Transition<State> shooting = new Transition<>(State.SHOOTING, this::shootCheck);
|
||||||
GameLog.d("LS-GAMEPLAY", "tir primaire : cadence engagée"));
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Glisse murale + saut mural : contact récent avec un mur en l'air ->
|
|
||||||
* on "colle" (glissade lente) ; ESPACE depuis la glissade -> saut
|
|
||||||
* propelé À L'OPPOSÉ du mur (velocity.x inversé) et la glissade
|
|
||||||
* redonne un saut aérien (jumpCount = 1), comme dans Warframe.
|
|
||||||
*/
|
|
||||||
Transition<State> wallSliding = new Transition<>(State.WALL_SLIDING, this::wallSlideCheck, () ->
|
|
||||||
GameLog.d("LS-GAMEPLAY", "glisse murale : mur " + (wallContact > 0 ? "droite" : "gauche")));
|
|
||||||
Transition<State> wallJumping = new Transition<>(State.JUMPING, this::jumpCheck, () -> {
|
|
||||||
gameObject.rigidbody.velocity.x = -wallContact * 18f;
|
|
||||||
gameObject.rigidbody.velocity.y = -22f;
|
|
||||||
jumpCount = 1; // le wall jump redonne un saut aérien
|
|
||||||
transform.scale.x = -wallContact; // faire face à l'opposé du mur
|
|
||||||
GameLog.d("LS-GAMEPLAY", "saut mural : vel=(" + gameObject.rigidbody.velocity.x + "," +
|
|
||||||
gameObject.rigidbody.velocity.y + ")");
|
|
||||||
wallContact = 0;
|
|
||||||
});
|
|
||||||
Transition<State> wallFalling = new Transition<>(State.FALLING, () -> !wallContactRecent());
|
|
||||||
|
|
||||||
Transition<State> meleeJumping = new Transition<>(State.JUMPING, this::jumpCheck, () -> {
|
Transition<State> meleeJumping = new Transition<>(State.JUMPING, this::jumpCheck, () -> {
|
||||||
jump();
|
jump();
|
||||||
@ -98,14 +65,11 @@ public class Player extends Script {
|
|||||||
gameObject.rigidbody.velocity.x = 0;
|
gameObject.rigidbody.velocity.x = 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
// NB : wallSliding est placé EN PREMIER dans les états aériens — si
|
|
||||||
// ESPACE et mur arrivent la même frame, le wall jump doit l'emporter.
|
|
||||||
stateMachine.addState(State.IDLE, jumping, falling, melee, shooting, running);
|
stateMachine.addState(State.IDLE, jumping, falling, melee, shooting, running);
|
||||||
stateMachine.addState(State.RUNNING, jumping, falling, melee, shooting, idle);
|
stateMachine.addState(State.RUNNING, jumping, falling, melee, shooting, idle);
|
||||||
stateMachine.addState(State.JUMPING, wallSliding, doubleJumping, falling);
|
stateMachine.addState(State.JUMPING, doubleJumping, falling);
|
||||||
stateMachine.addState(State.DOUBLE_JUMPING, wallSliding, falling);
|
stateMachine.addState(State.DOUBLE_JUMPING, falling);
|
||||||
stateMachine.addState(State.FALLING, wallSliding, jumping, doubleJumping);
|
stateMachine.addState(State.FALLING, jumping, doubleJumping);
|
||||||
stateMachine.addState(State.WALL_SLIDING, wallJumping, wallFalling);
|
|
||||||
stateMachine.addState(State.LANDING, new Transition<>(State.IDLE, () -> gameObject.animator.isFinished()));
|
stateMachine.addState(State.LANDING, new Transition<>(State.IDLE, () -> gameObject.animator.isFinished()));
|
||||||
stateMachine.addState(State.MELEE, meleeFalling, meleeJumping, meleeWaiting);
|
stateMachine.addState(State.MELEE, meleeFalling, meleeJumping, meleeWaiting);
|
||||||
stateMachine.addState(State.MELEE_WAITING, meleeFalling, meleeJumping, melee, meleeStow);
|
stateMachine.addState(State.MELEE_WAITING, meleeFalling, meleeJumping, melee, meleeStow);
|
||||||
@ -173,18 +137,6 @@ public class Player extends Script {
|
|||||||
transform.translate(x * speed * Time.fpsScaling60, 0);
|
transform.translate(x * speed * Time.fpsScaling60, 0);
|
||||||
ability1Check();
|
ability1Check();
|
||||||
break;
|
break;
|
||||||
case WALL_SLIDING:
|
|
||||||
/*
|
|
||||||
* Glissade murale : la chute est freinée (velocity.y fixée
|
|
||||||
* basse chaque frame, la gravité du Rigidbody est
|
|
||||||
* contre-entrée manuellement — il n'y a pas de "drag" dans le
|
|
||||||
* moteur). Animation "fall" réutilisée : Frost n'a pas de
|
|
||||||
* sprite dédié de glissade (limitation art).
|
|
||||||
*/
|
|
||||||
gameObject.rigidbody.velocity.y = 2.5f;
|
|
||||||
gameObject.animator.play("fall");
|
|
||||||
ability1Check();
|
|
||||||
break;
|
|
||||||
case LANDING:
|
case LANDING:
|
||||||
gameObject.animator.play("land");
|
gameObject.animator.play("land");
|
||||||
break;
|
break;
|
||||||
@ -228,19 +180,6 @@ public class Player extends Script {
|
|||||||
gameObject.rigidbody.velocity.y = -25f;
|
gameObject.rigidbody.velocity.y = -25f;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean wallSlideCheck() {
|
|
||||||
// Contact mural récent + chute (pas en pleine ascension rapide) : on
|
|
||||||
// accroche le mur. Warframe permet aussi le latch en ascension, mais
|
|
||||||
// gérer la montée complique la transition (velocity.y élevée) — le
|
|
||||||
// latch à la descente couvre l'essentiel du gameplay.
|
|
||||||
return wallContactRecent() && gameObject.rigidbody.velocity.y > -10f;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean wallContactRecent() {
|
|
||||||
return wallContact != 0 &&
|
|
||||||
Time.frameCount - wallContactFrame <= WALL_CONTACT_LINGER_FRAMES;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean idleCheck() {
|
private boolean idleCheck() {
|
||||||
return !runCheck();
|
return !runCheck();
|
||||||
}
|
}
|
||||||
@ -272,7 +211,6 @@ public class Player extends Script {
|
|||||||
private void ability1Check() {
|
private void ability1Check() {
|
||||||
if (Input.getKeyDown(KeyCode.ALPHA_1) && warframe.hasEnergy(5)) {
|
if (Input.getKeyDown(KeyCode.ALPHA_1) && warframe.hasEnergy(5)) {
|
||||||
warframe.removeEnergy(5);
|
warframe.removeEnergy(5);
|
||||||
GameLog.d("LS-GAMEPLAY", "pouvoir 1 (coût 5)");
|
|
||||||
warframe.ability1();
|
warframe.ability1();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -280,7 +218,6 @@ public class Player extends Script {
|
|||||||
private void ability2Check() {
|
private void ability2Check() {
|
||||||
if (Input.getKeyDown(KeyCode.ALPHA_2) && warframe.hasEnergy(10)) {
|
if (Input.getKeyDown(KeyCode.ALPHA_2) && warframe.hasEnergy(10)) {
|
||||||
warframe.removeEnergy(10);
|
warframe.removeEnergy(10);
|
||||||
GameLog.d("LS-GAMEPLAY", "pouvoir 2 (coût 10)");
|
|
||||||
warframe.ability2();
|
warframe.ability2();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -288,7 +225,6 @@ public class Player extends Script {
|
|||||||
private void ability3Check() {
|
private void ability3Check() {
|
||||||
if (Input.getKeyDown(KeyCode.ALPHA_3) && warframe.hasEnergy(25)) {
|
if (Input.getKeyDown(KeyCode.ALPHA_3) && warframe.hasEnergy(25)) {
|
||||||
warframe.removeEnergy(25);
|
warframe.removeEnergy(25);
|
||||||
GameLog.d("LS-GAMEPLAY", "pouvoir 3 (coût 25)");
|
|
||||||
warframe.ability3();
|
warframe.ability3();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -318,55 +254,33 @@ public class Player extends Script {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCollision(Collision collision) {
|
public void onCollision(Collision collision) {
|
||||||
switch (collision.location) {
|
if (collision.location == CollisionLocation.BOTTOM &&
|
||||||
case BOTTOM:
|
(stateMachine.getState() == State.FALLING || stateMachine.getState() == State.JUMPING ||
|
||||||
// Au sol : plus de contact mural, sauts aériens réinitialisés.
|
stateMachine.getState() == State.DOUBLE_JUMPING)) {
|
||||||
wallContact = 0;
|
jumpCount = 0;
|
||||||
if ((stateMachine.getState() == State.FALLING ||
|
if (collision.speed > 37) {
|
||||||
stateMachine.getState() == State.JUMPING ||
|
stateMachine.setState(State.LANDING);
|
||||||
stateMachine.getState() == State.DOUBLE_JUMPING ||
|
/*
|
||||||
stateMachine.getState() == State.WALL_SLIDING)) {
|
* Quake d'atterrissage : le composant caméra dépend du niveau
|
||||||
jumpCount = 0;
|
* (SmartCamera pour la Défense, CameraMovement pour
|
||||||
if (collision.speed > 37) {
|
* l'Exterminate) — le code d'origine supposait SmartCamera et
|
||||||
stateMachine.setState(State.LANDING);
|
* NPE dès la première collision sur les autres missions.
|
||||||
/*
|
*/
|
||||||
* Quake d'atterrissage : le composant caméra dépend du
|
SmartCamera smartCamera = Camera.main.gameObject.getComponent(SmartCamera.class);
|
||||||
* niveau (SmartCamera pour la Défense, CameraMovement
|
if (smartCamera != null) {
|
||||||
* pour l'Exterminate) — le code d'origine supposait
|
smartCamera.startQuake(100, 0.3f);
|
||||||
* SmartCamera et NPE dès la première collision sur les
|
} else {
|
||||||
* autres missions.
|
CameraMovement cameraMovement = Camera.main.gameObject.getComponent(CameraMovement.class);
|
||||||
*/
|
if (cameraMovement != null) {
|
||||||
SmartCamera smartCamera = Camera.main.gameObject.getComponent(SmartCamera.class);
|
cameraMovement.startQuake(100, 0.3f);
|
||||||
if (smartCamera != null) {
|
|
||||||
smartCamera.startQuake(100, 0.3f);
|
|
||||||
} else {
|
|
||||||
CameraMovement cameraMovement = Camera.main.gameObject
|
|
||||||
.getComponent(CameraMovement.class);
|
|
||||||
if (cameraMovement != null) {
|
|
||||||
cameraMovement.startQuake(100, 0.3f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
GameObject.destroy(
|
|
||||||
GameObject.instantiate(new GameObject("Dust", new Renderer(), new Animator(), new Dust()),
|
|
||||||
new Vector2(transform.position.x - 262, transform.position.y + 150)), 300);
|
|
||||||
} else {
|
|
||||||
stateMachine.setState(State.IDLE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
GameObject.destroy(
|
||||||
case LEFT:
|
GameObject.instantiate(new GameObject("Dust", new Renderer(), new Animator(), new Dust()),
|
||||||
case RIGHT:
|
new Vector2(transform.position.x - 262, transform.position.y + 150)), 300);
|
||||||
/*
|
} else {
|
||||||
* Contact mural (core du gameplay Warframe : glissade + saut
|
stateMachine.setState(State.IDLE);
|
||||||
* mural). La direction du mur = le côté de collision, et
|
}
|
||||||
* l'horodatage permet à wallContactRecent() de conserver le
|
|
||||||
* contact quelques frames après la fin du chevauchement.
|
|
||||||
*/
|
|
||||||
wallContact = collision.location == CollisionLocation.LEFT ? -1 : 1;
|
|
||||||
wallContactFrame = Time.frameCount;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,32 +0,0 @@
|
|||||||
package com.ezardlabs.lostsector.objects.enemies.corpus.moas;
|
|
||||||
|
|
||||||
import com.ezardlabs.dethsquare.util.GameLog;
|
|
||||||
import com.ezardlabs.lostsector.ai.MeleeBehaviour;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* BOSS : Ambulas — Moa d'assaut canonique Warframe (feedback utilisateur :
|
|
||||||
* "ajoute des boss là où tu juges opportun — fin de vagues, Exterminate").
|
|
||||||
*
|
|
||||||
* Réutilisation INTÉGRALE des assets du ShockwaveMoa (même sprite-sheet,
|
|
||||||
* mêmes ondes de choc) : AUCUNE nouvelle texture (directive AGENTS.md sur
|
|
||||||
* les textures — on compose avec les assets originels). Le boss est un Moa
|
|
||||||
* mis à l'échelle ×2.5, 40 PV (20× un Moa standard), vision étendue, et le
|
|
||||||
* double de dégâts d'onde de choc (via le comportement de ShockwaveMoa).
|
|
||||||
*
|
|
||||||
* Apparu : fin de la vague 5 en Défense (remplace la vague), et au bout de
|
|
||||||
* 10 kills en Exterminate.
|
|
||||||
*/
|
|
||||||
public class Ambulas extends ShockwaveMoa {
|
|
||||||
|
|
||||||
public Ambulas() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void start() {
|
|
||||||
super.start();
|
|
||||||
setHealth(40); // Moa standard : 2 PV — le boss en a 20×
|
|
||||||
transform.scale.set(2.5f, 2.5f);
|
|
||||||
GameLog.i("LS-MISSION", "BOSS Ambulas spawn (40 PV, échelle 2.5)");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,120 +0,0 @@
|
|||||||
package com.ezardlabs.lostsector.objects.hud;
|
|
||||||
|
|
||||||
import com.ezardlabs.dethsquare.Camera;
|
|
||||||
import com.ezardlabs.dethsquare.GameObject;
|
|
||||||
import com.ezardlabs.dethsquare.GuiRenderer;
|
|
||||||
import com.ezardlabs.dethsquare.Screen;
|
|
||||||
import com.ezardlabs.dethsquare.Script;
|
|
||||||
import com.ezardlabs.dethsquare.Vector2;
|
|
||||||
import com.ezardlabs.dethsquare.graphics.Renderer;
|
|
||||||
import com.ezardlabs.dethsquare.util.GameLog;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Boussole d'ennemis (mission Exterminate, feedback v4.0.0 : "aucun
|
|
||||||
* indicateur pour me montrer où les ennemis à tuer sont").
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* bord de l'écran dans sa direction ; s'il est visible, le marqueur
|
|
||||||
* 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
|
|
||||||
* Android, indépendant de la caméra (pas de rotation disponible dans le
|
|
||||||
* moteur, d'où un marqueur positionnel plutôt qu'une flèche orientée).
|
|
||||||
*
|
|
||||||
* Perimètre : Exterminate uniquement (attaché depuis ExterminateMission.load).
|
|
||||||
*/
|
|
||||||
public class EnemyCompass extends Script {
|
|
||||||
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 MARKER_SIZE = 26f; // px
|
|
||||||
|
|
||||||
private GuiRenderer marker;
|
|
||||||
private GameObject player;
|
|
||||||
|
|
||||||
/** À instancier EN DERNIER dans le niveau (au-dessus des autres GUI). */
|
|
||||||
public static void attach() {
|
|
||||||
GameObject.instantiate(new GameObject("Enemy Compass", new EnemyCompass()), new Vector2());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void start() {
|
|
||||||
marker = new GuiRenderer("images/white.png", MARKER_SIZE, MARKER_SIZE);
|
|
||||||
marker.setTint(1f, 0.85f, 0.2f, 0.9f); // jaune Warframe, très visible
|
|
||||||
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);
|
|
||||||
marker.enabled = false;
|
|
||||||
GameLog.i(TAG, "EnemyCompass attaché");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void update() {
|
|
||||||
if (marker == null) return;
|
|
||||||
|
|
||||||
GameObject[] enemies = GameObject.findAllWithTag("enemy");
|
|
||||||
if (enemies.length == 0 || Camera.main == null) {
|
|
||||||
marker.enabled = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Joueur : référence du suivi (re-trouvé à chaque frame : le GO est
|
|
||||||
// détruit/recréé à chaque mort/rechargement de mission).
|
|
||||||
if (player == null || !player.isActive()) {
|
|
||||||
GameObject[] players = GameObject.findAllWithTag("player");
|
|
||||||
player = players.length > 0 ? players[0] : null;
|
|
||||||
if (player == null) {
|
|
||||||
marker.enabled = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ennemi vivant le plus proche du joueur (distance au carré).
|
|
||||||
GameObject nearest = null;
|
|
||||||
float bestDistSq = Float.MAX_VALUE;
|
|
||||||
for (GameObject e : enemies) {
|
|
||||||
if (!e.isActive()) continue;
|
|
||||||
float dx = e.transform.position.x - player.transform.position.x;
|
|
||||||
float dy = e.transform.position.y - player.transform.position.y;
|
|
||||||
float distSq = dx * dx + dy * dy;
|
|
||||||
if (distSq < bestDistSq) {
|
|
||||||
bestDistSq = distSq;
|
|
||||||
nearest = e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (nearest == null) {
|
|
||||||
marker.enabled = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Projection écran : le rendu place un renderer à pos * Screen.scale
|
|
||||||
* puis la vue translate de -camera.position — la position écran d'un
|
|
||||||
* point du monde est donc pos * scale - camera.position.
|
|
||||||
*/
|
|
||||||
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 halfW = Screen.width / 2f;
|
|
||||||
float halfH = Screen.height / 2f;
|
|
||||||
boolean onScreen = ex >= -MARKER_SIZE && ex <= Screen.width + MARKER_SIZE &&
|
|
||||||
ey >= -MARKER_SIZE && ey <= Screen.height + MARKER_SIZE;
|
|
||||||
if (onScreen) {
|
|
||||||
// L'ennemi est (presque) à l'écran : pas besoin de boussole.
|
|
||||||
marker.enabled = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clamp du marqueur sur le bord de l'écran (marge MARGIN_PX).
|
|
||||||
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));
|
|
||||||
|
|
||||||
// Pixels écran -> unités GUI (repère GUI = pixels / refScale).
|
|
||||||
float refScale = Screen.width / 1920f;
|
|
||||||
if (refScale <= 0) return;
|
|
||||||
gameObject.transform.position.set(mx / refScale, my / refScale);
|
|
||||||
marker.enabled = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -35,12 +35,10 @@ import com.ezardlabs.dethsquare.Vector2;
|
|||||||
* position souris et l'appui MOUSE_LEFT sont à jour quand les menus lisent
|
* position souris et l'appui MOUSE_LEFT sont à jour quand les menus lisent
|
||||||
* Input.mousePosition / getKeyDown(MOUSE_LEFT).
|
* Input.mousePosition / getKeyDown(MOUSE_LEFT).
|
||||||
*
|
*
|
||||||
* Boutons : A / D (déplacement), 1-4 (pouvoirs de Frost, RANGÉE HORIZONTALE
|
* Boutons : A / D (déplacement), JUMP (saut + double saut), 1-4 (pouvoirs de
|
||||||
* en bas au centre — atteignables en course, injectent ALPHA_1..4, mêmes
|
* Frost — injectent ALPHA_1..ALPHA_4, mêmes coûts d'énergie que sur desktop),
|
||||||
* coûts d'énergie que sur desktop), JUMP (saut + double saut), FIRE (tir
|
* II (pause = ÉCHAP, ouvre le menu en jeu). Le bouton d'ATTAQUE n'existe pas :
|
||||||
* primaire maintenu = MOUSE_RIGHT, tire dans la direction du regard),
|
* toucher n'importe où hors bouton = clic maintenu (mélée), comme sur desktop.
|
||||||
* II (pause = ÉCHAP, ouvre le menu en jeu). Les touches hors bouton restent
|
|
||||||
* le "clic maintenu" (mélée + menus), comme sur desktop.
|
|
||||||
*
|
*
|
||||||
* Rendu : rectangles translucides (white.png teinté) + labels texte police
|
* Rendu : rectangles translucides (white.png teinté) + labels texte police
|
||||||
* bitmap du jeu. Sprites dédiés à dessiner plus tard (voir TODO.md).
|
* bitmap du jeu. Sprites dédiés à dessiner plus tard (voir TODO.md).
|
||||||
@ -54,22 +52,20 @@ public class TouchControls extends Script {
|
|||||||
new Button("A", KeyCode.A, HSide.LEFT, 0.035f, VSide.BOTTOM, 0.035f),
|
new Button("A", KeyCode.A, HSide.LEFT, 0.035f, VSide.BOTTOM, 0.035f),
|
||||||
new Button("D", KeyCode.D, HSide.LEFT, 0.135f, VSide.BOTTOM, 0.035f),
|
new Button("D", KeyCode.D, HSide.LEFT, 0.135f, VSide.BOTTOM, 0.035f),
|
||||||
new Button("JUMP", KeyCode.SPACE, HSide.RIGHT, 0.035f, VSide.BOTTOM, 0.215f),
|
new Button("JUMP", KeyCode.SPACE, HSide.RIGHT, 0.035f, VSide.BOTTOM, 0.215f),
|
||||||
new Button("FIRE", KeyCode.MOUSE_RIGHT, HSide.RIGHT, 0.035f, VSide.BOTTOM, 0.035f, 1.25f),
|
|
||||||
new Button("II", KeyCode.ESCAPE, HSide.LEFT, 0.035f, VSide.TOP, 0.045f),
|
new Button("II", KeyCode.ESCAPE, HSide.LEFT, 0.035f, VSide.TOP, 0.045f),
|
||||||
// Pouvoirs de Frost : RANGÉE HORIZONTALE en bas au centre
|
// Pouvoirs de Frost : colonne gauche entre II (haut) et A/D (bas).
|
||||||
// (feedback v4.0.0 : atteignables en pleine course, sans
|
// Coûts d'énergie identiques au desktop (5/10/25/50) — l'injection
|
||||||
// s'arrêter). offsetX négatif = à gauche du centre. Coûts
|
// passe par ALPHA_1..4, le code du jeu ne change pas.
|
||||||
// d'énergie identiques au desktop (cf. Frost.ability*Check).
|
new Button("1", KeyCode.ALPHA_1, HSide.LEFT, 0.035f, VSide.BOTTOM, 0.20f, 0.8f),
|
||||||
new Button("1", KeyCode.ALPHA_1, HSide.CENTRE, -0.09f, VSide.BOTTOM, 0.035f, 0.65f),
|
new Button("2", KeyCode.ALPHA_2, HSide.LEFT, 0.035f, VSide.BOTTOM, 0.35f, 0.8f),
|
||||||
new Button("2", KeyCode.ALPHA_2, HSide.CENTRE, -0.03f, VSide.BOTTOM, 0.035f, 0.65f),
|
new Button("3", KeyCode.ALPHA_3, HSide.LEFT, 0.035f, VSide.BOTTOM, 0.50f, 0.8f),
|
||||||
new Button("3", KeyCode.ALPHA_3, HSide.CENTRE, 0.03f, VSide.BOTTOM, 0.035f, 0.65f),
|
new Button("4", KeyCode.ALPHA_4, HSide.LEFT, 0.035f, VSide.BOTTOM, 0.65f, 0.8f),
|
||||||
new Button("4", KeyCode.ALPHA_4, HSide.CENTRE, 0.09f, VSide.BOTTOM, 0.035f, 0.65f),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private boolean mouseDown = false;
|
private boolean mouseDown = false;
|
||||||
|
|
||||||
private enum HSide {
|
private enum HSide {
|
||||||
LEFT, CENTRE, RIGHT
|
LEFT, RIGHT
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum VSide {
|
private enum VSide {
|
||||||
@ -107,18 +103,7 @@ public class TouchControls extends Script {
|
|||||||
/** Rect du bouton en PIXELS écran, recalculé à chaque frame (resize). */
|
/** Rect du bouton en PIXELS écran, recalculé à chaque frame (resize). */
|
||||||
RectF rect(float screenW, float screenH) {
|
RectF rect(float screenW, float screenH) {
|
||||||
float size = Math.min(screenW, screenH) * 0.15f * sizeFactor;
|
float size = Math.min(screenW, screenH) * 0.15f * sizeFactor;
|
||||||
float x;
|
float x = hSide == HSide.LEFT ? offsetX * screenW : screenW - offsetX * screenW - size;
|
||||||
switch (hSide) {
|
|
||||||
case LEFT:
|
|
||||||
x = offsetX * screenW;
|
|
||||||
break;
|
|
||||||
case CENTRE: // offsetX négatif = à gauche du centre de l'écran
|
|
||||||
x = screenW / 2f + offsetX * screenW - size / 2f;
|
|
||||||
break;
|
|
||||||
default: // RIGHT
|
|
||||||
x = screenW - offsetX * screenW - size;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
float y = vSide == VSide.TOP ? offsetY * screenH : screenH - offsetY * screenH - size;
|
float y = vSide == VSide.TOP ? offsetY * screenH : screenH - offsetY * screenH - size;
|
||||||
return new RectF(x, y, size, size);
|
return new RectF(x, y, size, size);
|
||||||
}
|
}
|
||||||
@ -139,32 +124,6 @@ public class TouchControls extends Script {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Visibilité des boutons pilotée par Menu.open()/close() : le HUD
|
|
||||||
* (pouvoirs 1-4 notamment) chevauchait le menu principal et les
|
|
||||||
* menus pause — bruit visuel + conflit d'interaction (QA v0.4.0,
|
|
||||||
* feedback v4.0.0 sur les pouvoirs au-dessus de "Quit"). Les
|
|
||||||
* touches hors bouton ("clic") restent actives : les menus restent
|
|
||||||
* cliquables. Les touches en cours sont RELÂCHÉES pour éviter des
|
|
||||||
* touches bloquées pendant la pause.
|
|
||||||
*/
|
|
||||||
private static boolean buttonsVisible = true;
|
|
||||||
private static TouchControls instance;
|
|
||||||
|
|
||||||
public static void setButtonsVisible(boolean visible) {
|
|
||||||
buttonsVisible = visible;
|
|
||||||
// Relâcher immédiatement les touches injectées par les boutons :
|
|
||||||
// masquer le HUD avec une touche enfoncée la laisserait bloquée
|
|
||||||
// (ex : D tenu + ouverture du menu pause = course infinie).
|
|
||||||
if (!visible && instance != null) {
|
|
||||||
instance.releaseAllButtons();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public TouchControls() {
|
|
||||||
instance = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start() {
|
public void start() {
|
||||||
// Doit tourner dans les menus (Time.pause() par Menu.open()).
|
// Doit tourner dans les menus (Time.pause() par Menu.open()).
|
||||||
@ -180,7 +139,7 @@ public class TouchControls extends Script {
|
|||||||
// Translucide : le HUD ne doit pas masquer le jeu. Profondeur haute
|
// Translucide : le HUD ne doit pas masquer le jeu. Profondeur haute
|
||||||
// (key = layer<<61 | depth<<24 | texture) pour passer au-dessus de
|
// (key = layer<<61 | depth<<24 | texture) pour passer au-dessus de
|
||||||
// tout le HUD existant.
|
// tout le HUD existant.
|
||||||
b.background.setTint(0.12f, 0.12f, 0.12f, 0.65f);
|
b.background.setTint(0.15f, 0.15f, 0.15f, 0.45f);
|
||||||
b.background.setDepth(900);
|
b.background.setDepth(900);
|
||||||
GameObject bgObject = GameObject.instantiate(
|
GameObject bgObject = GameObject.instantiate(
|
||||||
new GameObject("Touch Button " + b.label, b.background), new Vector2());
|
new GameObject("Touch Button " + b.label, b.background), new Vector2());
|
||||||
@ -204,25 +163,9 @@ public class TouchControls extends Script {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Boutons masqués (menu principal / menu pause ouvert) : relâcher tout,
|
|
||||||
// cacher les visuels, et NE PAS faire de hit-test — mais continuer le
|
|
||||||
// traitement "clic" (les menus restent cliquables via les touches
|
|
||||||
// hors bouton).
|
|
||||||
boolean buttonsActive = buttonsVisible;
|
|
||||||
if (!buttonsVisible) {
|
|
||||||
releaseAllButtons();
|
|
||||||
}
|
|
||||||
layout();
|
layout();
|
||||||
for (Button b : buttons) {
|
|
||||||
if (b.objects != null) {
|
|
||||||
for (GameObject o : b.objects) {
|
|
||||||
o.setActive(buttonsActive);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 1) Hit-test des touches actives contre les boutons (VISIBLES
|
// 1) Hit-test des touches actives contre les boutons.
|
||||||
// uniquement — boutons cachés = toutes les touches sont des "clics").
|
|
||||||
for (Button b : buttons) {
|
for (Button b : buttons) {
|
||||||
b.pressed = false;
|
b.pressed = false;
|
||||||
}
|
}
|
||||||
@ -232,21 +175,17 @@ public class TouchControls extends Script {
|
|||||||
if (touch.phase == Touch.TouchPhase.ENDED || touch.phase == Touch.TouchPhase.CANCELLED) {
|
if (touch.phase == Touch.TouchPhase.ENDED || touch.phase == Touch.TouchPhase.CANCELLED) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (buttonsActive) {
|
Button hit = null;
|
||||||
Button hit = null;
|
for (Button b : buttons) {
|
||||||
for (Button b : buttons) {
|
if (b.rect(Screen.width, Screen.height)
|
||||||
if (b.rect(Screen.width, Screen.height)
|
.contains(touch.position.x, touch.position.y)) {
|
||||||
.contains(touch.position.x, touch.position.y)) {
|
hit = b;
|
||||||
hit = b;
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (hit != null) {
|
|
||||||
hit.pressed = true;
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!hasActionTouch) {
|
if (hit != null) {
|
||||||
|
hit.pressed = true;
|
||||||
|
} else if (!hasActionTouch) {
|
||||||
// Première touche hors bouton : "clic souris" (menus + attaque)
|
// Première touche hors bouton : "clic souris" (menus + attaque)
|
||||||
hasActionTouch = true;
|
hasActionTouch = true;
|
||||||
actionTouchPosition = touch.position;
|
actionTouchPosition = touch.position;
|
||||||
@ -287,28 +226,6 @@ public class TouchControls extends Script {
|
|||||||
return downStates[indexOf(b)];
|
return downStates[indexOf(b)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Relâche toutes les touches injectées par les boutons (idempotent : ne
|
|
||||||
* fait rien si elles ne sont pas enfoncées). Utilisé quand le HUD est
|
|
||||||
* masqué (menu ouvert) — une touche "bloquée" pendant la pause serait
|
|
||||||
* invisible pour le joueur (ex : D tenu = course infinie).
|
|
||||||
*/
|
|
||||||
private void releaseAllButtons() {
|
|
||||||
for (Button b : buttons) {
|
|
||||||
if (wasDown(b)) {
|
|
||||||
Input.injectKeyUp(b.keyCode);
|
|
||||||
GameLog.d(TAG, "release forcé (HUD masqué) : " + b.label + " -> " + b.keyCode + " up");
|
|
||||||
setDown(b, false);
|
|
||||||
}
|
|
||||||
b.pressed = false;
|
|
||||||
}
|
|
||||||
if (mouseDown) {
|
|
||||||
Input.injectKeyUp(KeyCode.MOUSE_LEFT);
|
|
||||||
mouseDown = false;
|
|
||||||
GameLog.d(TAG, "release forcé (HUD masqué) : MOUSE_LEFT up");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setDown(Button b, boolean down) {
|
private void setDown(Button b, boolean down) {
|
||||||
downStates[indexOf(b)] = down;
|
downStates[indexOf(b)] = down;
|
||||||
}
|
}
|
||||||
@ -344,8 +261,8 @@ public class TouchControls extends Script {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Feedback d'appui : le fond s'éclaircit.
|
// Feedback d'appui : le fond s'éclaircit.
|
||||||
b.background.setTint(b.pressed ? 0.5f : 0.12f, b.pressed ? 0.5f : 0.12f,
|
b.background.setTint(b.pressed ? 0.45f : 0.15f, b.pressed ? 0.45f : 0.15f,
|
||||||
b.pressed ? 0.5f : 0.12f, 0.65f);
|
b.pressed ? 0.45f : 0.15f, 0.45f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -35,12 +35,9 @@ public class MainMenu extends Menu {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String[] getOptions() {
|
protected String[] getOptions() {
|
||||||
// "Defend" (feedback v4.0.0 : "Survival Defend" créait une confusion
|
|
||||||
// avec la mission Survival — la mission charge une Défense).
|
|
||||||
return new String[]{
|
return new String[]{
|
||||||
"Defend",
|
"Play",
|
||||||
"Exterminate",
|
"Exterminate",
|
||||||
"Survival",
|
|
||||||
"Settings",
|
"Settings",
|
||||||
"Quit"
|
"Quit"
|
||||||
};
|
};
|
||||||
@ -51,7 +48,6 @@ public class MainMenu extends Menu {
|
|||||||
return new MenuAction[]{
|
return new MenuAction[]{
|
||||||
(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"),
|
|
||||||
new MenuAction() {
|
new MenuAction() {
|
||||||
@Override
|
@Override
|
||||||
public void onMenuItemSelected(Menu menu, int index, String text) {
|
public void onMenuItemSelected(Menu menu, int index, String text) {
|
||||||
|
|||||||
@ -5,12 +5,10 @@ import com.ezardlabs.dethsquare.GuiRenderer;
|
|||||||
import com.ezardlabs.dethsquare.GuiText;
|
import com.ezardlabs.dethsquare.GuiText;
|
||||||
import com.ezardlabs.dethsquare.Input;
|
import com.ezardlabs.dethsquare.Input;
|
||||||
import com.ezardlabs.dethsquare.Input.KeyCode;
|
import com.ezardlabs.dethsquare.Input.KeyCode;
|
||||||
import com.ezardlabs.dethsquare.Screen;
|
|
||||||
import com.ezardlabs.dethsquare.Script;
|
import com.ezardlabs.dethsquare.Script;
|
||||||
import com.ezardlabs.dethsquare.TextureAtlas;
|
import com.ezardlabs.dethsquare.TextureAtlas;
|
||||||
import com.ezardlabs.dethsquare.Time;
|
import com.ezardlabs.dethsquare.Time;
|
||||||
import com.ezardlabs.dethsquare.Vector2;
|
import com.ezardlabs.dethsquare.Vector2;
|
||||||
import com.ezardlabs.lostsector.objects.hud.TouchControls;
|
|
||||||
|
|
||||||
public class Menu extends Script {
|
public class Menu extends Script {
|
||||||
private final String[] options;
|
private final String[] options;
|
||||||
@ -59,65 +57,41 @@ public class Menu extends Script {
|
|||||||
public void start() {
|
public void start() {
|
||||||
runWhenPaused = true;
|
runWhenPaused = true;
|
||||||
pieces = new GameObject[options.length];
|
pieces = new GameObject[options.length];
|
||||||
/*
|
|
||||||
* Mise à l'échelle du menu : avec l'arrivée des niveaux Exterminate et
|
|
||||||
* Survival (5 options), le menu 2017 (768 gui de haut pour 5 options)
|
|
||||||
* débordait de l'écran Android. On calcule l'espace GUI réellement
|
|
||||||
* visible sous le logo (logo : y 15..240 gui), et on scale
|
|
||||||
* uniformément barres/textes/surlignages si nécessaire. À 3 options
|
|
||||||
* (desktop 2017), s = 1 : rendu identique à l'original.
|
|
||||||
*/
|
|
||||||
float guiVisibleHeight = Screen.width == 0
|
|
||||||
? 1080f // garde : Screen pas encore resizé (div/0), repère GUI par défaut
|
|
||||||
: Screen.height / (Screen.width / 1920f);
|
|
||||||
final float LOGO_BOTTOM = 240f; // bas du logo MainMenuLevel (900x225 @ y15)
|
|
||||||
// Marge BASSE réservée : la barre de geste Android recouvre le bas de
|
|
||||||
// l'écran — sans elle, "Quit" était rogné à mi-hauteur (QA v0.4.0).
|
|
||||||
float bottomMargin = 40f;
|
|
||||||
float height = (options.length - 1) * 156 + 144;
|
|
||||||
float s = Math.min(1f, (guiVisibleHeight - LOGO_BOTTOM - 8f - bottomMargin) / height);
|
|
||||||
float y0 = LOGO_BOTTOM + 8f;
|
|
||||||
float pieceWidth = 816 * s;
|
|
||||||
float pieceHeight = 156 * s;
|
|
||||||
float spacing = 156 * s;
|
|
||||||
|
|
||||||
// Depths explicites (8/9/10) : même cause racine que le logo — à depth
|
|
||||||
// 0 l'ordre barres/textes/surlignages dépendait des IDs de texture.
|
|
||||||
pieces[0] = GameObject.instantiate(
|
pieces[0] = GameObject.instantiate(
|
||||||
new GameObject("Menu Piece 0", menuRenderer("images/menus/main/top.png", pieceWidth, pieceHeight)), new Vector2());
|
new GameObject("Menu Piece 0", new GuiRenderer("images/menus/main/top.png", 816, 156)), new Vector2());
|
||||||
for (int i = 1; i < pieces.length - 1; i++) {
|
for (int i = 1; i < pieces.length - 1; i++) {
|
||||||
pieces[i] = GameObject.instantiate(
|
pieces[i] = GameObject.instantiate(
|
||||||
new GameObject("Menu Piece " + i, menuRenderer("images/menus/main/middle.png", pieceWidth, pieceHeight)),
|
new GameObject("Menu Piece " + i, new GuiRenderer("images/menus/main/middle.png", 816, 156)),
|
||||||
new Vector2());
|
new Vector2());
|
||||||
}
|
}
|
||||||
pieces[pieces.length - 1] = GameObject.instantiate(new GameObject("Menu Piece " + (pieces.length - 1),
|
pieces[pieces.length - 1] = GameObject.instantiate(new GameObject("Menu Piece " + (pieces.length - 1),
|
||||||
menuRenderer("images/menus/main/bottom.png", pieceWidth, 144 * s)), new Vector2());
|
new GuiRenderer("images/menus/main/bottom.png", 816, 144)), new Vector2());
|
||||||
|
|
||||||
texts = new GameObject[options.length];
|
texts = new GameObject[options.length];
|
||||||
guiTexts = new GuiText[options.length];
|
guiTexts = new GuiText[options.length];
|
||||||
for (int i = 0; i < texts.length; i++) {
|
for (int i = 0; i < texts.length; i++) {
|
||||||
guiTexts[i] = new GuiText(options[i], TextureAtlas.load("fonts"), 50 * s, 10);
|
guiTexts[i] = new GuiText(options[i], TextureAtlas.load("fonts"), 50, 1);
|
||||||
texts[i] = GameObject.instantiate(new GameObject("Menu Option", guiTexts[i]), new Vector2());
|
texts[i] = GameObject.instantiate(new GameObject("Menu Option", guiTexts[i]), new Vector2());
|
||||||
}
|
}
|
||||||
|
|
||||||
highlights = new GameObject[options.length];
|
highlights = new GameObject[options.length];
|
||||||
for (int i = 0; i < highlights.length - 1; i++) {
|
for (int i = 0; i < highlights.length - 1; i++) {
|
||||||
highlights[i] = GameObject.instantiate(
|
highlights[i] = GameObject.instantiate(
|
||||||
new GameObject("Menu Highlight", menuRenderer("images/menus/main/highlight.png", 156 * s, 66 * s, 9)),
|
new GameObject("Menu Highlight", new GuiRenderer("images/menus/main/highlight.png", 156, 66)),
|
||||||
new Vector2());
|
new Vector2());
|
||||||
}
|
}
|
||||||
highlights[highlights.length - 1] = GameObject.instantiate(
|
highlights[highlights.length - 1] = GameObject.instantiate(
|
||||||
new GameObject("Menu Highlight", menuRenderer("images/menus/main/highlight_bottom.png", 414 * s, 66 * s, 9)),
|
new GameObject("Menu Highlight", new GuiRenderer("images/menus/main/highlight_bottom.png", 414, 66)),
|
||||||
new Vector2());
|
new Vector2());
|
||||||
|
|
||||||
|
float height = (options.length - 1) * 156 + 144;
|
||||||
for (int i = 0; i < options.length; i++) {
|
for (int i = 0; i < options.length; i++) {
|
||||||
pieces[i].transform.position.set(960 - pieceWidth / 2 + offset.x, y0 + spacing * i);
|
pieces[i].transform.position.set(960 - 408, 540 - height / 2 + 156 * i);
|
||||||
highlights[i].transform.position.set(pieces[i].transform.position.offset(
|
highlights[i].transform.position.set(pieces[i].transform.position.offset(i == texts.length - 1 ? 66 : 636,
|
||||||
(i == texts.length - 1 ? 66 : 636) * s, (i == texts.length - 1 ? 54 : 25) * s));
|
i == texts.length - 1 ? 54 : 25));
|
||||||
texts[i].transform.position.set(
|
texts[i].transform.position.set(
|
||||||
pieces[i].transform.position.offset(150 * s, (40 + (i == texts.length - 1 ? 28 : 0)) * s));
|
pieces[i].transform.position.offset(150, 40 + (i == texts.length - 1 ? 28 : 0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startOpen) {
|
if (startOpen) {
|
||||||
open();
|
open();
|
||||||
} else {
|
} else {
|
||||||
@ -125,22 +99,6 @@ public class Menu extends Script {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* GuiRenderer du menu avec depth explicite : le tri GUI secondaire à
|
|
||||||
* depth égal se fait sur l'ID de texture (dépendant de l'ordre de
|
|
||||||
* chargement) — sans depth fixe, l'empilement barres/textes/surlignages
|
|
||||||
* peut s'inverser après un rechargement de niveau.
|
|
||||||
*/
|
|
||||||
private static GuiRenderer menuRenderer(String imagePath, float width, float height) {
|
|
||||||
return menuRenderer(imagePath, width, height, 8);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static GuiRenderer menuRenderer(String imagePath, float width, float height, int depth) {
|
|
||||||
GuiRenderer renderer = new GuiRenderer(imagePath, width, height);
|
|
||||||
renderer.setDepth(depth);
|
|
||||||
return renderer;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
if (open && guiTexts != null) {
|
if (open && guiTexts != null) {
|
||||||
@ -159,10 +117,6 @@ public class Menu extends Script {
|
|||||||
|
|
||||||
public void open() {
|
public void open() {
|
||||||
open = true;
|
open = true;
|
||||||
// Masquer le HUD tactile : les boutons chevauchaient le menu (et un
|
|
||||||
// pouvoir sous "Quit" se déclenchait au clic du menu). TouchControls
|
|
||||||
// no-op sur desktop (instance nulle).
|
|
||||||
TouchControls.setButtonsVisible(false);
|
|
||||||
for (GameObject piece : pieces) {
|
for (GameObject piece : pieces) {
|
||||||
piece.setActive(true);
|
piece.setActive(true);
|
||||||
}
|
}
|
||||||
@ -177,7 +131,6 @@ public class Menu extends Script {
|
|||||||
|
|
||||||
public void close() {
|
public void close() {
|
||||||
open = false;
|
open = false;
|
||||||
TouchControls.setButtonsVisible(true);
|
|
||||||
for (GameObject piece : pieces) {
|
for (GameObject piece : pieces) {
|
||||||
piece.setActive(false);
|
piece.setActive(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -90,6 +90,4 @@ for f in "$OUT/$PREFIX-windows.zip" "$OUT/$PREFIX-linux.zip" \
|
|||||||
done
|
done
|
||||||
|
|
||||||
ls -lh "$OUT"
|
ls -lh "$OUT"
|
||||||
# Nettoyage du staging (4 copies complètes d'installDist ≈ 200 Mo par release)
|
echo "==> Artefacts prêts dans build/release/ (version $VERSION)"
|
||||||
rm -rf "$BUILD"
|
|
||||||
echo "==> Artefacts prêts dans build/release/ (version $VERSION), staging nettoyé"
|
|
||||||
|
|||||||
@ -1,88 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# test-android.sh — anti-régression Android : installe le build courant,
|
|
||||||
# lance une séquence de touches réelles sur l'émulateur et vérifie les logs
|
|
||||||
# GameLog attendus (tir, mélée, pouvoirs, wall glide).
|
|
||||||
#
|
|
||||||
# Usage : scripts/test-android.sh [version] (défaut : titre du commit)
|
|
||||||
#
|
|
||||||
# Prérequis : émulateur Android démarré + adb accessible, APK déjà construit
|
|
||||||
# (./gradlew :android-app:assembleDebug).
|
|
||||||
#
|
|
||||||
# Ce que la séquence vérifie (logs logcat) :
|
|
||||||
# - "tir primaire" -> bouton FIRE -> MOUSE_RIGHT (anti-régression
|
|
||||||
# feedback v4.0.0 : tir injoignable)
|
|
||||||
# - "touch button" -> hit-test des boutons du HUD tactile
|
|
||||||
# - "TouchControls" -> HUD attaché
|
|
||||||
# - "glyphe" absent -> tolérance des caractères manquants
|
|
||||||
#
|
|
||||||
# Sortie : PASS/FAIL par check, code retour 1 si un check échoue.
|
|
||||||
# Idempotent : relançable à volonté (force-stop avant chaque lancement).
|
|
||||||
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
PKG="fr.siphonight.lostsectorport"
|
|
||||||
ACTIVITY="$PKG/com.ezardlabs.lostsector.AndroidGameActivity"
|
|
||||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
||||||
|
|
||||||
# --- Pré-vol ---------------------------------------------------------------
|
|
||||||
adb get-state >/dev/null 2>&1 || {
|
|
||||||
echo "ERREUR : aucun émulateur/device adb" >&2
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
[ -f "$ROOT/android-app/build/outputs/apk/debug/android-app-debug.apk" ] || {
|
|
||||||
echo "ERREUR : APK absent — lancer './gradlew :android-app:assembleDebug'" >&2
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# --- Installation et lancement ---------------------------------------------
|
|
||||||
echo "==> Installation de l'APK"
|
|
||||||
adb install -r "$ROOT/android-app/build/outputs/apk/debug/android-app-debug.apk" >/dev/null
|
|
||||||
adb logcat -c
|
|
||||||
adb shell am force-stop "$PKG" 2>/dev/null || true
|
|
||||||
adb shell am start -n "$ACTIVITY" >/dev/null
|
|
||||||
sleep 14 # menu principal chargé
|
|
||||||
|
|
||||||
fails=0
|
|
||||||
|
|
||||||
check() {
|
|
||||||
if grep -q "$2" /tmp/test-android.log 2>/dev/null; then
|
|
||||||
echo "PASS : $1"
|
|
||||||
else
|
|
||||||
echo "FAIL : $1 (motif '$2' absent des logs)" >&2
|
|
||||||
fails=$((fails + 1))
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# --- Test 1 : le menu se charge sans crash ---------------------------------
|
|
||||||
adb logcat -d >/tmp/test-android.log
|
|
||||||
check "menu principal chargé sans crash" "LS-LEVEL: Level 'main_menu' fully loaded"
|
|
||||||
|
|
||||||
# --- Test 2 : Defend -> tir primaire via FIRE ------------------------------
|
|
||||||
# (FIRE = bas droite, MOUSE_RIGHT maintenu -> "tir primaire : cadence engagée")
|
|
||||||
adb shell input swipe 1055 375 1055 375 300 # Defend
|
|
||||||
sleep 14
|
|
||||||
(adb shell input swipe 2235 900 2235 900 1200 &)
|
|
||||||
sleep 3
|
|
||||||
adb logcat -d >/tmp/test-android.log
|
|
||||||
check "HUD tactile attaché (9 boutons)" "TouchControls attached"
|
|
||||||
check "tir primaire déclenché via FIRE" "tir primaire"
|
|
||||||
|
|
||||||
# --- Test 3 : pouvoir 1 (rangée horizontale bas centre) --------------------
|
|
||||||
adb shell input swipe 1080 1000 1080 1000 200 # bouton 1
|
|
||||||
sleep 2
|
|
||||||
adb logcat -d >/tmp/test-android.log
|
|
||||||
check "pouvoir 1 déclenché" "pouvoir 1"
|
|
||||||
|
|
||||||
# --- Test 4 : pause (II) dans la mission -----------------------------------
|
|
||||||
adb shell input swipe 1080 120 1080 120 200 # bouton II
|
|
||||||
sleep 3
|
|
||||||
adb logcat -d >/tmp/test-android.log
|
|
||||||
check "menu pause via II (pas de crash)" "LS-GAMEPLAY\|LS-LEVEL"
|
|
||||||
|
|
||||||
# --- Bilan -----------------------------------------------------------------
|
|
||||||
if [ "$fails" -eq 0 ]; then
|
|
||||||
echo "==> ANTI-RÉGRESSION : PASS (4/4)"
|
|
||||||
else
|
|
||||||
echo "==> ANTI-RÉGRESSION : FAIL ($fails échec(s))" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
Loading…
x
Reference in New Issue
Block a user