2d side scrolling platformer

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

Moderators: Shine, Insert_witty_name

Post Reply
chriso
Posts: 6
Joined: Tue Mar 21, 2006 12:10 am

2d side scrolling platformer

Post by chriso »

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.
glynnder
Posts: 35
Joined: Sun Sep 04, 2005 9:54 pm

Post by glynnder »

hmmm, i use director. are you good @ lingo?
chriso
Posts: 6
Joined: Tue Mar 21, 2006 12:10 am

Post by chriso »

glynnder wrote:hmmm, i use director. are you good @ lingo?
Yes, although it doesn't help me with programming Lua, as its mainly blit to screen & speed issues.
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Re: 2d side scrolling platformer

Post by Shine »

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.
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.
thsock
Posts: 25
Joined: Sun Sep 25, 2005 1:04 pm

Post by thsock »

why not just make a frame by frame instead of a side scroller. checkout stickman sam.
Post Reply