How would you handle this? (2 characters fighting!)

Here’s a problem I’m working on and thought I’d ask how other folks would handle it.

Two characters walk up to each other. On collision they stop moving. (This bit is fairly straight forward to do).

They then start to deal damage to each other. So each character is dealing and receiving damage. When one actors health reaches 0 - he dies.

One method I thought of was to fire invisible bullets out from each actor as bullets are pretty easy to do and test for. How would you do it? :slight_smile:

Thanks

Tom [import]uid: 55068 topic_id: 10877 reply_id: 310877[/import]

@tom,
have you tried the Dice and Paper method? That was used in RPG games in the Golden Days?

so have a loop till either of the health reaches Zero, then draw up three Random Numbers, the first two decide which one gets to make an attack, the third, how much the attack would take away from the health.

hope you get that,

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 10877 reply_id: 39539[/import]

Hmm, this is proving trickier than I thought.

I can make the characters meet, and stop moving but I can’t figure out how to make them keep attacking. I can add an event listener but it only fires once on the collision.

EDIT: hang on, this might do it…

[lua]local function printSomething()
print(“HIT!”);
end
local function someCollision( self, event )

if(event.other.type == “enemy”) then

– stop moving
transition.cancel(self.heroMove);

– attack!
timer.performWithDelay(1000,printSomething,10)

end
end[/lua] [import]uid: 55068 topic_id: 10877 reply_id: 39618[/import]