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.

Author
Message
Jaskel
18
Years of Service
User Offline
Joined: 13th Jun 2006
Location:
Posted: 1st Jul 2006 19:32
I am making an overhead scrolling demo, which right now has a very limited size matrix (2,000*2,000) and I would like to create a barrier so that the camera can never see over the edge of the matrix. I have no idea of how to begin doing this, so... Anyone? Please?
Briere
19
Years of Service
User Offline
Joined: 28th Feb 2005
Location: Amherst New York, United States
Posted: 1st Jul 2006 20:51 Edited at: 1st Jul 2006 20:54
First you need to find the screen resolution. Then you can do something like this: (lets say the reso is 800 x 600)

**NOTE*** This is not correct DB code, just an outline to give you an idea on what needs to be done.

I am not sure if this will work either. It will only work if the camera position is taken from directly center of the screen. If the camera position is taken from the top left corner of the screen, remove the division by 2.

iCamX1 = 800/2 `minimum x vaule for the camera
iCamY1 = 600/2 `minimum y value for the camera

iCamX2 = 2000 - 800/2 `maximum x value for the camera
iCamY2 = 2000 - 600/2 `maximum y value for the camera

if camera position x < iCamX1 then position camera x iCamX1
if camera position y < iCamY1 then position camera y iCamY1
if camera position x > iCamX2 then position camera x iCamX2
if camera position y > iCamY2 then position camera y iCamY2


Once again I stress that I dont know if this is correct DarkBasic code, you might need to correct it, and Im not 100% sure this works as I havnt tested it, I am just guessing that it does.

Current Project: CTA Beta
Lines: 825
Last Updated: 6/30/06 at 7:21 PM EST.
Jaskel
18
Years of Service
User Offline
Joined: 13th Jun 2006
Location:
Posted: 1st Jul 2006 21:07
Also, I forgot to mention I'm using DB Classic
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 2nd Jul 2006 11:27 Edited at: 2nd Jul 2006 11:28


If it is a overhead scroller (top-down) then there should only be boundries for the left and right position, assuming that your player is moving up (along the Z-axis).


It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
Jaskel
18
Years of Service
User Offline
Joined: 13th Jun 2006
Location:
Posted: 3rd Jul 2006 05:19
Well, by scrolling I meant the view is over head and the player can scroll in any direction. So I need to make it go no further in all directions, but I think I have it now. Thank you!
Jaskel
18
Years of Service
User Offline
Joined: 13th Jun 2006
Location:
Posted: 3rd Jul 2006 05:32
okay... scratch that. I put in



and the same type for Z but it only handles one at a time. Also... when the player reaches one of the edges in a certain direction they are unable to go in the opposite direction for about 10 seconds. Any clue?
Jaskel
18
Years of Service
User Offline
Joined: 13th Jun 2006
Location:
Posted: 11th Jul 2006 06:26 Edited at: 11th Jul 2006 06:27
okay... I'm still having this problem. Can anyone help me with it?
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 25th Jul 2006 13:27
Okay now I do not quite understand what you're trying to do, but my assumption is that you are trying to make it so that the camera cannot see the edge of the matrix right? If so, then you could just make the matrix bigger so it fills the camera view... OR you could zoom the camera in. Either one.

Login to post a reply

Server time is: 2024-09-25 05:24:46
Your offset time is: 2024-09-25 05:24:46