Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: TheJBurger on Wed 28/02/2007 23:34:22

Title: Screen Coordinates vs. Room Coordinates
Post by: TheJBurger on Wed 28/02/2007 23:34:22
I'm currently working on a shooter type game.

When the player shoots an enemy, I transport a new character called "Blood" to the location the enemy character was shot, using this code:

cBlood.ChangeRoom(1, mouse.x, mouse.y);

I noticed in some cases though, that cBlood does not transport anywhere near where the mouse was clicked (usually between -5 and -50 y coordinates from the click), and I wondered why. Then I remembered something about the .x and .y coordinates being screen coordinates and not room coordinates. (My room is infact a scrolling room in the dimensions 320 x 292)
So that means when I transport cBlood, he's changing to the screen coordinates of mouse.x and mouse.y, and not the room coordinates(?).

I think this is the case, and if it is, does anybody know how to override it?
Title: Re: Screen Coordinates vs. Room Coordinates
Post by: Ashen on Wed 28/02/2007 23:42:39
That's exactly whatthe problem is, you're right.
This was asked in a slightly different context (Character.Walk not Character.ChangeRoom) not long ago here (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=30268.0). The same solution will work for you.
Title: Re: Screen Coordinates vs. Room Coordinates
Post by: TheJBurger on Wed 28/02/2007 23:55:58
Works perfectly. Thank you.