Split screen to 1 screen
Author: | Klikmaster
|
Submitted: | 1st June, 2003
|
Views: | 5880
| Rated: |
|
|
This is my first article. But don’t worry, I’m not a newbie, and I expect only expert klikkers to understand. Anyway, onto the subject.
Have you ever wondered how to do a split-screen, or ever needed one for a game???
Well, this article will tell you how to do a split screen. And, how when two objects come close, it will go into a single screen, until they separate again. Sounds cool??? It is, so read on…
You will need:
To be able to use Sub-applications, Global Values, and Inis. I’m not sure which klik product you are using, but I know that this is possible to do in MMF.
First make a new application. You need to make the frame size bigger than the window size, so configure them. I am just using an X-scrolling dimension. So I’m using window-size 200x400 and Frame size 640x480.
In your frame, make the Player 1 and Player 2 objects. Give them movements, (each with different controls, obviously). In event editor make the “center frame position” on player 1. Now add an Ini object. In event editor add to ini:
X (player2) – X (player 1) to item “…” in group “…”
This will save the distance between player 1 and player 2. I will tell you why we need this later…
Save the application as “an Internet application”. This will save it as a .cnn file, this is so we can load it in a sub-application. Now change the events so that the frame follows player 2. Save it as another .cnn file. Save as .cca file, so that you can change it another time.
+++++ Now for the tricky part +++++
Make a new application. Make the frame and window size 400x400, Make a sub-application object, and open the first cnn file. Put the object on the left side of the frame. Do the same for the second cnn file, and put it on the right side of the screen.
You should now have a split screen. To make the split screen able to un-split, go into the event editor and say:
GroupItemValue(“Ini”,”Group”,”Item”) < 400
- Go to next frame
This is saying that when the players are closer than 400 pixels together, then go to the next frame. The next frame will be when the split screen is no longer spliced (Corrected by MS word )
This means that because we are changing frames, you have to store everything in global values, player positions etc.
So the next frame must be 400x400 too. You still with me?
Make it like the two we made before (copy one of them). We need to make the center screen position in-between the players, so make a new object (any object. It will be invisible anyway). And:
Set X position to X (“Player 1”) + ((X (“Player 2”) – X (“Player 1”))/2)
Now the object should be in-between the players .
So set “center window position” on the object.
Congratulations! The screen should un-split. BUT to get it to split again, make an event to check to see if the players are 400 pixels apart. Then Jump to the initial frame.
Phew! Did you get all that?
If you are still clueless or want to see the result, click one of the below. They are still buggy, but with tampering I'm sure you could improve it.
Right-click and Save-target as...
Source file (MMF needed) (16.8kb)
http://www21.brinkster.com/klikmaster/splitscreen.zip
Exe file (for those without MMF) (117kb)
http://www21.brinkster.com/klikmaster/splitscreenexe.zip
Please feel free to comment or ask questions.
|
|
|