[Solved] Attacking and methods to do it.

Started by thehivetyrant, Wed 24/02/2010 10:54:02

Previous topic - Next topic

thehivetyrant

Hi there,
            I've made 2 charcaters thus far, the playable character Grim and an enemy Zombie.

I have made the Zombie charcater follow the Grim character as a vague AI, and when he collides with Grim his animation changes to attack (melee).

I want it so that when the charcaters touch nothing happens but if they touch while he is in this specific attack animation then something happens.
Is there a way to specify a collision with a certain animation?

---------------------------If above is possible there's no reason to read below-------------------

If this is not possible i thought that i could emulate it so that whenever Zombie enters the attack animation, that he fires a bullet (invisable) which travels a tiny distance (Melee Attack distance) And when the bullet collides with Grim the event happens.

I scouted around and am currently trying to do this by creating a character cBullet01 (invisable) then Making it follow Zombie (using FOLLOW_EXACTLY).

This results in triggering the health loss event when Grim is inside Zombie (since the bullet is just 1 pixel and is in the centre of the zombie)

I tried to use cBullet01.move command to move it x a few pixels when he is in attacking animation, but it doesnt seem to move. (I expect because its allready on FOLLOW_EXACTLY.

Sorry about how large this post is and no code, i'll post some if needed when i get home.

Any help would be appreciated. Thanks
Matt.

Matti

#1
Just check the view and frame of the zombie in addition to the collision.

Pseudocode:

Code: ags

if (collision* && cZombie.View==bla && cZombie.Frame==bla){
  // Character dies or whatever
}


* You can manually check the coordinates of both characters or use character.IsCollidingWithChar.. or SSH's pixelperfect collision detection module.

Quote
Any help would be appreciated. Thanks
Matt.

I appreciate being of any help.
Matti.

Khris

thehivetyrant, please make sure you've exhausted the forum search and other available resources before opening a thread here.

SMF spam blocked by CleanTalk