Levi, I am greatly looking forward to that.
Thanks!
Oh no it's not, there's just a character in Girly whose thing is to shoot people into space. And I guess she has nice legs.
Don't mind me I just read too many webcomics (:
Ah. I was thinking more along the lines of in the comic book Invincible they sometimes find its easier to throw villains into space rather than deal with the villains evil plot. At one point Invincible says something like "Man, what would us superheroes do without space?".
Currently those couple phrases are just random placeholders. I'm planning to do something a lot more fun with the talking bits once I've got some of the main gameplay in place.
Today I worked mostly on getting some combat/ai infrastructure done.
Room of
dead injured henchmen
For this update, I'll include some code for people who might be interested. Let me stress than my coding skills are pretty sloppy most of the time and I haven't had a ton of experience with python. This is my currently very basic Hero AI code. In this game you don't directly control the 4 heroes, they move around by themselves. Whenever the hero takes a turn, he does the following:
- Checks to see if his target is still alive
- Acquires a target if he currently doesn't have one
- Checks to see if any of his abilities are appropriate to use
- If none of his abilities are useful, he moves towards the opponent
This code can be pretty much just as easily used for enemies as well.
def take_turn(self, map):
done = False
#check to see if target is still valid
if self.target and self.target.ai and self.target.fighter and self.target.ai.side == 'evil' and self.target != self.owner and self.target_recheck > 0:
self.target_recheck -= 1
else:
self.target = None
#acquire target
if self.target == None:
closest = None
for obj in map.objects:
if obj.fighter and obj.ai and obj.ai.side == 'evil' and obj != self.owner:
if closest == None or distance(self.owner.x, self.owner.y, closest.x, closest.y) > distance(self.owner.x, self.owner.y, obj.x, obj.y):
closest = obj
self.target = closest
self.target_recheck = 5 #5 turns till we recheck for a closer target
#check to see if you can use any of your abilities
if self.target:
for skill in self.owner.bio.e_skills:
if skill.in_range(self.owner, self.target):
skill.use(self.owner, self.target)
done = True
break
#No actions? Move towards the target!
if not done and self.target:
if tcod.path_compute(map.path, self.owner.x, self.owner.y, self.target.x, self.target.y):
(dx, dy) = tcod.path_walk(map.path,True) #returns the next x,y, not the direction.
dx -= self.owner.x #turn into a direction
dy -= self.owner.y #turn into a direction
if self.owner.attempt_move(map, dx, dy):
done = True
elif dx == 0 and self.owner.attempt_move(map, dx + 1, dy): #something is in the way, try another direction
done = True
elif dx == 0 and self.owner.attempt_move(map, dx - 1, dy):
done = True
elif dy == 0 and self.owner.attempt_move(map, dx, dy + 1):
done = True
elif dy == 0 and self.owner.attempt_move(map, dx, dy - 1):
done = True
elif self.owner.attempt_move(map, dx, 0):
done = True
elif self.owner.attempt_move(map, 0, dy):
done = True
Two things that currently annoy me the most about python (I'm more from a ruby background) is the lack of a ? : operator and the fact that I have to put "self." in front of all my member variables.
In ruby you just type something like @target, while in python its self.target. Those 4 extra letters of typing are annoying, haha!