Issue changing between characters

Started by RadarG, Thu 03/12/2015 15:36:06

Previous topic - Next topic

RadarG

Hi everyone,

I've start a new game with AGS in which the player has 2 differents characters to play, but I'm having issues trying to change de character.

I had the idea to change clicking on a button and I tried this:
Code: ags

function button_AnyClick()
{
  cRubber.SetAsPlayer();
}


Where cRubber is the character I want to change.
Thank you.

RadarG

Crimson Wizard

RadarG, you told what you were trying to do, but did not tell what happened :).

Is the button actually clickable? Is the script called? This is easily checked by setting a breakpoint inside "anyclick" function, or putting something like " Display("Button was pushed"); " in it.

RadarG

Ups didnt know that, I'm new here.

So I used this in the room properties:



I thought that would make my button clickable.

Sorry, I'm new in AGS and programming. :sad:

Thanks BTW.

Billbis

Read carefully the name of the function you write, then read carefully the name of the function in the event handler (you're screenshot).
Do the names match? They should...

Crimson Wizard

Could you explain your situation more?
For example, what is the "button" you are talking about - is it actually a button on GUI, or an Object in the room?

I see a difference in function name: on your screenshot there is "IconRubber_AnyClick" function name typed into the Object properties, however in the script example in your first post there is "button_AnyClick" function. Is it the actual function name you have in script?

RadarG

#5
Yep I saw the name was changed so I corrected that but that wasn't the problem.

About if the button is in the room or in the GUI or room, is an object in the room like the character changing in "Day of the tentacle" but insted of being in the GUI is in the room. Actually I'm trying to do the game without GUI so the player does everything with de mouse (there is no: talk, view, etc..., just walk to).

Crimson Wizard

Quote from: RadarG on Thu 03/12/2015 16:16:28
About if the button is in the room or in the GUI or room, is an object in the room like the character changing in "Day of the tentacle" but insted of being in the GUI is in the room. Actually I'm trying to do the game without GUI so the player does everything with de mouse (there is no: talk, view, etc..., just walk to).
GUI does not mean that you would need to have commands like Talk and Look. You may create GUI that has character switching buttons, or anything else you need.

The difference between having GUI buttons and Room objects is that Room object exists only in one room, and GUI exists in all rooms.

RadarG

Okay didnt knew that about GUI, I'll try putint the button on the GUI.

Thanks mate.;)

SMF spam blocked by CleanTalk