I have this code which works like a conversation...the mcs is the dialogue. Can someone help me make this code more efficient? The code kinda puts your cpu usage up to 100%...
talk = 1
_root.attachMovie("empty", "empty", _root.getNextHighestDepth(), {_x:150, _y:200});
empty.onEnterFrame = function() {
if (Key.isDown(Key.SPACE)){
talk += 1
}
if (talk == 1) {
talk1 = _root.attachMovie("part_1_story_1", "part_1_story_1"+_root.getNextHighestDepth(), _root.getNextHighestDepth(), {_x:494.9, _y:672.8});
}
if (talk == 2) {
talk1.removeMovieClip();
talk2 = _root.attachMovie("part_1_story_2", "part_1_story_2"+_root.getNextHighestDepth(), _root.getNextHighestDepth(), {_x:494.9, _y:672.8});
}
if (talk == 3) {
talk2.removeMovieClip();
talk3 = _root.attachMovie("part_1_story_3", "part_1_story_3"+_root.getNextHighestDepth(), _root.getNextHighestDepth(), {_x:494.9, _y:672.8});
}
if (talk == 4) {
talk3.removeMovieClip();
talk4 = _root.attachMovie("part_1_story_4", "part_1_story_4"+_root.getNextHighestDepth(), _root.getNextHighestDepth(), {_x:494.9, _y:672.8});
}
if (talk == 5) {
talk4.removeMovieClip();
talk5 = _root.attachMovie("part_1_story_5", "part_1_story_5"+_root.getNextHighestDepth(), _root.getNextHighestDepth(), {_x:494.9, _y:672.8});
}
if (talk == 6) {
talk5.removeMovieClip();
talk6 = _root.attachMovie("part_1_story_6", "part_1_story_6"+_root.getNextHighestDepth(), _root.getNextHighestDepth(), {_x:494.9, _y:672.8});
}
if (talk == 7) {
talk6.removeMovieClip();
talk7 = _root.attachMovie("part_1_story_7", "part_1_story_7"+_root.getNextHighestDepth(), _root.getNextHighestDepth(), {_x:494.9, _y:672.8});
}
if (talk == 8) {
talk7.removeMovieClip();
talk8 = _root.attachMovie("part_1_story_8", "part_1_story_8"+_root.getNextHighestDepth(), _root.getNextHighestDepth(), {_x:494.9, _y:672.8});
}
if (talk == 9){
gotoAndPlay (2)
}
trace (talk)
}