Hi,
I have this code to animate and move left/right a little character made of 10 JPG files. Here is the code :
rem Set screen and display
sync on
sync rate 40
set display mode 1024,768,32
rem Load images
load image "01.jpg",1,1
load image "02.jpg",2,1
load image "03.jpg",3,1
load image "04.jpg",4,1
load image "05.jpg",5,1
load image "06.jpg",6,1
load image "07.jpg",7,1
load image "08.jpg",8,1
load image "09.jpg",9,1
load image "10.jpg",10,1
rem Declare global var
global posX
global posY
global speedX
global currentAnim
rem Assign values
posX=512
posY=600
speedX=0
currentAnim=1
sprite 1,posx,posy,currentAnim
rem Main loop
do
cls
MoveCharacter()
sync
loop
function MoveCharacter()
rem move to the right
if rightkey()=1 and posX < 1000
if currentAnim <= 9
currentAnim=currentAnim+1
else
currentAnim=1
endif
if sprite mirrored(1)=1 then mirror sprite 1
posX=posX+10
endif
rem move to the left
if leftkey()=1 and posX > 24
if currentAnim <= 9
currentAnim = currentAnim+1
else
currentAnim=1
endif
if sprite mirrored(1) = 0 then mirror sprite 1
posX=posX-10
endif
rem Draw sprite
sprite 1,posX,posY,currentAnim
endfunction
When I run it and move the character, the image of him running is very "blurry". It seems out of focus when the anim runs.
If you wanna test for yourself (english not being my mothertongue, I have problems explaining my question
), you can download the 10 JPG there (25 KB) :
http://www.inlogicstudio.com/divers/runner.zip
Thanx for your help !
You have failed me for the last time