How can I let my character fight ???

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
jl0206
Posts: 55
Joined: Mon Jun 07, 2004 4:56 am

How can I let my character fight ???

Post by jl0206 »

I just use the tutorials to make some demos , but in my project peolpe only can walk , how to program them fight ??
dingo
Posts: 95
Joined: Tue Mar 09, 2004 5:02 am
Location: Brisbane, Australia
Contact:

Post by dingo »

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
-= Want your C code to control real life robots? www.users.on.net/~symes =-
jl0206
Posts: 55
Joined: Mon Jun 07, 2004 4:56 am

Post by jl0206 »

:D ,true.I think they are very rageful.
Seriously , if some guys can give me a example ?? I need a example with irrlicht .
jl0206
Posts: 55
Joined: Mon Jun 07, 2004 4:56 am

Post by jl0206 »

I mean that I can make charector move . but I don't know how the enemy is hurt and how can I program to let the program know the charactor is injured or dead . first I think that I have to get the position of the enemy and I have to check if the enemy is been beat . I'm puzzled .
warui
Posts: 232
Joined: Wed Apr 14, 2004 12:06 pm
Location: Lodz, Poland
Contact:

Post by warui »

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
Tomasz Nowakowski
Openoko - www.openoko.pl
jl0206
Posts: 55
Joined: Mon Jun 07, 2004 4:56 am

Post by jl0206 »

Thanks very much , I will try.
Honkey Kong
Posts: 16
Joined: Mon Jan 12, 2004 4:31 am
Location: USA
Contact:

Post by Honkey Kong »

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! ;)
Image
jl0206
Posts: 55
Joined: Mon Jun 07, 2004 4:56 am

Honkey Kong

Post by jl0206 »

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
Post Reply