I've been a bit frustrated working with different sized sprites that others in a project have made - to make a scene work sprites need to jump across a scene in a literal instant, and I briefly thought that this was what Character.Move() does and I've been a bit disappointed (though it has cleared up one part of the scene..) I know that characters generally aren't meant to jump all over the screen but it will be REALLY USEFUL if it's possible in this context.
Thanks for your help in advance, because it's always good stuff.
You can just change Character.x and Character.y directly to instantly transport the character to those coordinates.
...really? Damn, that's buried away in the manual...
Okay, I'll do that right now..
Or you can use:
cChar.ChangeRoom(cChar.Room, coordx, coordy);
Thanks, but that was one of the first things I tried and it made it crash when I ran it.
Anyway, the cChar.x thing worked fine. So this one's solved.
I don't see why you would want to change the character to the room they're already in Dual...the function is called ChangeRoom...ChangeRoom...
The correct way is of course to modify the Character.x and Character.y properties directly (make sure Character.Moving is false first!).
If you want you could even write a custom extender method like this:
// GlobalScript.ash
import bool SetPosition(this Character*, int x, int y, bool stopMoving=true);
// GlobalScript.asc
bool SetPosition(this Character*, int x, int y, bool stopMoving) {
if (this.Moving) {
if (!stopMoving) return false;
else this.StopMoving();
}
this.x = x;
this.y = y;
return true;
}
// any script
cChar.SetPosition(new_x, new_y);
;)
Edit: I added an optional parameter to the code so if you like you can now force the character to stop moving (if they are moving) and still put them at the new position.