[Gambas-user] Writing a "Choose Your Own Adventure" prototype

jbskaggs jbskaggs at ...1871...
Wed Apr 15 21:39:21 CEST 2009


That would be really easy in Gambas!

Becuase Gambas is object oriented  goto's aren't needed.

Let me give you a step by step how to do one screen and you can then change
it or redo it how you like.

step 1:

create a form with a textbox, a picture box, and three buttons.

Put your reading selection in the textbox, the image in the picture box and
the three options on the buttons

so button1.text="Open door."
button2.text="Scream for help"
etc..

Now in your form editor double click one of the buttons and it will take you
to the code page and automatically create an event code:

public sub button1_click()


End

Now between those two lines you would put your code to display a new page. 
You have two options really:

1.  Goto a new form with new controls or
2. Change the data for the controls (ie the text, the picture, and the
button labels)

I have done something like this in the past and I stored my texts in small
files.  so my button code looked like this:

public sub button1_click()
textarea1.text=file.load(user.home &/ "scene1.txt")
picturebox1.picture = picture.load(user.home &/ "thispic.png")
button1.text="You have been killed!"
button2.text="Go back?"
Button3.text="Quit."
End

I will be glad to help you if you want more help.

JB Skaggs



Marc Carson-3 wrote:
> 
> I want to make a short adventure game that lets users read text and look 
> at an image that explains where they are in the story, and then lets 
> them make a decision like, 1) get in the car or 2) run and call the 
> police. These choices then branch into other choices, and at many points 
> the player may die or complete the adventure in different ways. I hope 
> that makes sense...
> 
> What I'm wondering is, what sort of data structures and approaches to 
> this type of software should I use? The last time I did something like 
> this, as a youngster, I used GOTO everywhere. :-) But I've heard there 
> are better ways.
> 
> Thanks for any tips for a beginner...
> 
> Marc
> 
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> High Quality Requirements in a Collaborative Environment.
> Download a free trial of Rational Requirements Composer Now!
> http://p.sf.net/sfu/www-ibm-com
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
> 
> 

-- 
View this message in context: http://www.nabble.com/Writing-a-%22Choose-Your-Own-Adventure%22-prototype-tp23064077p23065712.html
Sent from the gambas-user mailing list archive at Nabble.com.





More information about the User mailing list