Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

Kain5056

Member Since 22 Dec 2012
Offline Last Active Today, 03:28 AM
-----

#5029344 Second entity moves really slow!

Posted by Kain5056 on 06 February 2013 - 03:40 AM

It works perfectly! Thank you so much for the help! smile.png

 

Here is the new game loop:

 

while( quit == false )
    {
        Uint32 ticks = delta.get_ticks();

        scrolling_background();
        if( tileedit ) editor_show( current_tile );

        while( SDL_PollEvent( &event ) )
        {
            if( event.type == SDL_KEYDOWN )
            {
                if( event.key.keysym.sym == SDLK_t ) tileedit = !tileedit;
            }

            if( event.type == SDL_QUIT ) quit = true;

            if( tileedit == false ) player1.control();
            else if( tileedit ) editor_control( tiles );
        }

        if( tileedit == false )
        {
            player1.jump();
            scrolling_background();
            player1.move( ticks , tiles );
            enemy1.move_enemy( ticks , tiles );
            player1.player_camera();
        }
        else editor_camera();

        for( int t = 0 ; t < TOTAL_TILES ; t++ )
        {
            tiles[t]->show();
        }

        if( tileedit == false ) player1.show();

        enemy1.show();

        if( SDL_Flip( screen ) == -1 ) return 5;
    }

 

 

Thanks again. smile.png




PARTNERS