You must be logged in to do that.

PlayerMove

PlayerMove
void PlayerMove(string script)

Documentation

With this function you ignore what ever input the user gives, and set actions for the player to follow using a 'movecode' string. In verge a movecode is a string of instructions for an entity to follow, one after the other, like a 'script'. Each command is a letter, sometimes followed by a number, here are a list of what each does:

ulrd (followed by number) Move the player either up, down, left or right by set number of tiles.
xy (followed by number) Move an player so a set x or y tile position
pt Changes movement to either pixel accurate, p, or tile accurate, t. Now works.
z (followed by number) Set the current frame of the player, like setting entity.specframe
w (followed by number) The player pauses for set number of timer ticks (default 100 = 1 second)
f (followed by number) Sets the entity's facing: use directional 0 moves instead, then you don't need to remember which number is which direction
b Loops the player movecode, eternally – DO NOT DO THIS

They can be either upper or lower case (which ever you think looks nicer) and don't need a space or anything between commands.

There are a few things to remember when moving the player around, firstly the player needs to have their specframe set to 0 to enable the walk animation, rather than just sliding around. So if you change the frame, remember to set it back with “z0” before moving. Also, as the program would go into an eternal loop if the player got 'stuck' any movement will go straight through of obstructions and other entities, so make sure to test what you use to make sure it works as expected.

Note: When using PlayerMove(), it ignores normal code execution and does Render() and ShowPage() for as long player is moving. If this is not what you want (for instance if you'd prefer a textbox to execute as the player is walking or something more dramatic) you might want to use EntityMove() on your player index instead.

Example Usage

// Examples adapted from Parallel Seven

// Player waits briefly then changes to 'glance right' frame
PlayerMove("w40z21");

// Player looks around
PlayerMove("d0w40r0w40");
// Parallel Seven specific textbox
TBox(party[0].port, 1, 1, party[0].name, "Where the hell is there a weapon when you need one?");
// Player moves to x,y position then looks right and pauses
PlayerMove("y61x77r0w40");
Talkback

There are no talkbacks on this documentation page yet. Post the first?

Post a new comment?

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.