Click here to Skip to main content
15,895,656 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Odd MFC Dialog Executable Behavior Pin
Code-o-mat8-May-12 10:32
Code-o-mat8-May-12 10:32 
QuestionDiff of image Pin
john56328-May-12 1:06
john56328-May-12 1:06 
GeneralRe: Diff of image Pin
David Crow8-May-12 2:49
David Crow8-May-12 2:49 
QuestionSwitch To Another Doc Template Pin
002comp8-May-12 0:01
002comp8-May-12 0:01 
QuestionNeed help with my jump physics code Pin
Seeker20027-May-12 19:46
Seeker20027-May-12 19:46 
AnswerRe: Need help with my jump physics code Pin
Chuck O'Toole7-May-12 19:55
Chuck O'Toole7-May-12 19:55 
GeneralRe: Need help with my jump physics code Pin
Seeker20027-May-12 21:43
Seeker20027-May-12 21:43 
AnswerRe: Need help with my jump physics code Pin
CPallini8-May-12 0:03
mveCPallini8-May-12 0:03 
If I got you: use a tristate variable instead of a boolean, say jump_state.

C++
enum JumpState
{
  JS_IDLE,
  JS_START,
  JS_JUMPING
};

//..

jump_state = JS_IDLE; // initialization

// ...

// main loop
if (GetAsyncKeyState(VK_UP) == TRUE)
  if (jump_state == JS_IDLE)
    jump_state = JS_START;
else
  if (jump_state == JS_START)
    jump_state == JS_JUMPING;
//...


if ( jump_state == JUMPING)
{
  // here do a step of jumping movement
  if ( landed )
    jump_state == JS_IDLE;
}

Veni, vidi, vici.

GeneralRe: Need help with my jump physics code Pin
Chuck O'Toole8-May-12 3:50
Chuck O'Toole8-May-12 3:50 
GeneralRe: Need help with my jump physics code Pin
CPallini8-May-12 3:52
mveCPallini8-May-12 3:52 
GeneralRe: Need help with my jump physics code Pin
Seeker20029-May-12 21:42
Seeker20029-May-12 21:42 
GeneralRe: Need help with my jump physics code Pin
CPallini9-May-12 21:55
mveCPallini9-May-12 21:55 
Questionallocating object in global storage Pin
ForNow7-May-12 15:21
ForNow7-May-12 15:21 
AnswerRe: allocating object in global storage Pin
Richard MacCutchan7-May-12 21:50
mveRichard MacCutchan7-May-12 21:50 
AnswerRe: allocating object in global storage Pin
ThatsAlok9-May-12 21:17
ThatsAlok9-May-12 21:17 
AnswerRe: allocating object in global storage Pin
Erudite_Eric9-May-12 21:27
Erudite_Eric9-May-12 21:27 
GeneralRe: allocating object in global storage Pin
ForNow10-May-12 2:50
ForNow10-May-12 2:50 
AnswerRe: allocating object in global storage Pin
Chuck O'Toole10-May-12 3:32
Chuck O'Toole10-May-12 3:32 
GeneralRe: allocating object in global storage Pin
Erudite_Eric13-May-12 21:02
Erudite_Eric13-May-12 21:02 
QuestionDigital Library system, Help needed Pin
ShayanTanwir7-May-12 13:32
ShayanTanwir7-May-12 13:32 
AnswerRe: Digital Library system, Help needed Pin
Chris Losinger7-May-12 13:35
professionalChris Losinger7-May-12 13:35 
Questiontry and catch, not sure how to handle catch Pin
jkirkerx7-May-12 10:34
professionaljkirkerx7-May-12 10:34 
AnswerRe: try and catch, not sure how to handle catch Pin
Chuck O'Toole7-May-12 10:45
Chuck O'Toole7-May-12 10:45 
GeneralRe: try and catch, not sure how to handle catch Pin
jkirkerx7-May-12 10:50
professionaljkirkerx7-May-12 10:50 
AnswerRe: try and catch, not sure how to handle catch Pin
Chuck O'Toole7-May-12 12:13
Chuck O'Toole7-May-12 12:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.