Open Dmartin42 opened 5 years ago
I also have the player animation controller but I decided not to include it.
Have you created collisions?
Collisions are working for me. I managed them threw the map files (i.e.: ".tmx" and ".litidata"). I use Tiled to open the ".tmx" file, and utiLITI to open the ".litidata" file.
It is possible to use X and Y inputs for controller support if that is what you're asking for. Please follow this link: https://forum.litiengine.com/d/11-gamepad-inputs
Also, I used your rotation system and was wondering if there was a way to put an x and a y on my player. Attached is my source code. `public class mainLoader {
}
package Screens;
import java.awt.Image;
import javax.swing.ImageIcon;
import de.gurkenlabs.litiengine.Game; import de.gurkenlabs.litiengine.gui.ImageComponent; import de.gurkenlabs.litiengine.gui.screens.Screen;
public class mainMenu extends Screen{ public static final String NAME = "Menu"; public mainMenu() { super("Menu"); } public void prepare() { super.prepare(); } protected void initializeComponents () { Image imageCursorMain = new ImageIcon("resources/cursor_white_164.png").getImage(); Game.getScreenManager().getRenderComponent().setCursor(imageCursorMain, 0, 0); final double screenCenterX = Game.getScreenManager().getResolution().getWidth() / 2.0; final double screenCenterY = Game.getScreenManager().getResolution().getHeight() / 2.0; ImageComponent start = new ImageComponent(screenCenterX-150, screenCenterY-50, 300, 100, null, "Start Game", null); ImageComponent exit = new ImageComponent(start.getX(), start.getY()+start.getHeight(), 300, 100, null, "Exit Game", null);
}
package Screens;
import java.awt.Graphics2D; import java.awt.geom.Point2D; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap;
import Engine.MoreRotaion; import Entities.Player; import de.gurkenlabs.litiengine.Game; import de.gurkenlabs.litiengine.environment.EntitySpawner; import de.gurkenlabs.litiengine.environment.Environment; import de.gurkenlabs.litiengine.environment.tilemap.IMap; import de.gurkenlabs.litiengine.gui.ImageComponent; import de.gurkenlabs.litiengine.gui.screens.Screen;
public class mainGameScreen extends Screen{ public static final String NAME = "Game"; private static mainGameScreen instance; //private EntitySpawner ennemySpawner;
protected mainGameScreen() {
super("Game");
}
public static mainGameScreen getInstance() {
if(instance==null)
instance = new mainGameScreen();
return instance;
}
public void prepare () {
super.prepare();
}
package Engine;
public enum MoreRotaion { NONE, ROTATE_45, ROTATE_90, ROTATE_135, ROTATE_180, ROTATE_225, ROTATE_270, ROTATE_315;
}
package Entities;
import java.awt.event.KeyEvent; import java.awt.geom.Point2D;
import javax.swing.ImageIcon;
import Engine.MoreRotaion; import Engine.mainLoader; import Screens.mainMenu; import de.gurkenlabs.litiengine.Direction; import de.gurkenlabs.litiengine.Game; import de.gurkenlabs.litiengine.entities.Creature; import de.gurkenlabs.litiengine.entities.IMobileEntity; import de.gurkenlabs.litiengine.environment.tilemap.MapLoader; import de.gurkenlabs.litiengine.graphics.animation.EntityAnimationController; import de.gurkenlabs.litiengine.graphics.animation.PropAnimationController; import de.gurkenlabs.litiengine.input.Input; import de.gurkenlabs.litiengine.input.KeyboardEntityController;
public class Player extends Creature{ private MoreRotaion rotation;
// Input.keyboard().onKeyTyped(KeyEvent.VK_SPACE, (key) -> { // this.fire(this); // });
// private void fire (Player player) { // FirePlayer firePlayer = new FirePlayer(player); // listFired.add(firePlayer); // Game.getEnvironment().add(firePlayer); // }
} `