Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: gollymrme on Fri 02/09/2011 20:38:03

Title: Random text
Post by: gollymrme on Fri 02/09/2011 20:38:03
Hello AGS friends! I need help with a game I'm working on...I want to create a quick game called Fortune Cookie where the player hits a hot spot to reveal a random text fortune. Maybe have 20 different fortunes set and have Ags pick one at random, then reset to be able to pick another one when you click the hot spot again. Any suggestions for a 'just starting out' game creator? Your friend and mine, Ryan
Title: Re: Random text
Post by: Mouth for war on Fri 02/09/2011 20:48:01
you should check out the "random" function if I understand you right :)
Title: Re: Random text
Post by: Lt. Smash on Fri 02/09/2011 21:20:42
I would suggest you to create a list, a so-called "one-dimensional array", with all the different fortunes:


String _fortune[20];
_fortune[0] = "Tonight you will find new love";
_fortune[1] = "Stay with your wife";
...


And then in the hotspots on_click you can randomly choose one string:

int ran = Random(19);
Display(_fortune[ran]);