[SDL] Problem moving a blitted image,

Stefan Hendriks stefanhen83 at gmail.com
Tue Mar 6 01:00:09 PST 2007


   if(destination.x <= 0)
                                 destination.x++;
                           else
                                 destination.x--;

This looks like you try to increase the destination only when its
lower or equal to zero. I assume you try to move to the left.

Although this will not fix your problem, it is already mentioned btw,
i think you can better rewrite the lines in a more logical term. What
i mean, is that is clear what the code should DO. Instead of telling
it should 'correct' itself. Ie, ONLY move to the left when you may do
that, instead of saying "move to the left, but correct it when you
move to far to the left".

In short:

// Only move to the left when we can move to the left..
if (destination.x > 0)
    destination.x--;

My 2 cents.

Hey btw, i am new too.

-Stefan

2007/3/6, Lamonte(Scheols/Demonic) <scheols at gmail.com>:
> actually:
>                           if(destination.x <= 0)
>                                 destination.x++;
>                           else
>                                 destination.x--;
>
> will keep my image to stay inside the window making it stoping it self
> from leaving the window so if I tried to go beyond 0(as in -1,-2,-3)
> in the coordinates it will make my image stop.
>
> I didn't know Jeff said anything because I was sleep and didn't reat this email
>
> On 3/5/07, Ryan C. Gordon <icculus at icculus.org> wrote:
> >

<snip>
-- 
Stefan Hendriks
-----------------------
http://www.fundynamic.nl


More information about the SDL mailing list