Issues with Snake Wars tutorial

0 votes
Hi, I tried to follow the Snake Wars tutorial, I'm using FlashDevelop to compile the code, but it gets an error "Syntax error: package is unexpected." in AppWarp.as, I can't solve this issue


And also, regarding the code "client.joinRoomInRange(1,1,true);"

 
How does it actually work? I tried this on the Smiley Space shooter tutorial to limit the game for 2 players (since usng the initial code more than 2 players can get in the game and everytime one player moves, the red smileys in all the other games move)

I tried to replace " WarpClient.getInstance().connect(localUsername); " with " WarpClient.getInstance().joinRoomInRange(1,1,true); " in the connect_click function
 
It didnt work, nothing's happening when it's "connecting..." and the game can't start
 
Thanks a lot for the help
asked Feb 23, 2014 in AppWarp by tdv (16 points)

1 Answer

0 votes
If you want to limit the game to 2 player rooms - you need to specify this when creating the room. So when you call createRoom API to create a dynamic room, you can pass 2 as the maxUsers parameter.

Now if you use joinRoomInRange API with (1,1) what it will do is find a room with exactly 1 person in in and add you to it. Then on a 3rd person will not be able to join it (as the room has 2 as maxUsers). If no such room is found - the API will complete with an error and you can go ahead and create a new room and join it. A similar concept is used in the following C# tutorial.

http://appwarp.shephertz.com/game-development-center/Cocos2d-xna-multiplayer-tutorial/#how-does-the-integration-with-appwarp-work
answered Feb 24, 2014 by dhruvc (1,099 points)
ok, but why does the compilation doesnt work?
Any answer on why I cant compile it?

And I still cant get it worked, I tried to put the  "WarpClient.GetInstance ().JoinRoomInRange (1, 1, true);"  in onConnectDone function of the AppWarpListener

and I put the code that creates the room as mentioned in the tutorial in the onJoinRoomDone function

Any solutions?? Thanks a lot, I really need help on this one
Hey tdv- So you are able to run and compile the smiley space shooter sample and not the snake wars sample? Best would be to ask a separate question for separate samples and the issues you have with each. I see you've already asked a new question on snake wars..
ah ok sorry about that, I'll made a new thread about that one
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...