PDA

View Full Version : maze and question box


itsumoko
03-09-2005, 03:08 PM
[URGENT] hi! plz help me guyz... i have a problem about in randoming. i'm doing a game and this is how it works...

there's a character in my game and his aim is to finish the maze in a specific time given. inside the maze there are obstacles (for example: a stone converted as movieclip). everytime my character will hit that obstacle a question box will appear in my screen having a 4 choices- A,B,C and D.

i do not know how to random the questions everytime my character will hit some obstacles.

and also, because there are choices in the question box, i also do not know on how to disappear that obstacle if the right answer has been choosed, so he may continue his journey. and if a wrong answer has been choosed, he will go back to start of the maze.

i know my explanation is very hard to understand. but guyz plz help me...

itsumoko
03-09-2005, 03:11 PM
[URGENT] hi! plz help me guyz... i have a problem about in randoming. i'm doing a game and this is how it works...

there's a character in my game and his aim is to finish the maze in a specific time given. inside the maze there are obstacles (for example: a stone converted as movieclip). everytime my character will hit that obstacle a question box will appear in my screen having a 4 choices- A,B,C and D.

i do not know how to random the questions everytime my character will hit some obstacles.

and also, because there are choices in the question box, i also do not know on how to disappear that obstacle if the right answer has been choosed, so he may continue his journey. and if a wrong answer has been choosed, he will go back to start of the maze.

i know my explanation is very hard to understand. but guyz plz help me...

macspud
03-09-2005, 03:34 PM
You are going to have to use hitTest() function to detect the collision. After that I'd put the desired responses in an array:

myChoice = []
myChoice.push("ChoiceA")
myChoice.push("ChoiceB")
myChoice.push("ChoiceC")
myChoice.push("ChoiceD")

Then I'd randomly select one of those...

var choice = Int(Math.random()*3
_root["message_to_user"] = myChoice[choice]

This will place one of the choices into a dynamic text box with a variable of "message_to_user".

You could also do this using buttons. The button choice would determine the array item to use.

Hope this helps.

itsumoko
03-09-2005, 03:42 PM
thnx! hhhmm... can i ask some more... where will i place this? and i am not randoming the choices because is only a part of the question which is the one i need to random everytime the character will hit an obstacle.

macspud
03-09-2005, 03:47 PM
I would place it in a function in a movieclip somewhere and call that function when the hit test is done.