Hi,
Im trying to learn DBP and started with 2D, my overall idea is a top view Alien Breed type game, but I cant run before walking, so Ive started trying to learn animations,
Please check out my code:
SET DISPLAY MODE 640,480,16
SYNC RATE 60
sync on
create animated sprite 1, "media\pac-man.png", 2,4,1
x=200
do
sprite 1, x, 200, 1
sync
ink rgb(rnd(255),rnd(255),rnd(255)),0
text 10,10,"Left / Right Arrows to Move"
ink rgb(255,255,255),0
text 10,25, "X: " + str$(x)
if rightkey()=1 `and leftkey()=0
play sprite 1, 1, 2, 100
x=x+5
endif
if leftkey()=1 `and rightkey()=0
play sprite 1, 5,6, 100
x=x-5
endif
if x <=10 then x=10
if x >=600 then x=600
loop
end
Im using the pac man Image from the tutorial on this site..
the frames are :
12
34
56
78
I think this is how DB reads the image, so Moving right is 1,2 and the moving left is 5,6, but when I move right, then left, the anim loops through 3,4,
anyone know what Ive dont wrong ?