Location in room 2 the same as whatever it was in room 1?

Started by DDWingate, Tue 29/10/2013 02:23:02

Previous topic - Next topic

DDWingate

Get this: I am trying to make a game where you can play as a guy walking around my Windows 7 desktop, interacting with the various icons. I want it so that interacting with the "Start" button will pull it up. I've done this by creating a second room, identical to the first, except with the start button pulled up. I've turned the start button in room 1 into a region, and adding this code

Code: ags

function hHotspot1_Interact()
{
cDoug.ChangeRoom(2, 31, 746);
}
 

So interacting with the start button will give the illusion of pulling up the start menu.

However, I want the character to appear exactly where he was in the previous screen, so he won't flicker around, breaking the illusion. Is there a way to do this?

I have tried searching for a similar problem, but I couldn't find one.

Cheers

btw: both rooms are the exact same resolution, so coordinates should be the same

Gilbert

Try:
Code: ags

function hHotspot1_Interact()
{
cDoug.ChangeRoom(2, player.x, player.y);
}
 

or just:
Code: ags

function hHotspot1_Interact()
{
cDoug.ChangeRoom(2, cDoug.x, cDoug.y);
}
 

if your player is always that Doug guy.

Khris

Apart from the fact that changing rooms is probably the worst possible way of achieving the desired effect, simply calling player.ChangeRoom(2); should do the trick (since not stating coordinates means the player character will remain exactly where they are).

DDWingate

Quote from: Khris on Tue 29/10/2013 04:39:28
simply calling player.ChangeRoom(2); should do the trick (since not stating coordinates means the player character will remain exactly where they are).

Well that's convenient! Thanks!

Quote from: Khris on Tue 29/10/2013 04:39:28Apart from the fact that changing rooms is probably the worst possible way of achieving the desired effect,

I think my way is best, because I'm trying to make every single button within the start menu to be interactive. I think it would be easier and just as effective to have the scripts involved with the start menu to have its own separate page. Then you wouldn't have to adjust all the hotspots for the start menu not to appear until the start menu has been pulled up. Unless there is an easier way. What are your thoughts?

Khris

A GUI is by far the closest thing to the actual task bar AGS offers.

Just create one with the right size, make each option a button (which means mouse over images as easy as entering a 2nd sprite number) and turn it visible if the user clicks on the start button. (visibility setting: Normal, initially off)

SMF spam blocked by CleanTalk