| View previous topic :: View next topic |
| Author |
Message |
chriso
Joined: 21 Mar 2006 Posts: 6
|
Posted: Sat Apr 22, 2006 9:19 pm Post subject: 2d side scrolling platformer |
|
|
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:tutorial#full_game_sample_with_tiles_animation_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. |
|
| Back to top |
|
 |
glynnder
Joined: 04 Sep 2005 Posts: 35
|
Posted: Sun Apr 23, 2006 5:37 am Post subject: |
|
|
| hmmm, i use director. are you good @ lingo? |
|
| Back to top |
|
 |
chriso
Joined: 21 Mar 2006 Posts: 6
|
Posted: Sun Apr 23, 2006 6:56 pm Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
Shine
Joined: 03 Dec 2004 Posts: 728 Location: Germany
|
Posted: Sun Apr 23, 2006 9:45 pm Post subject: Re: 2d side scrolling platformer |
|
|
| 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. |
|
| Back to top |
|
 |
thsock
Joined: 25 Sep 2005 Posts: 25
|
Posted: Sun May 14, 2006 1:46 pm Post subject: |
|
|
| why not just make a frame by frame instead of a side scroller. checkout stickman sam. |
|
| Back to top |
|
 |
|