image looping

Discuss using and improving Lua and the Lua Player specific to the PSP.

Moderators: Shine, Insert_witty_name

Post Reply
wekilledbambi03
Posts: 31
Joined: Sat Oct 15, 2005 10:56 am

image looping

Post by wekilledbambi03 »

i want the same image to be able to scroll accross the screen. currently i have it so that one image is is put at 0,0 then one at 480, 0 then 960, 0 and so on. is there an easier way then typing it all out? that way it could be infinite.
MikeHaggar
Posts: 116
Joined: Mon Jul 18, 2005 2:20 am

Post by MikeHaggar »

I did something like this in LUACave.

Use this:

Code: Select all

screen:blit(0-math.mod(frame,480),0,action)
screen:blit(480-math.mod(frame,480),0,action)
and in your game loop:

Code: Select all

frame=frame+1


or you can also do:

Code: Select all

screen:blit(0-frame,0,action)
screen:blit(480-frame,0,action)
and in the game loop:

Code: Select all

frame=math.mod(frame+1,480)
Post Reply