How can I let my character fight ???
How can I let my character fight ???
I just use the tutorials to make some demos , but in my project peolpe only can walk , how to program them fight ??
Tell them their Girlfriend is a dog :)
Seriously you need to animate some fighting moves and play them back using your program.
Google for some animamtion tuts
Seriously you need to animate some fighting moves and play them back using your program.
Google for some animamtion tuts
-= Want your C code to control real life robots? www.users.on.net/~symes =-
The simplest fighting, pacman like:
First, make all enemy model move towards player model. Check if enemy's bounding box intersects with player bounding box. If yes, make player loose one life.
go to websites like
www.gamedev.net
www.gametutorials.com
www.gamasutra.com
for more information
First, make all enemy model move towards player model. Check if enemy's bounding box intersects with player bounding box. If yes, make player loose one life.
go to websites like
www.gamedev.net
www.gametutorials.com
www.gamasutra.com
for more information
Tomasz Nowakowski
Openoko - www.openoko.pl
Openoko - www.openoko.pl
-
- Posts: 16
- Joined: Mon Jan 12, 2004 4:31 am
- Location: USA
- Contact:
For very simple fighting, you could start out with something like this and build on it as your combat system gets more complex:
First, make new classes for your player and enemies, probably inheriting from the IAnimatedMesh scene node. Throw in some extra things like hit points, model, and a boolean to tell whether or not the monster is dead.
In your game loop, check the player's keyboard input to see if the attack key is pressed. If it is, then play back the animation frames for the attack animation. Next, check to see if the attack will collide with the monster. Irrlicht has per-poly collision detection, so this shouldn't be too difficult. If the attack collides with the monster, subtract the amount of damage from the monster's total Hit Points, and play the monster's pain animation frames, along with whatever sound effects you want. Once the monster's hit points are <= 0, throw up the boolean declaring that it is dead, play the death animation, and have it give the player points/experience by adding to the total score.
I'm not sure what kind of game you're going for, but this basic guideline can be used for just about any type that involves combat. It would also leave you open to add other enhancements, such as using the particle system to make blood splatter when you strike, etc. you could also have the monster fight back with some simple AI, and use basically the same principles as the monster for player damage and death.
If you want the monster to disappear after death, and maybe to save some memory, just destroy that monster's scene node shortly after it dies. Anyways, with this set of basic guidelines, hopefully you can get it all figured out, and maybe even come up with something even better. Good luck!
First, make new classes for your player and enemies, probably inheriting from the IAnimatedMesh scene node. Throw in some extra things like hit points, model, and a boolean to tell whether or not the monster is dead.
In your game loop, check the player's keyboard input to see if the attack key is pressed. If it is, then play back the animation frames for the attack animation. Next, check to see if the attack will collide with the monster. Irrlicht has per-poly collision detection, so this shouldn't be too difficult. If the attack collides with the monster, subtract the amount of damage from the monster's total Hit Points, and play the monster's pain animation frames, along with whatever sound effects you want. Once the monster's hit points are <= 0, throw up the boolean declaring that it is dead, play the death animation, and have it give the player points/experience by adding to the total score.
I'm not sure what kind of game you're going for, but this basic guideline can be used for just about any type that involves combat. It would also leave you open to add other enhancements, such as using the particle system to make blood splatter when you strike, etc. you could also have the monster fight back with some simple AI, and use basically the same principles as the monster for player damage and death.
If you want the monster to disappear after death, and maybe to save some memory, just destroy that monster's scene node shortly after it dies. Anyways, with this set of basic guidelines, hopefully you can get it all figured out, and maybe even come up with something even better. Good luck!
Honkey Kong
Thank you very much , I'm a beginner . These days I get many help from the forums ,now I will thank every one .
Good Luck
Good Luck