hi
i have a problem with a global variable.
first of all i should explain you my flash file:
it’s made like the rpg tutorial here… so i’m generating my maps and a status menu on frame 6:
...
MapMaker(map1);
MapMaker2(map2);
placeItems(itemMap1);
MapMaker3(map3);
MapMaker4(map4);
_root.attachMovie("Status", "status", _root.getNextHighestDepth());
at the first frame i declare my two variables:
_global.schritte=0; // steps my pc walked
_global.attack=false; //monster attack
at the status movieclip (see above) i used this one to check the steps:
if (_global.schritte > 200) {
_root.attachMovie("Battle", "a_battle", _root.getNextHighestDepth()-2);
_global.attack = true;
_global.schritte=0;
}
my char walks that way:
if (Key.isDown(Key.UP)) {
play();
if (checkCoords(_parent._x, _parent._y - walkSpeed,0)){
_parent._y-= walkSpeed;
_root.items.guy_mc.char._y-= walkSpeed;
_global.schritte+=random(walkSpeed);
trace(_global.schritte);
}}
i used the trace function to watch the steps but the went higher than 200 and nothing happend :stare:
i used a similar method with the menu and it works :
on (press) {
if (_global.menu == false) {
_root.attachMovie("Menu", "a_menu", _root.getNextHighestDepth()-2);
_global.menu = true;
} else {
_root.a_menu.removeMovieClip();
_global.menu = false;
_root.gotoAndPlay(6);
}
}
you can test it here:
http://www.animeschatten.net/game/flash/map.swf
[SIZE=4]Please help me!![/SIZE]