Posted: 4th Feb 2003 8:50
I just want to show how 2D tile scroller should be done.
I think that when beginners make rpg they all stop in this problem, like i somewere in history.
+ Code Snippet
set display mode 800,600,16 : sync on : hide mouse
dim map(100,100)
for t=1 to 100
 for tt=1 to 100
 map(t,tt)=rnd(1)
 next tt
next t
do
if upkey()=1 then dec y
if downkey()=1 then inc y
if leftkey()=1 then dec x
if rightkey()=1 then inc x
if x90 then x=90
if y90 then y=90
cls : lx=0
for t=x-5 to x+5
ly=0 : inc lx
 for tt=y-5 to y+5
 inc ly
 if map(t,tt)=0 then ink rgb(80,80,80)
 if map(t,tt)=1 then ink rgb(30,30,30)
 box 300+(lx*20),200+(ly*20),319+(lx*20),219+(ly*20)
 next tt
next t
sync
loop

Very simple, heh
Posted: 4th Feb 2003 8:56
Why the hell it erases some of my code... whatever.
if x90 then x=90
if y90 then y=90
should be...
if x<10 then x=10
if x>90 then x=90
if y<10 then y=10
if y>90 then y=90
Posted: 8th Feb 2003 2:16
thats good code bluedeep
Posted: 9th Feb 2003 13:20
as this is 2D, surly the bigger it is, the slower it becomes. I found taht if you look down straight onto a matrix, and have it scroll along with your sprites, then it is much faster.
Posted: 3rd Mar 2003 9:51
That was only an simple example, when u use sprites, u can make big 10x10 screen with multiple layers without fast pc.