Help with cursor&moving with right click

Started by updoggg, Yesterday at 01:13:41

Previous topic - Next topic

updoggg

hey, so i wanted to make it so you have one all purpose cursor where you interact with left click and then move on right click
this is the code -->
Code: ags
function on_mouse_click(MouseButton button) {
  
  if (IsGamePaused() == 1) {
    return;
  }

  if (button == eMouseRight) { 
    player.Walk(mouse.x, mouse.y);
  } else if (button == eMouseLeft) { 
    Room.ProcessClick(mouse.x, mouse.y, mouse.Mode);
  }
}

it works, but the issue is that in certain rooms it just doesn't, and the player can't go past a certain point for seemingly no reason? i know its an issue with the right clicking part because it works when i use arrow keys. help appreciated :o)
UPDOGGG

Khris

For scrolling rooms to work you need to add the camera offset (i.e. convert the mouse's screen coordinates to room coordinates).
Code: ags
  player.Walk(mouse.x + Game.Camera.X, mouse.y + Game.Camera.Y);

SMF spam blocked by CleanTalk