Jump to content

how to end a game? [c++]


cassius
 Share

Recommended Posts

When my main character is killed ( in sword fight) I need to end the game. Currently I have Delay 5000 followed by return false but for some reason the "die" animation only gets half way thru before the program ends.

n there is also a scream sound effect which sometimes occurs but at other times does not.

How should I smoothly end the game?

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

Link to comment
Share on other sites

Ok exit(0) replaced return false. This time the sound effect worked and the attack anim stopped but program ended before die anim could play.Below is the "die" anim code

 

void kill_jane()

{

if (jane.frame < jane.animlength)

{

jane.model->SetAnimationFrame(jane.frame, 1, jane.seq);

jane.frame = jane.frame + 0.5;

}

if (jane.frame >= jane.animlength)

{

 

scream->Play();

jane.alive = false;

}

}

EDIT :jane.fame starts at 0 and counts up to animlength ie 66 frames

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...