Thread: moving a bitmap, fast and smooth

  1. #1
    Registered User
    Join Date
    May 2002
    Posts
    33

    moving a bitmap, fast and smooth

    hi,

    I am having major problems moving a simple bitmap across the screen fast and smooth. I think it has to do with timing but everything i try does not seem to work. I have read tutorials and searched message boards and still can't figure it out. I'm experiemnting with SDL but i don't believe its a problem with SDL. I have attached my code to demonstrate what i can't do!! lol

    I want it to move at 1 pixel at a time to keep it smooth, but i would like it to move acroos the screen in like acouple of seconds. the only way i seem to be able to get it moving fast is to increase the pixels by 5 at a time, not 1. But this is way too jerky for my liking, I would like it smooth like most 2d games are!

    Any help you can give would be very much appreciatted.

    Werdy666

  2. #2
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,263
    two things,

    one use an if statement to make sure it moves so far so fast,

    like

    if(gettime() > timetest)
    move;

    this tries to make it time based.

    but then what if the system hitches and two timetests would have passed by the time it gets to this point?
    what then?
    move twice as much? or do a standard move and act like nothing happened? some other solution?

    i leave that to you.

    two im gonna assume bliting is the same as rasterizing, which IS SLOW!!! it is the one of the least accellerated things on most cards. so, what you will probably end up doing is drawing the 2d images on polygons as textures instead, this will be considerably faster.
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

Popular pages Recent additions subscribe to a feed