change background

Started by javinasty, Sat 19/01/2013 16:27:38

Previous topic - Next topic

javinasty

hello.

i'm sorry for my short mind, but i wonder if it ís possible set another background using the hotspots.
or if it is possible to load another room using the hotspots. for example making click on the drawn zone.

thanks a lot.

Khris

You need to do the tutorial and read the scripting section of the manual, otherwise you'll keep asking questions like this.

You're looking for hotspot events, how those work is explained here: Tutorial -> Starting off -> Part 3 - Hotspots and events

To change the room, call player.ChangeRoom(2);

To switch the background graphic, call SetBackgroundFrame(1);
(In order for this to work, you'll want to call SetBackgroundFrame(0) in the room's "before fadein" event, to turn off the background animation.)

javinasty

yes, i have to read all the tutorial. but i don't understand the way to work after read it.
when i wrote in the room1.asc flange:
function room_Load()
{
SetBackgroundFrame(0);
}
function hHotspot1_AnyClick()
{
GetBackgroundFrame()==2;
}
the first frame is stop, but the interaction with the hotspot drawn isn't work. and i don't know what i did wrong.

Khris

I told you exactly how to do it in my previous post.

GetBackgroundFrame() returns the current frame, it doesn't change it.
You basically wrote 0==2;
This will compile but obviously not do anything.

You need
Code: ags
function hHotspot1_AnyClick()
{
  SetBackgroundFrame(1);
}


Note that background frames are numbered 0-4, so in order to show the second image, pass 1 as parameter.

javinasty

yes, but if i write GetBackgroundFrame(1);
appears a little window with this message:
there were compilation errors. see the output window for details.
and in the output window i can read:
wrong number of parameters in call to "GetBackgroundFrame"

selmiak

You need the SetBackgroundFrame(1); function, not GetBackgroundFrame(1); ;)

javinasty

ok, ok, it works.

yes, i wrote getbackground, instea of setbackground. and the loading room works too.

i want to apologize with khris for his patience. you make this site great.
thanks a lot.

SMF spam blocked by CleanTalk