Level Drawing

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

Moderators: Shine, Insert_witty_name

Post Reply
wild8900
Posts: 3
Joined: Wed Mar 28, 2007 12:08 pm

Level Drawing

Post by wild8900 »

How do you blit images onto a blank jpeg? Or maybe I have it wrong, Im just trieing to find something faster than blitting so many tiles. Are there any better ways? (I made a tile system)
cools
Posts: 46
Joined: Sat Mar 04, 2006 12:57 pm

Post by cools »

It wouldnt be a blank jpeg. You would need to blit to a blank image.

Pre-render your level (as in blit the tiles to a blank image) and then blit that 1 image to the screen. Update the image as the player moves around the screen, and only that 1 image. It's a great way to create a good tile engine.

to create an empty image called buffer:
buffer = Image.createEmpty(width, height)

then to blit images onto the buffer, use buffer:blit(x,y,etc.). It takes the same parameters as screen:blit() but it will blit it to your buffer before the screen

and then blit the buffer to the screen
while true do
screen:blit()
screen.flip()
screen.waitVblankStart()
end

look at http://wiki.ps2dev.org/psp:lua_player:functions for more info on the lua player funcs and http://lua-users.org/wiki/TutorialDirectory for more info on using lua!

Good Luck!
Post Reply