how to make a scrolling map

BlitzMax Forums/BlitzMax Beginners Area/how to make a scrolling map

Twinprogrammer(Posted 2011) [#1]
Hey guys,

I'm trying to make a map that can scroll once the character passes the screen. But I was planning to make the game online so I could keep the status of each player.

twinprogrammer


Jesse(Posted 2011) [#2]
you need to go through some tutorials to learn how scrolling is done. Do some searches on this site and maybe on google to find tutorials and samples on how to do this. I think there are some samples in the code archives that should give you an idea on how to do it. once you get the basic concept, post any problems you have with your code. so that we may help you.
If you already have some code and are having problems post it so we can help you with it. other than that I don't think any body is going be able to help you.


Dabhand(Posted 2011) [#3]
Old resource (Old BlitzBasic code), which you can look at for pointers:-

http://membres.multimania.fr/blitzcoder/cgi-bin/code/Wcfcf980f72d9d.htm

Theres tons of examples kicking around, you just need to hunt them down for research! :)

Dabz


JazzieB(Posted 2011) [#4]
I have a tilemap example on my Blitz site, but I don't think it's exactly what you're looking for. My example keeps the player central unless they are near the edge of the level.


Twinprogrammer(Posted 2011) [#5]
That's very helpful but I don't normally code with glmax. Got any examples without glmax ?

Twinprogrammer


Midimaster(Posted 2011) [#6]
it depends on how you constructed the map.

normaly the map "does not scroll", but only the startpoint for drawing moves:

Graphics 800,600
Global Map$[30,30]
For i=0 To 29
	For j=0 To 29
		Map[i,j]= i +"/"+ j
	Next 
Next

PlayerX=800
PlayerY=800
StartX=300
StartY=300
Repeat
	Cls
	For X=0 To 29
		For Y=0 To 29
			DrawText Map[X,Y], -StartX +64*X , -StartY + 64*y
		Next
	Next
	DrawOval -StartX +PlayerX , -StartY + PlayerY , 10,10
	
	If KeyDown(Key_Right) 
		StartX:+1
		PlayerX:+1
	ElseIf KeyDown(Key_Left) 
		StartX:-1
		PlayerX:-2
	EndIf

	If KeyDown(Key_Down) 
		StartY:+1
	ElseIf KeyDown(Key_Up) 
		PlayerY:-1
	EndIf
	
	Flip
Until KeyHit(Key_escape)
	



This is a very basic minimalistic sample, which will draw all fields of the map (no matter whether they are inside or outside the visible area) and it does not care about borders of the map....

But you can see, that there is no need of manipulation the maps() or the players position

"Key_Right" shows a scrolling corresponding to player's moves
"Key_Left" shows a scrolling with a player's fast move
"Key_Up" shows a scrolling with a non moving player

Last edited 2011


col(Posted 2011) [#7]
I imagine the main reason you don't have many replies here on this topic is that you seem too vague in what you really want.

Maybe give an example of a game that has the type of scrolling that you want to achieve.
Have you tried to write any code just yet? other than using the example Midimaster have given you to work from?


JazzieB(Posted 2011) [#8]
That's very helpful but I don't normally code with glmax. Got any examples without glmax ?

Do you mean my examples? They might use the OpenGL graphics driver, but they are not dependant on it. It's just there to keep the EXE size down (Framework). You can change the driver to DirecrX and it work the same way.


Neuro(Posted 2011) [#9]
He's wanting some kind of example that scrolls the screen when the character passes the screen. Right away i'm thinking the original Legend of Zelda, Govelius, and Golden Axe Warrior type games.

I suggest checking out the DWLab framework. Although its not exactly out of the box the way you want it, its already got the framework set for building a tilemap based game. Also entire source code is there so its easily modifiable to suit your needs :
http://blitzmax.com/Community/posts.php?topic=95093