mirror of
				https://github.com/Klagarge/PokeHES.git
				synced 2025-11-04 13:19:17 +00:00 
			
		
		
		
	polish and bug fix
This commit is contained in:
		@@ -37,31 +37,34 @@ public class PokeMudry extends PortableApplication {
 | 
			
		||||
    public void onInit() {
 | 
			
		||||
        sp.init();
 | 
			
		||||
        controller.init();
 | 
			
		||||
 | 
			
		||||
        // add player, create and add all enemies in entities
 | 
			
		||||
		entities.add((Entity) sp.p);
 | 
			
		||||
		enemies.add(new Enemy("Mudry", 10, 15, "lumberjack_sheet32", "desert"));
 | 
			
		||||
		enemies.add(new Enemy("Pignat", 5, 1, "lumberjack_sheet32", "test"));
 | 
			
		||||
 | 
			
		||||
        for (Enemy enemy : enemies) { entities.add(enemy); }
 | 
			
		||||
 | 
			
		||||
		for (Entity entity : entities) { entity.init(); }
 | 
			
		||||
		//Init all entities
 | 
			
		||||
        for (Entity entity : entities) { entity.init(); }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void onGraphicRender(GdxGraphics g) {
 | 
			
		||||
        g.clear();
 | 
			
		||||
		sp.p.manageEntity(sp.sm, controller);
 | 
			
		||||
        sp.render(g);
 | 
			
		||||
        System.out.println(sp.screenManager.getActiveScreen().getClass());
 | 
			
		||||
        //System.out.println(ScreenMap.class);
 | 
			
		||||
		for (Entity entity : entities) {
 | 
			
		||||
            
 | 
			
		||||
            if (entity.getMap().equals(sp.sm.map) && sp.screenManager.getActiveScreen().getClass().equals(ScreenMap.class))
 | 
			
		||||
                entity.graphicRender(g);
 | 
			
		||||
 | 
			
		||||
            
 | 
			
		||||
        boolean onMapScreen = sp.screenManager.getActiveScreen().getClass().equals(ScreenMap.class);
 | 
			
		||||
		
 | 
			
		||||
        if(onMapScreen) sp.p.manageEntity(sp.sm, controller);
 | 
			
		||||
        sp.render(g);
 | 
			
		||||
        
 | 
			
		||||
		for (Entity entity : entities) {
 | 
			
		||||
            // Render only entities on the good map
 | 
			
		||||
            if (entity.getMap().equals(sp.sm.map) && onMapScreen)
 | 
			
		||||
                entity.graphicRender(g);
 | 
			
		||||
		}
 | 
			
		||||
        
 | 
			
		||||
        if (sp.p.frontOfEnemy && sp.screenManager.getActiveScreen().getClass().equals(ScreenMap.class)){
 | 
			
		||||
        // Switch screen
 | 
			
		||||
        if (sp.p.frontOfEnemy && onMapScreen){
 | 
			
		||||
            sp.e = sp.p.lastEnemy;
 | 
			
		||||
            System.out.println("switch screen");
 | 
			
		||||
            sp.screenManager.activateNextScreen();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user