Apologies for cross posting (also on psplua).
I have made a basic platform game before in Flash and also an engine in Director, now I want to make an open source tiled platform engine for my own use, but for others to use and improve.
I am new to lua, but not to programming.
Based on this tutorial as a starting point...
http://wiki.ps2dev.org/psp:lua_player:t ... mation_etc
My first job is to get it scrolling at variable speeds.
Initial thoughts are:
- store viewable area / position
- blit the tiles viewable to an image in memory
- then blit this image to the screen
- as the screen scrolls, get the next set of tiles and add them a column at a time
-[update]
here is my first progress. Have tiles being drawn to screen and scrolling left & right. What do you think?
http://www.pixelsumo.com/_lua/platform.zip
I have a few questions you may be able to help with.
1) How can I smoothly scroll with a unit less than 1, i.e. 0.2
map_currentview_x = map_currentview_x + 0.2
2)
I want to only blit new tiles, not redraw the whole set each time, is this possible?
so i imagine:
blit a new coloumn to an image in memory
blit this image to the screen
The trouble is, if i create an image in memory, then blit the background to screen, then the image in memory to screen over the background, the image in memory isnt transparent so it just has a black background.
2d side scrolling platformer
Moderators: Shine, Insert_witty_name
Re: 2d side scrolling platformer
Take a look at the Snake game, which does exactly this (and uses the non-alpha parameter for blitting the background for speed). yourImage:clear() sets the background to transparent color.chriso wrote:The trouble is, if i create an image in memory, then blit the background to screen, then the image in memory to screen over the background, the image in memory isnt transparent so it just has a black background.