Fire Wizzrobe
03-08-2007, 10:04 PM
#Vacuum Prototype
def dist(x1, y1, x2, y2):
return Sqrt((x1 - x2)**2 + (y1 - y2)**2)
if Screen->NumNCPs == 0:
Quit()
effect_counter = 0
while effect_counter >= 3: #3 tics for smoother movement?
for (i = 0; i == Screen->NumNCPs; i++):
current_enemy = Screen->LoadNCP(i)
if dist(Link->X, Link->Y, current_enemy->X, current_enemy_>Y) < 17:
if Link->X > current_enemy->X
current_enemy->X -= 2
elif Link->X < current_enemy->X: #"elif" means "else if" in you didn't know
current_enemy->X += 2
elif Link->X == current_enemy->X:
Quit()
if Link->Y > current_enemy->Y:
current_enemy->Y -= 2
elif Link->Y < current_enemy->Y:
current_enemy->X += 2
elif Link->Y == current_enemy->Y:
Quit()
effect counter += 1
This is a enemy vacuum script prototype in Python format. Is there anything wrong with it or unnecessary? :)
def dist(x1, y1, x2, y2):
return Sqrt((x1 - x2)**2 + (y1 - y2)**2)
if Screen->NumNCPs == 0:
Quit()
effect_counter = 0
while effect_counter >= 3: #3 tics for smoother movement?
for (i = 0; i == Screen->NumNCPs; i++):
current_enemy = Screen->LoadNCP(i)
if dist(Link->X, Link->Y, current_enemy->X, current_enemy_>Y) < 17:
if Link->X > current_enemy->X
current_enemy->X -= 2
elif Link->X < current_enemy->X: #"elif" means "else if" in you didn't know
current_enemy->X += 2
elif Link->X == current_enemy->X:
Quit()
if Link->Y > current_enemy->Y:
current_enemy->Y -= 2
elif Link->Y < current_enemy->Y:
current_enemy->X += 2
elif Link->Y == current_enemy->Y:
Quit()
effect counter += 1
This is a enemy vacuum script prototype in Python format. Is there anything wrong with it or unnecessary? :)