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.

Newcomers DBPro Corner / Splitting the Screen in Darkbasic Pro

Author
Message
Jake025
16
Years of Service
User Offline
Joined: 28th Aug 2008
Location:
Posted: 28th Aug 2008 16:11
Hi.

I'm creating and multi-player tanks game using one keyboard (so player one gets the up, down, left and right key, and player two gets the w, a, s and d keys), and I wanted to split the screen so that player one sees one view and player two sees another.

How would I do this?
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 28th Aug 2008 19:25 Edited at: 28th Aug 2008 19:26
You could have 2 additional cameras, and have each one render to an image (set camera to image). These 2 images would be what the useers see (as sprites or pasted images)

RedFlames
17
Years of Service
User Offline
Joined: 25th Aug 2007
Location: Germania
Posted: 28th Aug 2008 22:20
or simply use the Set Camera View Command to specify the area on screen the camera-images will be rendered to...

LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 30th Aug 2008 19:02
In a game I am working on I used the following function to set up separate 'windows' for each of the two players:


This function is called once before your main loop.

During the main loop, I do something like this for each of the players:

The floating variables, dist# and high#, are made as globals and are set earlier in the code to: dist# = 6.0 : high# = 3.5. This works with what I am working on, but you will likely need to adjust it for your game.

You wouldn't normally need the extra object in there like I have done, but this code is using Dark Physics, and is necessary. You should get the idea.

LB

Math89
20
Years of Service
User Offline
Joined: 23rd Jan 2004
Location: UK
Posted: 31st Aug 2008 15:18
Don't forget to use the Set Camera Aspect command if you don't want to have everything stretched. The aspect ration should always be renderSizeX/renderSizeY (don't forget to use floats values).

Login to post a reply

Server time is: 2024-09-27 20:19:01
Your offset time is: 2024-09-27 20:19:01