Jump to content

  • Log In with Google      Sign In   
  • Create Account


How to scroll a tile map (C# with Directx)


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 jackiewen24   Members   -  Reputation: 108

Like
0Likes
Like

Posted 26 October 2012 - 04:28 AM

Please, give me a example about scrolling tile map or some tutorial.
thanks!

Sponsor:

#2 MisterFuzzy   Banned   -  Reputation: 161

Like
0Likes
Like

Posted 26 October 2012 - 09:00 AM

[EDIT: Holy crap, I said that backwards. That's what I get for having Beef Jerky and Monster for breakfast...]

Tilemaps can be done in many ways, so I'll keep this as general as possible: When tiles are initially positioned, a simple Vector2 can be subtracted from the tile's drawing position, and in effect making the map scroll. By repositioning the tile's drawing position instead of the base location, any collision math you have can be preserved. If your particular programming language doesn't support Vector2 objects, just use X and Y values.

Edited by MisterFuzzy, 04 November 2012 - 01:07 PM.

"Only idiots quote themselves" - MisterFuzzy

 


#3 MarkS   Prime Members   -  Reputation: 875

Like
0Likes
Like

Posted 26 October 2012 - 09:23 AM

I haven't used DirectX for this, but I have used OpenGL which is similar. Don't scroll the tile map geometry. Send the entire tile map geometry to the GPU once. From there on out, translate your modelview matrix to scroll the map. Only resend the geometry if it changes.

[edit]
I wrote the original post in haste. Edited for clarity.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS