Hi Brandon,

If you don't have a background, you will first need to copy over the
previous position.

Your event loop may end up like this

On Move event:
        EraseSprite(x,y)  //copies a solid rectangle, colored the same
                        //as the background to the current location of
                        // the sprite
        x + new value    //calculate new position
        y + new value
        DrawSprite(x,y)  //redraw new sprite

While this is a good way to familiarize yourself with the drawing
techniques, keep in mind, the OS bitmap functions are very slow and
the above technique will cause the screen to flicker.

After you finish this excercise, you may want to research double
buffering.


For a bit of extra help, here is a simple hard key manager:

UInt32 Keys;
Keys = KeyCurrentState();

if((Keys & keyBitHard2) && (Keys & keyBitPageUp))
{
        ... good way to detect simultaneous key presses

Cheers,
Jeremy Evans


On Sat, 28 Dec 2002 18:03:51 -0500, [EMAIL PROTECTED] wrote:

>
>      Hey guys!  I am using Code Warrior 7.  I am trying  make a Palm Pong clone.
>
>I have my sprites running but when ever one moves,  the place at which they were,  
>you can see that still plus where they are now.  Understand what I am saying?
>I need to figure out how to erase the stop it was just at so that there is only one 
>picture of the ball at a time.  I tried getting a rectangle to erase the last stop 
>but that doesn't work,  or atleast the way I did it.
>
>
>// The Ball Rectangle
>RctSetRectangle (&BallRect,Ballx, Bally, Ball->width, Ball->height);
>do {
>if (hit==0){
>if(Ballx<148){Ballx++;Bally++;}}
>if (hit==1){
>if(Ballx<148){Ballx--;Bally--;}}
>if(Ballx>=147){hit=1;}
>if(Ballx<8){hit=0;}
>if(KeyCurrentState()==keyBitHard2){Checkit=true;}
>if(KeyCurrentState()>0){
>if(KeyCurrentState()==keyBitPageUp){delay++;if(delay>5){y--;delay=0;}}
>if(KeyCurrentState()==keyBitPageDown){delay++;if(delay>5){y++;delay=0;}}
>if(KeyCurrentState()==NULL){y=y;}}
>WinDrawBitmap(Bar1,1,y);
>WinDrawBitmap(Bar2,148,yy);
>
>// The Ball 
>WinDrawBitmap(Ball,Ballx,Bally);
>WinCopyRectangle(oldDrawBall,offscreenBall,&BallRect,Ballx,Bally,winErase);
>
>
>Thanks in Advance
>
>-- Brandon
>www.DreamCodersRealm.com
>
>


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to