# Kirupa's RPG tutorial... Player placement problems!

**URL:** <https://forum.kirupa.com/t/kirupas-rpg-tutorial-player-placement-problems/135163>\
**Category:** Uncategorized\
**Created:** [January 25, 2005, 7:29am UTC](https://forum.kirupa.com/t/kirupas-rpg-tutorial-player-placement-problems/135163 "2005-01-25T07:29:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![WarpZone](https://avatars.discourse-cdn.com/v4/letter/w/5e9695/32.png) [@WarpZone](https://forum.kirupa.com/u/WarpZone)\
**Post date:** [January 25, 2005, 7:29am UTC](https://forum.kirupa.com/t/kirupas-rpg-tutorial-player-placement-problems/135163/1 "2005-01-25T07:29:03Z")

</div>

Hey there.

As an introduction to Flash (and Object-Oriented Programming at a level more complicated than Multimedia Fusion, for that matter,) I’m working my way through kirupa’s RPG tutorial. I like it. It seems much cleaer-written and better-explained than the jailb\*tch-derived tutorials I had been trying to learn from.

The page I’m currently stuck on is availible at: [http://www.kirupa.com/developer/actionscript/rpgprogramming6.htm](http://www.kirupa.com/developer/actionscript/rpgprogramming6.htm)

Note that I am using the default map and item array as copied directly from the tutorial, but **my tiles are all 32x32 pixels, not 64x64.** Also, the player object name has been changed from Guy to **Player,** and the player graphic image has been changed from guy\_mc to **Guy.** Relevent variable names and values within the code have (as far as I can tell) been properly changed to reflect this.

Here’s my problem: **The player always appears at coordinates 0,0 when I run the movie,** instead of appearing relative to the location of the 1 in the itemMap1 array.

What follows is the entire ActionScript code from the first frame of my timeline. I think the problem is probabaly somewhere within this block of code. If someone who has done this RPG tutorial sucessfully could take a look at my code and see if they can spot the cause, I’d be much obliged.

Thanks in advance for your help. 🙂

```auto
 //Global Game Variables
 
money = 0;
//Tile Code
mvWdth = 288;
mvHght = 288;
tileWdth = 32;
tileHght = 32;
 
tile0 = function () {
};
tile0.prototype.pos = 1;
tile0.prototype.barrier = false;
tile1 = function () {
};
tile1.prototype.pos = 2;
tile1.prototype.barrier = true;
tile2 = function () {
};
tile2.prototype.pos = 3;
tile2.prototype.barrier = true;
 
map1 = [[2, 2, 2, 2, 2, 2, 2, 2, 2], 
[2, 2, 2, 0, 0, 0, 0, 0, 2],
[2, 2, 1, 0, 0, 0, 0, 0, 2],
[2, 1, 1, 1, 0, 0, 0, 0, 1],
[1, 1, 1, 1, 0, 0, 0, 0, 1],
[1, 1, 1, 1, 0, 0, 0, 0, 2],
[1, 1, 1, 0, 0, 0, 1, 1, 2],
[1, 1, 0, 0, 0, 0, 0, 1, 2],
[1, 1, 1, 1, 2, 2, 2, 2, 2]];
 
itemMap1 = [[0, 0, 0, 0, 0, 0, 0, 0, 0], 
	[0, 0, 0, 0, 0, 0, 0, 0, 0], 
	[0, 0, 0, 0, 0, 0, 0, 0, 0], 
	[0, 0, 0, 0, 0, 1, 0, 0, 0], 
	[0, 0, 0, 0, 0, 0, 0, 0, 0], 
	[0, 0, 0, 0, 0, 0, 0, 0, 0], 
	[0, 0, 0, 0, 0, 0, 0, 0, 0], 
	[0, 0, 0, 0, 0, 0, 0, 0, 0], 
	[0, 0, 0, 0, 0, 0, 0, 0, 0]];
 
function MapMaker(map) {
_root.attachMovie("blank", "tiler", d++);
var mapWdth = map[0].length;
var mapHght = map.length;
 
 
for (var i = 0; i<MAPHGHT; p i++) {<> 
 
for (var j = 0; j<MAPWDTH; p j++) {<> var name = "tile_"+j+"_"+i;
_root[name] = new _root["tile"+map*[j]]();
_root.tiler.attachMovie("TileSet1", name, i*100+j*2);
_root.tiler[name]._x = (j*_root.tileWdth);
_root.tiler[name]._y = (i*_root.tileHght);
_root.tiler[name].gotoAndStop(_root[name].pos);
}
}
}
 
 
 
function placeItems (map) { 
//_root.attachMovie("blank", "items", this.getNextHighestDepth()); 
_root.attachMovie("blank", "items", this.getNextHighestDepth()); 
var mapWdth = map[0].length; 
var mapHght = map.length; 
for (var i = 0; i < mapHght; i++) { 
for (var j = 0; j < mapWdth; j++) { 
switch (map*[j]){ 
case 1 : 
_root.items.attachMovie("Player","Guy", d++); 
_root.items.guy_mc._x = (j*_root.tileWdth * j); 
_root.items.guy_mc._y = (i*_root.tileHght * i); 
} 
} 
} 
} 
 
 
 
MapMaker(map1);
placeItems(itemMap1); 
 

```
