Post

 Resources 

Console

Home | Profile | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 VBGamer
 VBGamer
 Move the camera on DirectDraw7, if we have one...
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Saga
Neophyte

4 Posts

Posted - May 02 2004 :  5:49:01 PM  Show Profile  Reply with Quote
Ok, first of all lemme explain what I wanna do:

I'm making a isometric-viewed RPG, and, as any other RPG, the camera gotta "pan" thru the scene sometimes, or follow the main guy. How do I move the camera (if we have one) thru the scene without having to move each DD7Surface? hope u have understood it. thanx and c ya!

"You can make anything... unless you're lazy!"

Eric Coleman
Gladiator

USA
811 Posts

Posted - May 02 2004 :  6:46:47 PM  Show Profile  Visit Eric Coleman's Homepage  Reply with Quote
Are you using 3D?

Go to Top of Page

sdw
Warrior

USA
160 Posts

Posted - May 02 2004 :  6:55:21 PM  Show Profile  Visit sdw's Homepage  Click to see sdw's MSN Messenger address  Reply with Quote
I'm not sure what you mean by 'not moving each DD7Surface', but I can tell you how the camera works. You draw the tilemap based on the camera's coordinates and you can set the camera coordinates based on the playing character's coordinates. Example:
  
Private Type MAP_TILE  
X as long
Y as long
End Type
  
Private Type CAMERA_POS  
X as long
Y as long
End Type
  
Dim Tile(100,100) as MAP_TILE  
Dim CameraPos as CAMERA_POS  
  
Private sub DrawMap()  
Dim X as long, Y as long
For X = CameraPos.X \ 32to CameraPos.X \ 32 + 20 'Based on 640x480 and 32x32 tiles  
  For Y = CameraPos.Y \ 32 to CameraPos.Y \ 32 + 15 'Again, based on 640x480 resolution and 32x32 tiles  
    Draw Tile(X,Y)  
  Next Y  
Next X  
  
End Sub
  

Of course you fill in whatever the tilesize you're using and change the 20 and 15 to the number of tiles that will fit across the screen vertically and horrizontally. Then if you wanted to make the camera follow your main character then you would just add something to ur code like:
  
CameraPos.X = MyChar.X - 320 'based on 640x480  
Camerapos.Y = MyChar.Y - 240 'based on 640x480  
  
If CameraPos.X < 0 Then CameraPos.X = 0  
If CameraPos.Y < 0 Then CameraPos.Y = 0  
If CameraPos.X + 640 > MapWidth Then CameraPos.X = Mapwidth - 640  
If CameraPos.Y + 480 > MapHeight Then CameraPos.Y = MapHeight - 480  
  
Go to Top of Page

sdw
Warrior

USA
160 Posts

Posted - May 02 2004 :  6:56:39 PM  Show Profile  Visit sdw's Homepage  Click to see sdw's MSN Messenger address  Reply with Quote
My previous post is for 2D
Go to Top of Page

Saga
Neophyte

4 Posts

Posted - May 02 2004 :  7:12:44 PM  Show Profile  Reply with Quote
hey! I didn't tested it out yet but, thanx in advance, really! c ya around!

"You can make anything... unless you're lazy!"
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
VBGamer © Go To Top Of Page
This page was generated in 0.12 seconds. Snitz Forums 2000

Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.