Jump to content

The loaded map covers the character.


deadlylaid
 Share

Recommended Posts

I want to create rpg game like 'diablo' in web

first I create barbarian sprite, and load

 

function preload(){
  
//Player(Bavarian)
    //----------------------------------------------------------------------------------------------------------
    Lucifer_Game.load.spritesheet('PY_Bavarian_Stand',
                                  '../../static/images/game/Player/Bavarian/stand/Stand.png', 200, 200);
    Lucifer_Game.load.spritesheet('PY_Bavarian_Walk',
                                   '../../static/images/game/Player/Bavarian/walk/Walk.png', 200, 200);
    //----------------------------------------------------------------------------------------------------------

}

function create(){

//Physics
	Lucifer_Game.physics.startSystem(Phaser.Physics.ARCADE);

//Player
	//---------------------------------------------------------------------------------------
	Player = Lucifer_Game.add.sprite(Lucifer_Game.world.centerX, Lucifer_Game.world.centerY, 'PY_Bavarian_Stand');	

	//Player = Lucifer_Game.add.group();	
	Lucifer_Game.physics.enable(Player, Phaser.Physics.ARCADE);

	//Player Stand Animation	
	//var PY_Bavarian_StandFrame_Array = new Array(8);
	var j = 0;
	for(var i = 0; i < 8; ++i)
	{
		Player.animations.add('PY_Bavarian_Stand_' + i, 
							   [j, j + 1, j + 2, j + 3, j + 4, j + 5, j + 6], 60, true); 
		 j += 8;
	}		


}

 

first screenshot is when I load character only

 

and I create tilemap using tiled (orthogonal, json)

 

and insert code

 

function preload(){
   
    //Map
    //----------------------------------------------------------------------------------------------------------
    Lucifer_Game.load.tilemap('MAP_Stage1', '../../static/images/game/Map/Stage1/Stage1.json',
                               null, Phaser.Tilemap.TILED_JSON);
    Lucifer_Game.load.image('Stage1_TileSet', '../../static/images/game/Map/Stage1/Stage1_TileSet.png');    
    //----------------------------------------------------------------------------------------------------------

    //Player(Bavarian)
    //----------------------------------------------------------------------------------------------------------
    Lucifer_Game.load.spritesheet('PY_Bavarian_Stand',
                                  '../../static/images/game/Player/Bavarian/stand/Stand.png', 200, 200);
    Lucifer_Game.load.spritesheet('PY_Bavarian_Walk',
                                   '../../static/images/game/Player/Bavarian/walk/Walk.png', 200, 200);
    //----------------------------------------------------------------------------------------------------------
    
}

function create(){
    //Group
    //---------------------------------------------------------------------------------------    
    mapLayerGroup = Lucifer_Game.add.group();
    mapLayerGroup.z = 0;

    showLayerGroup = Lucifer_Game.add.group();
    showLayerGroup.z = 200;    
    //---------------------------------------------------------------------------------------

    //Physics
    Lucifer_Game.physics.startSystem(Phaser.Physics.ARCADE);    

    //Map / Scroll
    //---------------------------------------------------------------------------------------
    Background_map = Lucifer_Game.add.tilemap('MAP_Stage1');        
    Background_map.addTilesetImage('Stage1_TileSet', 'Stage1_TileSet');
    Stage1 = Background_map.createLayer('Tile Layer 1');    
    Stage1.resizeWorld();    
    mapLayerGroup.add(Stage1);
    //---------------------------------------------------------------------------------------

    //Player
    //---------------------------------------------------------------------------------------
    Player = Lucifer_Game.add.sprite(Lucifer_Game.world.centerX, Lucifer_Game.world.centerY, 'PY_Bavarian_Stand');
    showLayerGroup.add(Player);

    Lucifer_Game.Group.sort();
    Lucifer_Game.Group.sort('z', )

    Lucifer_Game.physics.enable(Player, Phaser.Physics.ARCADE);

 

when I run in localhost,

 

loaded map cover my character

 

second screenshot is loadedmap image, and my character is under the map image...

 

I want change location charcter's z-index(?) please somebody help me

스크린샷 2017-03-24 오후 5.41.10.png

Pasted image at 2017_03_24 05_45 PM.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...