hi there,
i am building a game in an isometric view and have a serious structure problem…it is a maze where a character walks around on a grid and has to to pick up objects one by one at the beginning of the grid and then drop them off at the end, go back, get the next one etc.
right now i have a girl1 object which is created on the world object, and all my functions are working fine. i realised now though that when i want to get to the start to pick up an object, i need a way to change the movieclip of the object into the one where the character is carrying something (and i can’t just attach a movie because the walking animations are different depending on what she carries…) and my functions should still work…can anyone help me with ideas? i was thinking of defining the object more globally and then creating different instances and changing the functions into prototypes, but as i am fairly new to OOP and actionscript in general i am totally lost.
here is what part of the code looks like now:
//build isometric world, world object stores info about isoworld//
function buildWorld(maxx, maxz) {
world = new Object();
world.maxx = maxx;
world.maxz = maxz;
world.cellWidth = 29;
world.width = maxx*world.cellWidth;
world.length = -maxz*world.cellWidth;
world.path = this.floor;
var path = world.path;
path.depth = 1000;
buildFloor(path);
buildCharacter(path);
}
//function build Character: create character
function buildCharacter(path) {
world.girl1 = new Object();
world.girl1.tempx = -5;
world.girl1.tempy = 0;
world.girl1.tempz = -36;
world.girl1.speed = 4;
world.girl1.carry = false;
world.girl1.width = 10;
world.girl1.xmov = 0;
world.girl1.zmov = 0;
world.girl1.moving = false;
world.girl1.clip = floor.girl;
placeGirl();
}
//place girl
function placeGirl() {
world.girl1.x = world.girl1.tempx;
world.girl1.y = world.girl1.tempy;
world.girl1.z = world.girl1.tempz;
var temp = iso.mapToScreen(world.girl1.x, world.girl1.y, world.girl1.z);
world.girl1.clip._x = temp[0];
world.girl1.clip._y = temp[1];
//capture keys
function captureKeys() {
if (Key.isDown(Key.RIGHT)) {
world.girl1.tempz = world.girl1.z+world.girl1.zmov;
world.girl1.zmov = world.girl1.speed;
world.girl1.clip.gotoAndPlay("walk_right");
} else if (Key.isDown(Key.LEFT)) {
world.girl1.tempz = world.girl1.z-world.girl1.zmov;
world.girl1.zmov = world.girl1.speed;
world.girl1.clip.gotoAndPlay("walk_left");
}else if (Key.isDown(Key.UP)) {
world.girl1.tempx = world.girl1.x-world.girl1.xmov;
world.girl1.xmov = world.girl1.speed;
world.girl1.clip.gotoAndPlay("walk_up");
} else if (Key.isDown(Key.DOWN)) {
world.girl1.tempx = world.girl1.x+world.girl1.xmov;
world.girl1.xmov = world.girl1.speed;
world.girl1.clip.gotoAndPlay("walk_down");
}
}
i can’t get any sleep because if this, so please please please help:)
thanks
sunn