Graphics problems!!!

This is a discussion on Graphics problems!!! within the Game Programming forums, part of the General Programming Boards category; Sorry... I am a very newbie to game programming, and this website so if I say something wrong, please be ...

  1. #1
    Registered User
    Join Date
    Dec 2006
    Posts
    2

    Graphics problems!!!

    Sorry... I am a very newbie to game programming, and this website so if I say something wrong, please be forgivable. I recently try to code the game tankwar and run into one of the graphics problem. The tank that I create move very rigid, not smooth at all. And If I try to make it go smooth, the tank wont ever stop. Here is portion of my code.
    The if else statement below, if I took off the else. The tank wont ever stop but it move quite smooth. If I have the else, the tank stop when I stop pressing the key but it move very rigid. I wrote my program in C using Allegro Library.
    Code:
       if(keypressed()){
        press++;
        getinput();           
      }else{       
        tank[0].speed = 0;
        tank[1].speed = 0;
      }
      clear_keybuf(); //clear the key buffer
      rest(20);
    I also include my codes here. I cant upload my excute file because the website wont allow me.
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    Because you have it making the tank increase in speed as you press forwards, it will gradually become jerkier, to get the same overall speed, you could reduce the distance moved by max speed and then reduce the rest time. Or just have a set speed rather than making it accelerate.

  3. #3
    Registered User
    Join Date
    Dec 2006
    Posts
    2
    Thanks a lot. It look a lot better.
    But I got another question for u. I got a function call checkpath() and clearpath(), those 2 are my collision detection. It detect when the tank hit the object fine, but when 2 tank collide they just go right through. Why is it like that?

  4. #4
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    I can't actually see anything wrong about your code But are you sure you are passing the right values the second time round? Maybe your problem will require the expertise of Bubba.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Turtle Graphics, how does it work?
    By freddyvorhees in forum C++ Programming
    Replies: 15
    Last Post: 08-28-2009, 10:57 AM
  2. No clue how to make a code to solve problems!
    By ctnzn in forum C Programming
    Replies: 8
    Last Post: 10-16-2008, 03:59 AM
  3. C Pointers Problems
    By mhelal in forum C Programming
    Replies: 8
    Last Post: 01-10-2007, 06:35 AM
  4. My graphics library
    By stupid_mutt in forum C Programming
    Replies: 3
    Last Post: 11-26-2001, 06:05 PM
  5. Im a Newbie with a graphics design problem for my simple game
    By Robert_Ingleby in forum C++ Programming
    Replies: 1
    Last Post: 11-23-2001, 06:41 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21