PDA

View Full Version : Simple down-scrolling code needed!



Shadowblind
June 1st, 2007, 06:10
I need a code so that when you press down on the D-Pad the image scrolls downwards, and up being vice versa. Help :(

-Xandu-
June 1st, 2007, 19:41
You can do:

img = {}
img = {x = 200, y = 20, img = YOURIMAGE }


then,

if Controls.read():down then
img.y = img.y +2
end

if Controls.read():up then
img.y = img.y -2
end

screen:blit(img.x,img.y,img.img)

Freshmilk
August 7th, 2007, 12:51
Ummm, i'm gussing its a full screen image, xandu. Why blit it at 200 on the x axis...?
Meh... either way, that would work.

-Xandu-
August 7th, 2007, 12:57
It was just an example plus, it's not hard to change the values you know ;).