SOLVED: switch on label determined by mode selected in previous room

Started by barefoot, Sun 22/05/2011 17:29:35

Previous topic - Next topic

barefoot

Hi

I have 3 labels that control gameplay...Mode 1: easy, Mode 2: hard and Mode 3: very hard.

The user picks a Mode and the room changes to the next room with the appropriate Mode showing on a label and game play based on whichever label is showing.

IE Label 1=Mode 1 (easy),  Label 2=Mode 2 (hard), Label 3= Mode 3 (very hard)

I understand that i have I have to use global variables to determine which label is displayed from the mode the user chose in room 1?

I can control the commands (by which label is visible) once it's known which label mode the user selected in the first room.

Hope this is easy to understand and that you can help me in the right direction.

barefoot











I May Not Be Perfect but I Have A Big Heart ..

Khris

Why not use three buttons and set a variable and a single label's text in their OnClick:

Code: ags
function btnEasy_OnClick(..) {

  difficulty = 1;
  lblDifficulty.Text = "Easy";
  player.ChangeRoom(..);
}

barefoot

Hi Khris

fantastic.. works a treat.. magic.. many thanks.. what ever button they choose determines text displayed on label in next room.

i just need to determine which text the label says as I assume its 1 label with text depending on which button pressed.. if you know what i mean?

its bothersome to do if label says this /this/this etc

cheers again

barefoot

I May Not Be Perfect but I Have A Big Heart ..

Khris

That's why all you need to do is:

Code: ags
  if (difficulty == 1) enemyHP = 100;
  else if (difficulty == 2) enemyHP = 150;
  else enemyHP = 200;


Why else would I set a difficulty variable? :)

(Also, labels are global entities, there's not really a "label in the next room", unless you're merely talking about turning it visible.)

Edit: it might be a good idea to shorten the variable name to diff or something since you're probably going to use it a lot. On the other hand, auto-complete should kick in since its a global variable so it doesn't make that much of a difference.

barefoot

Hi Khris

Yes, i just had to get my mind around it.

Iv'e adjusted your code to suit what is required.

I thank you again for getting me off to a great start.

:=

barefoot


I May Not Be Perfect but I Have A Big Heart ..

SMF spam blocked by CleanTalk