Fighting Game

Posted By: Comatose

Fighting Game - 01/02/09 05:32

Hi all,

I'm completely new to this program but not to programming itself. A few years ago I was programming a little in C++ but now I stick mostly to php for my website.

I am going through the workshop tutorials (I have not gotten very far yet since I have only just started) but I was wondering what the best route would be to make a fighting game similar to the original Mortal Kombat game. Essentially what I'm looking for is a 2D game with 3D characters (if that makes sense).

Any help would be greatly appreciated. Thank you.
Posted By: lostclimate

Re: Fighting Game - 01/02/09 07:03

make it so your characters only walk on two axis' and keep track of what animation each player is doing, if an animation is an attack and the others isnt a block, then play a hit animation and take away health.
Posted By: Comatose

Re: Fighting Game - 01/02/09 08:17

Thanks.

How do I make the characters move with each key press rather than just moving them after hitting it once? I don't seem to be able to find that in the workshop.

And how would I load different animations for each keypress (move, attack, jump, et cetera)? If something similar is in the workshops or a tutorial, could you point me to it?

Thanks again and forgive me for being so n00bish. :P
Posted By: lostclimate

Re: Fighting Game - 01/02/09 13:17

its fine, just look up the commands c_move, and the variables for key_1, key_2, etc.....
Posted By: Comatose

Re: Fighting Game - 01/02/09 19:58

Thanks, I found the c_move command in the workshop but it seems to only deal with 3D environments. Since I just want 2D movement what do I do?

I can get the object I want to move onto the level but when I do anything with the c_move commands it doesn't work right at all. I tried just copying the code from the workshop example (the ball game) and replacing the ball with what I wanted to move and it worked a little, however it just caused my object to go off the level and get stuck.

When I tried to tweak it to not move like a ball (because the image I was moving was rotating like the ball in the example) it didn't move at all.

I just want the bloody thing to move left, right and jump when I press certain keys, is it really this difficult or am I missing something very simple?

EDIT: Ok, I figured this out. Now I want to add a sound when I press a key combination. For example, I want to press the buttons for down, back, and let's say 'a' and I want it to play a sound. I found threads and looked in the templates to find how to do this but it's not working for me. I even set it so that it would only take one button press just to see if I could get it to work in an incredibly simple way.

This is how I have it declared:
SOUND wakeupfever = "wakeupfever.wav"; <--everything I've seen has the file declared like this: SOUND wakeupfever = <wakeupfever.wav>; but the program won't compile if i do this.

I have the function called like this:
function wakeupfever();{

if((key_cud == 1)) {
wait(60);
ent_playsound(my,wakeupfever,200);
}
}
Keep in mind that I got this information from the template and looking on the forum and everything was for a 3D game, is it different for 2D?

Thanks for all the help.
Posted By: Pappenheimer

Re: Fighting Game - 01/02/09 22:40

What if you use a different name for the function and the sound?
And why do you use a wait(60) instead of a simple wait(1)?
Posted By: Comatose

Re: Fighting Game - 01/02/09 22:48

the wait(60) was there when i copied, i think.

changing the names didn't seem to make a difference. I have to be missing something simple.
Posted By: Anonymous

Re: Fighting Game - 01/02/09 23:15

the name of the sound and the name of the function have not to be the same

SOUND wakeupfever_snd = "wakeupfever.wav";

function wakeupfever();
{
if((key_cud == 1)) {
wait(60);
ent_playsound(my,wakeupfever_snd,200);
}
}
Posted By: Comatose

Re: Fighting Game - 01/02/09 23:28

Still not working. Here is all the code I've put together so far:

#include <acknex.h>
#include <default.c>


BMAP* backdrop_jpg = "stage1.jpg";
BMAP* player_pcx = "kiva3.pcx";
SOUND wakeupfever_snd = "wakeupfever.wav";

PANEL* backdrop =
{
pos_x = 0;
pos_y = 0;
layer = 0;
bmap = backdrop_jpg;
flags = VISIBLE;
}

PANEL* player =
{
pos_x = 104;
pos_y = 224;
layer = 1;
bmap = player_pcx;
flags = OVERLAY | VISIBLE;
}


function main()
{
video_mode = 6;

while(1)
{
if(key_cul) { player.pos_x = player.pos_x-1; }
if(key_cur) { player.pos_x = player.pos_x+1; }

wait(-0.01);
}

}

function finisher();{

if((key_cud == 1)) {
wait(1);
ent_playsound(my,wakeupfever_snd,200);
}
}

Maybe the error is somewhere other than the sound sections.
Posted By: Pappenheimer

Re: Fighting Game - 01/03/09 03:08

In your code the function finisher is never been called.
Place 'finisher();' in the main, for instance;
Posted By: Comatose

Re: Fighting Game - 01/03/09 03:34

ok did that, still nothing.

could my problem just be something like i'm missing a dll or something to play the sound? in my searching through the forums i've found that playing mp3 files requires a plugin or something, do i need anything special for wav files?
Posted By: Pappenheimer

Re: Fighting Game - 01/03/09 03:40

Sorry, you have to place it within the while loop, because the engine has to control each frame whether you are hitting the key or not.
Put in the brackets of the if-condition the following to avoid that the sound will start several times while your finger is still on the key:

while(key_cud == 1) {wait(1);}

You still have to learn very much, you have to look into the manual again and again to get an idea how each detail is working.
And, study also the articles of the issues of the AUM Magazine.
Posted By: foxter888

Re: Fighting Game - 04/01/09 18:29

i saw the code for the fighting game you posted and you are missing an " = " sing like

if (on_cul == 1){ " code to move left " then -= 1}
you just wrote the code with only a " - " sign...
i'm trying to get a tutorial for a fighting game too I just don't know how to code around but at least I know most of the sintax..
© 2024 lite-C Forums