PDA

View Full Version : put NPC at z value


i8bit
01-15-2014, 11:40 PM
temp.npc = this.level.putNPC2(player.x, player.y, "");
temp.npc.join("test");

How do you specify what z value the NPC is placed?

Draenin
01-15-2014, 11:48 PM
Shouldn't it just be this.z?

Torankusu
01-15-2014, 11:52 PM
temp.npc = this.level.putNPC2(player.x, player.y, "");
temp.npc.join("test");
temp.npc.z = value; //change the word value to the correct numerical value of the z axis you want it on

You should take note, however, that if you place it on a Z coordinate (ex. z = 5) on something that is not a terrain map or level, it will actually LOOK like it's being placed at a y axis lower than the player's y (MORE towards the top of the screen / above the player...).

callimuc
01-16-2014, 02:43 PM
temp.npc = this.level.putNPC2(player.x, player.y, "");
temp.npc.join("test");
temp.npc.z = value; //change the word value to the correct numerical value of the z axis you want it on

You should take note, however, that if you place it on a Z coordinate (ex. z = 5) on something that is not a terrain map or level, it will actually LOOK like it's being placed at a y axis lower than the player's y (MORE towards the top of the screen / above the player...).

except its a gani, then the shadow should stay at 0 while all other sprites are moving up

Torankusu
01-16-2014, 03:36 PM
except its a gani, then the shadow should stay at 0 while all other sprites are moving up

Hm my original post did say that about animations but I guess I accidentally deleted it in an edit.

I felt I should include the detail incase he gets it to place, sets a z, but cant actually tell its above 0

100Zero100
01-18-2014, 08:09 PM
putnpc2(0,0,...).z = 5; too - but I wouldn't recommend it.

Some people like it.