Page 1 of 1

on smartfox join room set avatar to x and y position

Posted: 11 Apr 2010, 06:05
by 09op
hi is this posible if i join a room i am set to a position because i am using a hit test code to join rooms and if the players hit one triger the go to a differint room so is it possible to do this?

Posted: 13 Apr 2010, 09:29
by 09op
any one?

Rather ..

Posted: 13 Apr 2010, 12:27
by ParkerJ
Rather than giving you the code it would be way simpler to explain. As if I gave you the code you wouldn't learn...

So..

First off the platform is where users are attached... So...
If you make a movieclip and add a hit test like so;

Code: Select all

if(this.hitTest(...)){
x = new x;
y = new y;
_root.platform._x = _root.platform._x + (GAME WIDTH);
smartfox.setUserVariables({playerx: X, playery: Y, slide:"no"})
}
This will move the platform and the player over :) So the other players will be off the screen and you can't see them. They would still be in the same rooom but you can;t see them... Now there is a problem with the easing action if you use that... But everywhere else you set the player x and y... you need to set slide to "yes".

This will become clear now;
Now that you have done so.
You need to modify the easing in the on User Vars Update and on mouse press.

and around the easing
put if(slide == yes){

}else{
playerx._x = px;
playery._y = py;
}

there should work.

But remeber half the codes are wrong... We don;t want you ripping my codes :D

~Parker