The Scarlet Twizby
06-09-2008, 11:51 PM
I am currently working on two games, one similar to the Super Smash Bros series made by Nintendo and the other similar to the Pokemon series from the same company. When I have problems with one I work on the other until I figure out how to fix them usually, but now I have problems in both. I am, admittedly, as far as I know, a complete novice as programing goes, though I can improvise in a pinch, and have absolutely no idea of what I am doing most of the time. In any case, the problems I am currently having are:
In the SSB game, I am using a mask to determine whether or not the player's attack hits the opponent, and I only want it to hit over a certain range. This makes it incredibly difficult to use ground-based attacks, as hittests only work if the mask is touching the center of the opponent movie clip. The relevent code is below.
onClipEvent (enterFrame) {
if (_root.player.direct == true) {
direct = 1;//right
} else {
direct = -1;//left
}
if (_root.player.action != 2 && _root.player.action != 6 && _root.player.action != 7) {//the player is not attacking (there are three ways to attack, and thus three actions corresponding to attack. normal, special, and powerful)
_y = _root.player._y;
_root.player.hit = false;//the 'hit' variable determines whether or not the player has actually hit with the attack, or is just running through the animation for the attack.
_x = _root.player._x;
} else if (_root.player.action == 2) {
_y = _root.player._y+_root.player.atkrangey[_root.player.attack - 1];//the range arrays are composed as follows:[center point of where the mask should be for attack 1, for attack 2, 3, 4, range of attack 1 / 2, of attack 2 / 2, 3/2, 4/2]. this means that if the range of attack 1 = 20 and the starting point is 20, the mask would start at 20 pixels below the character and spread out 20 up and down. the same goes for all the other ranges.
_x = _root.player._x+_root.player.atkrangex[_root.player.attack - 1]*direct - 10;
_height = _root.player.atkrangey[_root.player.attack+3]*2;
_width = _root.player.atkrangex[_root.player.attack+3]*2;
} else if (_root.player.action == 6) {
_y = _root.player._y+_root.player.specrangey[_root.player.attack - 1];
_x = _root.player._x+_root.player.specrangex[_root.player.attack - 1]*direct - 20;
_height = _root.player.specrangey[_root.player.attack+3]*2;
_width = _root.player.specrangex[_root.player.attack+3]*2;
} else if (_root.player.action == 7) {
_y = _root.player._y+_root.player.prangey[_root.player.attack - 1];
_x = _root.player._x+_root.player.prangex[_root.player.attack - 1];
_height = _root.player.prangey[_root.player.attack+3]*2;
_width = _root.player.prangex[_root.player.attack+3]*2;
}
}
For the pokemon-esque one,
After creating a new character, the screen is supposed to change to the walkaround map. the only problem is that the movie won't play once it changes. relevent code is below.
on(release){ //attatched to the 'new character' button.
_root.char = new Character (player_txt.text, password_txt.text, gender)
_root.gotoAndPlay("walkaround map");
}
_root.onEnterFrame = function(){ //frame 'walkaround map'
trace(k) // k is undefined. when I play this movie, k is not traced.
player._x = _root.char._xcoord * 16
player._y = _root.char._ycoord * 16
}
In the SSB game, I am using a mask to determine whether or not the player's attack hits the opponent, and I only want it to hit over a certain range. This makes it incredibly difficult to use ground-based attacks, as hittests only work if the mask is touching the center of the opponent movie clip. The relevent code is below.
onClipEvent (enterFrame) {
if (_root.player.direct == true) {
direct = 1;//right
} else {
direct = -1;//left
}
if (_root.player.action != 2 && _root.player.action != 6 && _root.player.action != 7) {//the player is not attacking (there are three ways to attack, and thus three actions corresponding to attack. normal, special, and powerful)
_y = _root.player._y;
_root.player.hit = false;//the 'hit' variable determines whether or not the player has actually hit with the attack, or is just running through the animation for the attack.
_x = _root.player._x;
} else if (_root.player.action == 2) {
_y = _root.player._y+_root.player.atkrangey[_root.player.attack - 1];//the range arrays are composed as follows:[center point of where the mask should be for attack 1, for attack 2, 3, 4, range of attack 1 / 2, of attack 2 / 2, 3/2, 4/2]. this means that if the range of attack 1 = 20 and the starting point is 20, the mask would start at 20 pixels below the character and spread out 20 up and down. the same goes for all the other ranges.
_x = _root.player._x+_root.player.atkrangex[_root.player.attack - 1]*direct - 10;
_height = _root.player.atkrangey[_root.player.attack+3]*2;
_width = _root.player.atkrangex[_root.player.attack+3]*2;
} else if (_root.player.action == 6) {
_y = _root.player._y+_root.player.specrangey[_root.player.attack - 1];
_x = _root.player._x+_root.player.specrangex[_root.player.attack - 1]*direct - 20;
_height = _root.player.specrangey[_root.player.attack+3]*2;
_width = _root.player.specrangex[_root.player.attack+3]*2;
} else if (_root.player.action == 7) {
_y = _root.player._y+_root.player.prangey[_root.player.attack - 1];
_x = _root.player._x+_root.player.prangex[_root.player.attack - 1];
_height = _root.player.prangey[_root.player.attack+3]*2;
_width = _root.player.prangex[_root.player.attack+3]*2;
}
}
For the pokemon-esque one,
After creating a new character, the screen is supposed to change to the walkaround map. the only problem is that the movie won't play once it changes. relevent code is below.
on(release){ //attatched to the 'new character' button.
_root.char = new Character (player_txt.text, password_txt.text, gender)
_root.gotoAndPlay("walkaround map");
}
_root.onEnterFrame = function(){ //frame 'walkaround map'
trace(k) // k is undefined. when I play this movie, k is not traced.
player._x = _root.char._xcoord * 16
player._y = _root.char._ycoord * 16
}