Screen Coordinates vs. Room Coordinates

Started by TheJBurger, Wed 28/02/2007 23:34:22

Previous topic - Next topic

TheJBurger

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:
Code: ags

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?

Ashen

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. The same solution will work for you.
I know what you're thinking ... Don't think that.


SMF spam blocked by CleanTalk