forums

TNT Basic Forums > Programming Q&A
Brainiac: Open Map Viewport Problem
< Last Thread     Next Thread >
Author
Thread        Post A Reply

10-22-2003 22:18

Posted by:
buddy

Location:
Champaign, IL

Click Here to Email buddy   Find more posts by buddy

My topdown game was working fine until I discovered the "Open Map Viewport" option, which I totally should use.

I had been:
1. opening a canvas (huge)
2. drawing the whole map into the canvas
3. opening a viewport to that canvas
and then in my game loop:
1. update the player location (based on controls presse)
2. update viewport location (based on current location of the player)

gXPosition[0] is the player's x position, FYI

procedure ViewportMovement()
'update main viewer location
gMainViewLocX=gXPosition[0]-320 'half width of viewport
gMainViewLocY=gYPosition[0]-240 'half height of viewport
'update viewport to keep centered over player
set viewport offset 1, gMainViewLocX, gMainViewLocY
end proc


Now that I use Open Map Viewport, it seems like the Viewport doesn't "keep up" with the player. I don't see how that's possible.

Are there problems with "Open Map Viewport", or am I just not thinking hard enough?

Ideas?
Thanks

10-22-2003 22:45

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

Wait! A viewport and a map viewport are totally different! A viewport is based on a canvas and the choords are set from the top-right corner of the canvas. A map viewport is based on a map and the choords are set from the top-right corner of the screen.


See Map tutorial by asondsoft at http://www.tntbasic.com/learn/ to learn about map viewports.

10-23-2003 11:34

Posted by:
buddy

Location:
Champaign, IL

Click Here to Email buddy   Find more posts by buddy

D'ohh!

Thanks...

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.