Tilemap zooming/player following [CLOSED]

Monkey Forums/Monkey Beginners/Tilemap zooming/player following [CLOSED]

BradMangham(Posted 2016) [#1]
Hi there!

I have a basic tilemap system in place with my topdown tile based RPG game that I am making. However, when in the game, I would like the 'camera' to be focused on the character, and 'zoomed in' so that the entire level cannot be seen.

I am using the Mojo plugin as I only have the free version of Monkey X to work with.

This is the code I use for generating the level itself.

[CODE]
Class Level
Field tiles:String[41][]
Field tileset:Image

Method New()
tileset = LoadImage("Tileset.png",16,16,10)
For Local i:Int = 0 To 40
tiles[i] = New String[31]
Next
End

Method Draw()
Local tile:String
For Local y:Int = 0 To 29
For Local x:Int = 0 To 39
tile = tiles[x][y]
If tile = Door Then DrawImage tileset, x*16, y*16, Door
If tile = CrossPath Then DrawImage tileset, x*16, y*16, CrossPath
If tile = VertPath Then DrawImage tileset, x*16, y*16, VertPath
If tile = HorPath Then DrawImage tileset, x*16, y*16, HorPath
If tile = BotLeftCorner Then DrawImage tileset, x*16, y*16, BotLeftCorner
If tile = TopLeftCorner Then DrawImage tileset, x*16, y*16, TopLeftCorner
If tile = BotRightCorner Then DrawImage tileset, x*16, y*16, TopLeftCorner
If tile = TopRightCorner Then DrawImage tileset, x*16, y*16, TopRightCorner
If tile = Wall Then DrawImage tileset, x*16, y*16, Wall
If tile = Floor Then DrawImage tileset, x*16, y*16, Floor
Next
Next
End

Method Load()
Local levelFile:FileStream
Local levelData:String
Local dataItem:String[]

levelFile = FileStream.Open(CurrentLevel,"r")
levelData = levelFile.ReadString()
levelFile.Close

dataItem = levelData.Split("~n")
For Local y:Int = 0 To 29
For Local x:Int = 0 To 39
tiles[x][y]=Int(dataItem[y][x..x+1])
Next
Next
End
End
[/CODE]

Any help would be greatly appreciated!


MikeHart(Posted 2016) [#2]
You basically asked this question before and didn't respond to the suggestions made:

http://www.monkey-x.com/Community/posts.php?topic=12714&post=124980&view=all#124980


BradMangham(Posted 2016) [#3]
My bad,

Completely forgot about that thread XD

Thanks for the reminder