Known Bugs
-The first frame does not appear immediatly
-The Idle frame shows with the sprite(as it's an animated sprite)
Other than that there's no other bugs.
I need help getting rid of the known bugs, I can't seem to get the idle frame to only show when no key is pressed, and I also can't get the first frame to appear immediately when I press a direction button.
If you can help that'd be great!
-The first frame does not appear immediatly
-The Idle frame shows with the sprite(as it's an animated sprite)
Other than that there's no other bugs.
CODE
Code:
function game()
{
CreatePerson("person", "aegis.rss", false);
SetPersonSpriteset("person", LoadSpriteset("Trunks.rss"));
SetPersonSpeed("person", 1);
AttachCamera("person");
SetPersonDirection("person", "south")
SetRenderScript("Movement();");
AttachInput("person");//but we don't want the standard movement interfereing with the movement we'll be having so...
BindKey(KEY_LEFT, "", "");
BindKey(KEY_RIGHT, "", "");
BindKey(KEY_UP, "", "");
BindKey(KEY_DOWN, "", "");
MapEngine("Test.rmp", 60);
}
var facing, walker;
function Movement()
{
walker = GetInputPerson();
if (IsKeyPressed(KEY_UP))
if (IsKeyPressed(KEY_UP))
walker = GetInputPerson();
if (IsKeyPressed(KEY_UP))
{
if(!facing ||
facing == "d" ||
(!IsKeyPressed(KEY_LEFT) &&
!IsKeyPressed(KEY_RIGHT)))
{
facing = "u";
QueuePersonCommand(walker, COMMAND_FACE_NORTH, true);
}
QueuePersonCommand(walker, COMMAND_MOVE_NORTH, true);
}
else if (IsKeyPressed(KEY_DOWN))
{
if(!facing ||
facing == "u" ||
(!IsKeyPressed(KEY_LEFT) &&
!IsKeyPressed(KEY_RIGHT)))
{
facing = "d";
QueuePersonCommand(walker, COMMAND_FACE_SOUTH, true);
}
QueuePersonCommand(walker, COMMAND_MOVE_SOUTH, true);
}
if (IsKeyPressed(KEY_LEFT))
{
if(!facing ||
facing == "r" ||
(!IsKeyPressed(KEY_UP) &&
!IsKeyPressed(KEY_DOWN)))
{
facing = "l";
QueuePersonCommand(walker, COMMAND_FACE_WEST, true);
}
QueuePersonCommand(walker, COMMAND_MOVE_WEST, true);
}
else if (IsKeyPressed(KEY_RIGHT))
{
if(!facing ||
facing == "l" ||
(!IsKeyPressed(KEY_UP) &&
!IsKeyPressed(KEY_DOWN)))
{
facing = "r";
QueuePersonCommand(walker, COMMAND_FACE_EAST, true);
}
QueuePersonCommand(walker, COMMAND_MOVE_EAST, true);
}
if(!IsAnyKeyPressed())
{
QueuePersonScript(walker, "SetPersonFrame(walker, frame)", false);//change frame to the frame you want to goto first.
QueuePersonCommand(walker, COMMAND_WAIT, false)//This should create a small pause in the middle so the character won't move striaght from one to the other
QueuePersonScript(walker, "SetPersonFrame(walker, frame)", false);//change frame to the frame you want to goto second.
}
}
function Movement()
{
if (IsKeyPressed(KEY_UP))
{
QueuePersonCommand("person", COMMAND_FACE_NORTH, true);
QueuePersonCommand("person", COMMAND_MOVE_NORTH, true);
}
else if (IsKeyPressed(KEY_DOWN))
{
QueuePersonCommand("person", COMMAND_FACE_SOUTH, true);
QueuePersonCommand("person", COMMAND_MOVE_SOUTH, true);
}
if (IsKeyPressed(KEY_LEFT))// here is the problem, left and right are checked after up and down, therefore always going to face left and right while walking diagonally.
{
QueuePersonCommand("person", COMMAND_FACE_WEST, true);
QueuePersonCommand("person", COMMAND_MOVE_WEST, true);
}
else if (IsKeyPressed(KEY_RIGHT))
{
QueuePersonCommand("person", COMMAND_FACE_EAST, true);
QueuePersonCommand("person", COMMAND_MOVE_EAST, true);
}
}
I need help getting rid of the known bugs, I can't seem to get the idle frame to only show when no key is pressed, and I also can't get the first frame to appear immediately when I press a direction button.
If you can help that'd be great!