Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Calavera

#1
The problem there also when i click in a different position, i would fix this because in my game there are many scene with a long backgorund and the player is forced to click at the screen side repeatedly. 
#2
So there aren't any other solution? I have to implement another computational method for the A* algorithm and overload the Walk method?
#3
because i think many player can do
#4
Hi, when i play and i click in a point like a crazy the main character hangs.
I think the problem is in the function Walk indeed when i run the command cEgo.Walk in the repeatedly execute function  my character freezes.

Can anyone help me?
#5
This is my final version for background sliding in monkey island style ....

Code: ags

//Backgorund sliding: 
//-----------------------------------------------------------------------------
//Pseudo const
//
//S_VELOCITY is the camera speed. 0 no movement
//
int S_VELOCITY = 3;
int S_DISTANCE = 160;
//-----------------------------------------------------------------------------
//Global var
int xCameraCenter;
int halfScreenSize;
//State var
int movementVersor = 1; // 1 for right movement -1 for left movement
bool enableMovementRight = false;
bool enableMovementLeft = false;
//-----------------------------------------------------------------------------
//Set the new center:
//Put the character in the center of the screen 
function on_event (EventType event, int data)
{
  if (event == eEventEnterRoomBeforeFadein){
    halfScreenSize = System.ScreenWidth/2;
    xCameraCenter = GetViewportX() + 160 -player.x;
    if(xCameraCenter < 0) xCameraCenter = 0;
  }
}
//-----------------------------------------------------------------------------
//Camera motion
function repeatedly_execute_always()
{
  SetViewport(xCameraCenter, 0 );
  //Check the event and set the direction 
  if (  player.x > S_DISTANCE + halfScreenSize + GetViewportX() ){
    enableMovementRight = true;
    movementVersor = 1;
  }
  if (player.x < (GetViewportX() + S_DISTANCE) ){
    enableMovementLeft = true;
    movementVersor = -1;
  }
  //If the camera is on the left border or right border disable the movement
  if( Room.Width <= GetViewportX() + halfScreenSize*2 ) enableMovementRight = false;
  if(GetViewportX() == 0) enableMovementLeft = false;
  //Check if the camera and the player are in the same position
  if(xCameraCenter >= player.x - halfScreenSize) enableMovementRight = false;
  if( xCameraCenter <= player.x - halfScreenSize) enableMovementLeft = false;
  //if the movement is enabled
  if( enableMovementRight == true || enableMovementLeft == true ) xCameraCenter += movementVersor*S_VELOCITY;
}
SMF spam blocked by CleanTalk