Search in sources :

Example 6 with GameEngine

use of com.relic.highflyer.GameEngine in project high-flyer by sangngh.

the class LandingDetectorTest method testDetect_noLanding.

@Test
public void testDetect_noLanding() {
    GameState state = new GameState();
    GameEngine game = new GameEngine(new GameSettings(800, 600), state, new ScreenManager());
    Mockito.when(mockScreenManager.getScreen(Mockito.anyInt())).thenReturn(Mockito.mock(Screen.class));
    List<Cell> nextCells = new ArrayList<>();
    Cell landingCell = new Cell();
    TiledMapTile mockTile = Mockito.mock(TiledMapTile.class);
    MapProperties mapProperties = new MapProperties();
    mapProperties.put("notlanding", true);
    Mockito.when(mockTile.getProperties()).thenReturn(mapProperties);
    landingCell.setTile(mockTile);
    nextCells.add(landingCell);
    subject.detect(game, nextCells, mockPlayer, 100, 100);
    assertEquals("Mismatching game level", 1, game.getState().getLvl());
    Mockito.verifyZeroInteractions(mockSoundPlayer);
}
Also used : ScreenManager(com.relic.highflyer.screens.ScreenManager) TiledMapTile(com.badlogic.gdx.maps.tiled.TiledMapTile) Screen(com.badlogic.gdx.Screen) ArrayList(java.util.ArrayList) MapProperties(com.badlogic.gdx.maps.MapProperties) GameState(com.relic.highflyer.GameState) GameEngine(com.relic.highflyer.GameEngine) GameSettings(com.relic.highflyer.GameSettings) Cell(com.badlogic.gdx.maps.tiled.TiledMapTileLayer.Cell) Test(org.junit.Test)

Example 7 with GameEngine

use of com.relic.highflyer.GameEngine in project high-flyer by sangngh.

the class PowerUpDetectorTest method testDetect_noCollistion.

@Test
public void testDetect_noCollistion() {
    GameState state = new GameState();
    state.setScore(100);
    GameEngine game = new GameEngine(new GameSettings(800, 600), state, new ScreenManager());
    List<Cell> nextCells = new ArrayList<>();
    Cell collisionCell = new Cell();
    TiledMapTile mockTile = Mockito.mock(TiledMapTile.class);
    MapProperties mapProperties = new MapProperties();
    mapProperties.put("notpower", "star");
    Mockito.when(mockTile.getProperties()).thenReturn(mapProperties);
    collisionCell.setTile(mockTile);
    nextCells.add(collisionCell);
    subject.detect(game, nextCells, mockPlayer, 100, 100);
    Mockito.verifyZeroInteractions(mockSoundPlayer);
    assertEquals("Mismatching game score", 100, state.getScore());
}
Also used : ScreenManager(com.relic.highflyer.screens.ScreenManager) TiledMapTile(com.badlogic.gdx.maps.tiled.TiledMapTile) ArrayList(java.util.ArrayList) MapProperties(com.badlogic.gdx.maps.MapProperties) GameState(com.relic.highflyer.GameState) GameEngine(com.relic.highflyer.GameEngine) GameSettings(com.relic.highflyer.GameSettings) Cell(com.badlogic.gdx.maps.tiled.TiledMapTileLayer.Cell) Test(org.junit.Test)

Example 8 with GameEngine

use of com.relic.highflyer.GameEngine in project high-flyer by sangngh.

the class DesktopLauncher method main.

public static void main(String[] arg) {
    GameSettings settings = new GameSettings(AspectRatio.STANDARD.calculateWidth(600), 600);
    LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
    config.title = "High Flyer - Soars to the sky!";
    config.useGL30 = false;
    config.height = settings.getWindowHeight();
    config.width = settings.getWindowWidth();
    new LwjglApplication(new GameEngine(settings, new GameState(), ScreenManager.INSTANCE), config);
}
Also used : LwjglApplication(com.badlogic.gdx.backends.lwjgl.LwjglApplication) LwjglApplicationConfiguration(com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration) GameEngine(com.relic.highflyer.GameEngine) GameState(com.relic.highflyer.GameState) GameSettings(com.relic.highflyer.GameSettings)

Aggregations

GameEngine (com.relic.highflyer.GameEngine)8 GameSettings (com.relic.highflyer.GameSettings)8 GameState (com.relic.highflyer.GameState)8 MapProperties (com.badlogic.gdx.maps.MapProperties)7 TiledMapTile (com.badlogic.gdx.maps.tiled.TiledMapTile)7 Cell (com.badlogic.gdx.maps.tiled.TiledMapTileLayer.Cell)7 ScreenManager (com.relic.highflyer.screens.ScreenManager)7 ArrayList (java.util.ArrayList)7 Test (org.junit.Test)7 Screen (com.badlogic.gdx.Screen)3 LwjglApplication (com.badlogic.gdx.backends.lwjgl.LwjglApplication)1 LwjglApplicationConfiguration (com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration)1