Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Tile map darw prob - help needed

Author
Message
StartCoder
14
Years of Service
User Offline
Joined: 16th Oct 2009
Location:
Posted: 7th Dec 2009 22:51 Edited at: 7th Dec 2009 22:52
Hi Guys,

First of all sorry for my bad English.

I need little help with my Tile map drawing, i have tried to google and search about this but i could not find what i was looking for.

i am just using simple code to draw tile map on the screen and it works greate. But when i try to draw bigger map it gets SLOW! from 60 FPS to 30 FPS.

It gets slow because it draws all the tiles that are not visable on the screen
So how can i fix this? how can i make it only draw tiles that are visiable on screen so when scrolling it will scroll in my Map Array



I hope someone can help me with this.

Thank you all in advance.
haliop
User Banned
Posted: 8th Dec 2009 08:39
as far as i know , you need 2 Arrays for the Tiles
one to hold the full map \ level tiles
and another to draw only what you "see" according to your Scrolling or Player Position.

so you have MainTiles Array for the whole map file
and a DrawTiles Array for the ones you are now looking on.

so you need to calc , where you are now on the tile map according to 2D Screen Coordinates.
some Rpg's like diablo for example keeps the Player always in the Middle of the Screen , then all the DrawTiles moves the opposite way to your Player Movement.
now the DrawTiles actually exctract data from the MainTiles.
i dont remmber how to code this , but i think this should help you on how to figure it out.
StartCoder
14
Years of Service
User Offline
Joined: 16th Oct 2009
Location:
Posted: 8th Dec 2009 17:08
haliop Thank you!,

I know what you mean.. good thinking

if someone else knows better way let me know

Login to post a reply

Server time is: 2024-10-01 18:41:44
Your offset time is: 2024-10-01 18:41:44