Hi
Is it possible to choose more than 1 x and y for an Object... ie like an Int for Text giving random options?
Basically a player clicks a button which sets an Object to move.. what i am looking for is to be able to move that object from say 3 option random moves.
For example: Object Move: option1 300,190 option2 307,198 option3 320,202 etc etc
I want to check if that Object is at a certain x y location then set off another function such as door opening.
cheers
barefoot
there is a function in AGS called Random. Here is the help file info on it (should be useful to you):
Random
Random (int max)
Returns a random number between 0 and MAX. This could be useful to do various effects in your game.
NOTE: The range returned is inclusive - ie. if you do Random(3); then it can return 0, 1, 2 or 3.
Example:
int ran=Random(2);
if (ran==0) cEgo.ChangeRoom(1);
else if (ran==1) cEgo.ChangeRoom(2);
else cEgo.ChangeRoom(3);
will change the current room to room 1,2 or 3 depending on a random result.
oObject_Interact(){
int ran=Random(2); //random number from 0 to 2
if(ran==0){
oObject.Move(300, 190, 5, eBlock);
}
else if(ran==1){
oObject.Move(307, 198, 5, eBlock);
}
else if(ran==2){
oObject.Move(320, 202, 5, eBlock);
oDoor.Graphic=50; //or whatever you do to open the door
}
}
should get you on your way.
Edit: Drew beat me! Stupid txt-style format filter, breaking my code!
Cheers guys... works a treat.. :=
barefoot