C++ And Flash V2.0

C++ And Flash V2.0
Franky Natividad
I started programming at age 14. My first was ActionScript Ever since then Ive always wanted to make an Online game. Now with that successful, Now I wish to help others with their problems, and provide out of the box Flash Projects that may inspire others to do greater things.
View all articles by Franky Natividad**How to use tutorial with my v2.0 its a bit more complex than v1.0 :)**
Well finally I released V2.0 and I was glad I had alot of people asking me when its release was so I took the time and finished most of it and released a beta :)
Alright enough talk lets get to the actionscripting :)
First of all the client from v1.0 hassent changed much it has more functionality thats about it for it.
My v1.0 tutorial explained most of it but now it has login capabilities which has to have a little bit more explanation :)
Alright here is how login system works : ( PROCESS):
--Connect to Server--
--When Connected--
--Send Login--
--Await Login Results--
--On Result if 1 then your logged in if not your login information is incorrect--
--If everything is good then it sends information from the server that is in the users information database like sex.--
--Then allows you to send messages to everyone :)
Now that we know the process lets talk about the code :)
First Connect to Server-
ip="localhost";
port=1030;
_root.myXML.connect(_root.ip, _root.port);
Then Login- :)
msg="1002"+_root.user.text+"@"+_root.pass.text+"@";
<img alt="" src="file:///C:/DOCUME%7E1/COMPAQ%7E1/LOCALS%7E1/Temp/moz-screenshot.jpg"/><img alt="" src="file:///C:/DOCUME%7E1/COMPAQ%7E1/LOCALS%7E1/Temp/moz-screenshot-1.jpg"/>--Heres the await login results--(This is a cut up from the actual script)
loginres = src.indexOf("1002");
if(loginres!=-1){
splits=src.split('@');
if(splits[1]==1 && splits[11]==_root.user.text){
chatbox.text+="Connected Successfully!"+"\n";
_root.c_control.enabled=true;
//level//hp//mp//gold//sex//exp//x_point//y_point//map
_root.level=splits[2];
_root.hp=splits[3];
_root.mp=splits[4];
_root.gold=splits[5];
_root.exp=splits[6];
//Set up register process//
if(splits[6]==0){
_root.u_sex=0;
duplicateMovieClip (_root._mc_clip_p,_root.user.text,_root.accounted++);
}else{
_root.u_sex=1;
duplicateMovieClip (_root._mc_clip_f,_root.user.text,_root.accounted++);
}
_root.users_list[_root.accounted]=_root.user.text;
trace(_root.users_list[_root.accounted]);
_root[_root.user.text]._x=splits[8];
_root[_root.user.text]._y=splits[9];
_root[_root.user.text].user_name_char.text=_root.user.text;
if(splits[10]!=1){
_root.world=splits[10];
_root.game_world_.gotoAndPlay(splits[10]);
}
reveal_game();
msg="1003"+_root.user.text+"@"+_root.world+"@"+splits[6]+"@";
sendXML(msg);
}else
if(splits[1]==0){
//Didnt work//
chatbox.text="Invalid Login!"+"\n";
_root.user.enabled=true;
_root.user._y+=100;
_root.pass._y+=100;
_root.pass.enabled=true;
_root.sex.enabled=true;
_root.c_control.enabled=true;
_root.c_control.label.text="Connect";
myXML.close();
}
}
Its pretty simple :)
Then like my first version you send messages like you would and parse them yourself :
msg="ID"+USERNAME+"@"+MESSAGE+"@";
sendXML(msg);
Thats simple eh? Alright now for c++
For Sending lets say message to the person sending a certain message like login you find the id first.
After ward you if then state it
CPP:
if(id==1000){
//do what you want to do here now to send a message back//
send(s,"MESSAGE HERE",strlen("MESSAGE HERE AGAIN"),0);
}
s = Socket which is sending data :)
I will soon implement a dll system were you can add your own script to parse login and such which makes it that much more fun :)
Of course its c++ but that way you still have access :)
I offer support in Flash and C++ and you can read my v1.0 tutorial which is on the same site and still available but not the download :(
Here is the link to download it :)
http://tempostudios.com/forums/index.php?topic=38.0
Alright thats it for me thanks for reading :)
Spread The Word
1 Response to "C++ And Flash V2.0" 
|
said this on 26 Oct 2007 8:16:35 PM CDT
Hi, i'm 12 and a beginner at action script. I want to make it so you can use gold to buy items. I know how to make it work but I am clueless on getting the player movieclip to wield the new item. Please help you seem like an excellent programer.
|


Author/Admin)