Hey guys, it’s Powerflare. I thought I’d give a very technical and detailed explanation of the walking “bug” that’s in PG. First of all, let me explain what our goal is (what we’d like to happen), what occurs with this “bug” (that which alters our goal), and then I’ll explain just what the “bug” is. Our goal is to make room changing almost identical to Club Penguin (or practically any other avatar chat, for that matter). The only difference between CP and PG would be the fact that there would be no loading screen between rooms on PG. On CP, when you walk into the doorway, your avatar changes position and appears in the room you’ve just entered in front of the corresponding doorway. That is what we want to happen. Unfortunately, that doesn’t happen on PG, and upon hitting the doorway, your avatar doesn’t stop moving and change position; rather he keeps moving and stays in the same position. Picture this: the warp area from the Snow Forts to the Town and the Town to the Coffee Shop are in (approximately) the same area on your screen. Hitting that warp in the Snow Forts sends you to the Town, but instead of moving you to the proper position in front of the corresponding doorway (the path to the right of the Town), your avatar stays in the same spot as when you hit that warp. Since the Snow Forts-Town warp and the Town-Coffee Shop warp are in the same place on the screen, your avatar is now standing on the Coffee Shop warp, which sends you to the Coffee Shop. Ouch. Also, moving from the Town to the Snow Forts puts your avatar right on top of the warp from the Snow Forts to the Plaza which sends you straight to the Plaza. Fortunately, there is no Forest yet, because if there was, you’d be on top of the warp to the Forest (and then on top of the warp to the Cove if that was included in PG as well).
Big problem.

Some actionscript
These “warps” are actually movie clips that are made invisible through Actionscript. Our team uses the following codes to make room changing possibleāand its thanks to some people on random forums for teaching us what we know. The following code is specifically for the “warp” from the Snow Forts to the Town:
onClipEvent (enterFrame){
if(this.hitTest(_root.myAvatar)){
_root.smartfox.joinRoom("town");
_root.smartfox.setUserVariables({px:594.5, py:365.5, init:true});
_root.myAvatar._x = 594.5;
_root.myAvatar._y = 365.5;
}
}
The first line within the curly bracketsĀ if(this.hitTest(_root.myAvatar)){
is a condition statement which basically says “if the avatar hits this (the movie clip “warp”), do everything within the next set of curly brackets. The next lineĀ _root.smartfox.joinRoom("town");
tells the server to connect you to the room named “town” which is the Town, obviously. This code which is in the main timelineĀ _root.room.gotoAndStop(roomObj.getName());
inside the smartfox.onJoinRoom
function basically goes to and stops on the frame (each room [the visual aspect] is on a separate frame within the “room” movie clip) that has a frame label (just a little name you can give to the frame) which matches the name of the room (the actual room the server keeps track of). In this case, that functionally adds this code below the “joinRoom” one: _root.room.gotoAndStop("town");
The codes we struggle to grasp and understand follow that.
We don’t quite understand _root.smartfox.setUserVariables({px:594.5, py:365.5, init:true});
but have been encouraged to use it. We are doing a lot of research on this line of code. The x and y coordinates are the desired position (same with the next lines). The lines _root.myAvatar._x = 594.5;
and _root.myAvatar._y = 365.5;
should move the avatar to the listed x and y coordinates, but it doesn’t seem to work, and that’s the problem.
That may not have made much sense to some of you, but that’s our problem. If anyone knows anyone who knows anything about this or may be able to correct our coding, please have them leave a comment (or leave a comment yourself if you know something). Thanks for listening to my ramblings!
~Powerflare
Filed under: Uncategorized | 5 Comments »