This one is a real mystery to me. I'm working on a turn-based RPG, and it works somewhat like this:
1. The BATTLE controller object activates a character,
2. The character makes the choices required (what kind of maneuver, the various choices within the maneuver).
3. Selects the target.
Okay, so I got that working just fine... now here's the problem.
4. The character who is activated moves to a predefined location on the screen based on the type of attack (e.g., in front of the enemy he punches) and then performs his attack (grunt), and then moves back to his starting position.
NOTE: All this is directed from the DRAWING controller object.
5. The battle engine is reset (or the BATTLE controller object).
Thing is, my code isn't working. It freezes up instantly, with no error messages, NOTHING!!! Here's the code:
defender = obj_attack.target;
attacker = global.playerparty[global.current_player];
type = obj_attack.type;
targets = obj_attack.targets;
//after gaining all useful data, destroy the object
with(obj_attack)instance_destroy();
dist_away = 30
back_x = attacker.x;
back_y = attacker.y;
if(type == 0)
{
do
{
with(attacker)
{
move_towards_point(obj_draw_battle.defender.x-obj_draw_battle.dist_away, obj_draw_battle.defender.y, 6);
}
}
until(point_distance(attacker.x, attacker.y, defender.x, defender.y) <= 6)
attacker.x = defender.x-dist_away;
attacker.y = defender.y;
effect_create_above(ef_cloud, 20,20, 2, c_red);
while(point_distance(attacker.x, attacker.y, back_x, back_y) > 7)
{
with(attacker)
{
move_towards_point(obj_draw_battle.back_x, obj_draw_battle.back_y, 6);
}
}
attacker.x = back_x;
attacker.y = back_y;
}
obj_battle_ctrl.count_down_start = room_speed*0.5;
obj_battle_ctrl.battle_on = false;
effect_create_above(ef_firework,100,100,2,c_black);
instance_destroy();
P.S. This code is activated in the Create Event in the DRAWING controller object
I'm suspecting that the while statement is to blame, but who knows?...
Regards,
Cyber-seeker











