Easy splitscreen for TGF!
|
Hello everybody!
Now i'm going to teach you how to make an easy splitscreen example in tgf! The people that use mmf dont have mush use of this cause they have subapps but now tgf users can use some sort of subapps ok here we go.
first you need to create one masterapp here is how to do it:
create an editobject and and two playerobjects
code: (remember to do this in the same order as here)
always set text to =
str$( X ( Player 1 ) ) + , + str$( Y( Player 1 ) ) + , + str$( Dir( Player 1 ) )
and save it to a textfile
like this: appdrive$ + appdir$ + P1.txt
that was for player1 now do exactly the same for player2
exept you save it as p2.txt
ok now you want to now wath exactly you did ok this is what you did: save the position and the direction of each player so that the other subapp can load it.
ok now we are going to make a subapp
for the subapp you will need the same objects and levels exept in this app they wont have any movement and we need the stringpharser. so here we go.
Code: (remember to make it in the same order as here)
start of level add delimiter ,
always load from file:
appdrive$ + appdir$ + P1.txt
set Xpos: val( listFirst$( String Parser ) )
set Ypos: val( listGetAt$( String Parser, 2 ) )
set direction: val( listGetAt$( String Parser, 3 ) )
repeat that for player2
well thats it
BUT before i stop writing i'm going to tell you what you done. you have loaded the Xpos, the Ypos and the direction
of the object into the subapp from the textfile that got the info from the masterapp
ofcourse you say that you need animations to but that isint hard to do just send one more value that contains the animation number. Hope you like the tutorial!
PS. Both has apps running at the same time and take away the inactivate object if far from window and the masterapp has to have focus.
|
|
|