Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2003
    Posts
    54

    Problem with C++ Evil Monkeys Vol. 5 Video 5

    First: At 15:40 in the 5th video these two functions:
    player->SetLevel(level);
    player->update();

    replace
    level->setPlayerStart();
    level->update();.

    They are either done offscreen or I've missed them. Does anyone know where I can find them?

    Second:

    If I comment out "| 32" in the "OnKey" function everything compiles but I can't move anymore. If I don't the game ends the moment I press any of these keys "a,w,s,d". Other keys do nothing.

    Third:

    I tried to reverse "updateView" first and leave "startNewLevel" and so on in. Didn't work.
    Then I tried to reverse "startNewLevel" and put its content inside "OnNew". Didn't work.
    So now I am back to the start of video 5 with a lot of unused STATES and functions.
    But commenting out "|32" still makes the character unmovable. I thought that was just added to avoid problems with "W" and "w", or not???

    IDE is Code::Blocks.
    Last edited by Kashrlyyk; 12-14-2010 at 09:21 AM.

  2. #2
    Join Date
    Feb 2003
    Posts
    54
    According to the debugger it is an Segmentation Fault.
    Program received signal SIGSEGV, Segmentation fault.
    At sprite.cpp:105

    Which is the "isValidMove" Function and line 105 is: if(level->level[xpos][ypos]!= TILE_WALL)

    Any ideas?

  3. #3
    Join Date
    Oct 2009
    Location
    The In Between. US
    Posts
    2,030
    have you read over the revisions here?
    elevating to new levels of knowledge (that's the plan at least )

  4. #4
    Join Date
    Feb 2003
    Posts
    54
    Thank you for that. I've added the VTM 3 stuff from this post : http://www.3dbuzz.com/vbforum/showth...129#post994129
    And now it works. Thanks again.

  5. #5
    Join Date
    Feb 2003
    Posts
    54
    The trouble continues: Sometimes the game stops responding when choosing "New Level" after it started. Closing the program and starting it again, "solves" that problem. But it always stops responding when I reach Level 3.
    It is not the number of enemies or the size of the level that causes the problem.
    The level is drawn and the player is added and moved to the start position, but no enemies are there.


    EDIT:
    It is "CurrentLevel++;" that causes the problem. If "CurrentLevel" reaches the value 3 the game freezes. If that line in updateGame() is commented out the game runs and only randomly freezes.
    Last edited by Kashrlyyk; 12-17-2010 at 10:46 AM.

  6. #6
    Join Date
    Feb 2003
    Posts
    54
    I´ve added "mTimer->Stop()" at the start of startNewLevel and a "mTimer->Start(UPDATE_TIME)" at the end. Programm rarely freeze anymore.

    I removed "CurrentLevel" variable, because the game always freezes if it has value 3. Does anyone has any idea how that can be?

    Any help is appreciated.
    Last edited by Kashrlyyk; 12-17-2010 at 11:08 AM.

  7. #7
    Join Date
    Feb 2003
    Posts
    54
    Found the error: Wrong Brackets in addEnemies function.

    Was " int(float(( " should have been " int((float( ".

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •