
-----------------------------------
bill_ion_boi
Wed Dec 01, 2004 9:05 pm

Moving object with loops problem
-----------------------------------
Im in the process of creating a game and when i hold the right arrow my object moves but it leaves a trail of past images..Can anyone help?

Input.KeyDown (key)
    if key (KEY_RIGHT_ARROW) then   
        loop
            awidth := awidth + 1
            Pic.ScreenLoad ("carright.bmp", awidth, aheight, picMerge)
            delay (5)
            exit
        end loop
    end if

-----------------------------------
Neo
Wed Dec 01, 2004 9:10 pm


-----------------------------------
You can use cls to clear the screen at the end of your loop and use
setscreen("offscreenonly") at the beginnning and View.Update at the end of your loop to stop flickering.

-----------------------------------
Pinto2
Wed Dec 01, 2004 9:40 pm


-----------------------------------
Just us cls just before end loop, and your set to go

-----------------------------------
bill_ion_boi
Wed Dec 01, 2004 10:28 pm


-----------------------------------
im sorry
i forgot to mention i have a background and thus cls would well u know...

-----------------------------------
bill_ion_boi
Thu Dec 02, 2004 3:30 pm


-----------------------------------
please help

-----------------------------------
Cervantes
Thu Dec 02, 2004 4:26 pm


-----------------------------------
Have patience.  There is no need to spam your own thread, as Asian would say.  
I assume you are looking for a way to erase and redraw just the foreground image, not the background.  I have had no experience with Sprites, but I do know that Turing 4.x does not include sprites.  You can try to use 
Input.KeyDown (key)
if key (KEY_RIGHT_ARROW) then
loop
awidth := awidth + 1
Pic.ScreenLoad ("carright.bmp", awidth, aheight, picMerge)
delay (5)
exit
end loop
end if

There is no need for the loop since it is going to exit the first time through no matter what (your exit statement has no condition).  You can save three lines by eliminating the loop, exit, and end loop lines.

Finally, please use [ code] [ /code] tags when posting code.

-----------------------------------
SuperGenius
Thu Dec 02, 2004 5:36 pm


-----------------------------------
make sure that you read up fully on DanSprites before you use them, because there were some issues last time I checked.
