Sign in to follow this  
jeteran

Starting in Android with a text adventure game

Recommended Posts

Hello everybody.

 

I'm starting to create games in Android; I have some minor XP creating games in other languages (like AS3) and I know that making a small text adventure game is the best bet to start knowing a new platform.

 

The idea of the game is about a guy in a room where he should look for a key inside many objects and then use it to go out. This objects might be "a lamp" "desk" etc (those might be presented as buttons) 

 

Do you have a good tutorial about it?

 

Thanks so much guys!

Share this post


Link to post
Share on other sites

Hey Marek, thanks so much for your response!

 

I believe that touch based will be easier and cooler for the user. 

 

I am writting some code with the help of data I have found on the net, but I don't know if it is the best way to do it:

 

@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ScrollView sv = new ScrollView(this);
        LinearLayout ll = new LinearLayout(this);
        ll.setOrientation(LinearLayout.VERTICAL);
        sv.addView(ll);
        TextView tv1 = new TextView(this);
        TextView tv2 = new TextView(this);
        tv1.setText("N O  E X I T");
        tv2.setText("You just woke up in a cold dark room.");
        ll.addView(tv1);
        ll.addView(tv2);
        this.setContentView(sv);

 

Thanks again Marek.

Share this post


Link to post
Share on other sites

Depending on how "visual" you want your game to be, you might run into problems placing your buttons on the screen.  Unless of course you decide that all your interface will just be one scrolling list of text.

 

So how do you intend to present options for the user after you display the text "You just woke up in a cold dark room" ?  

After a user presses a button, do the buttons disappear?

 

You might be better off rendering a full screen image of a room and just keep track of touchable hotspots in the image that react when the user presses them.

Share this post


Link to post
Share on other sites

Thanks again Marek for your response.

 

I want it to be all text, and only use buttons for some actions.

 

Yes I think it can be something like this:

 

N O  E X I T

You just woke up in a cold dark room, alone. The room has many objects, which one do you want to inspect?

<button 1> Desk

<button 2> Table

<button 3> Jar

<button 4> Door

 

If you click, for example button 3, it will appear that the user now has a key. So then, if he clicks the 4th button, the game ends; if not, it will say that the door is closed.

 

Maybe have this text area at the bottom of the screen.

 

Give me your thoughts; and thanks once again for helping me!

Share this post


Link to post
Share on other sites

After each action you should probably clear the screen and render the new text and button options on the screen.  That will ensure that the new action doesn't cause the old actions to scroll off the top of the screen.  Additionally it keeps the number of visible buttons on the screen to a minimum and you don't have to worry about disabling buttons for previous actions that should not be clickable.

Share this post


Link to post
Share on other sites

That's exactly what I'm looking for, thanks for your response Marek.

 

Knowing this, where should I start? I don't even know how to put some text in the screen or how to render the buttons. I tried to put a pair of lines of text but haven't done much more:

 

@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ScrollView sv = new ScrollView(this);
        LinearLayout ll = new LinearLayout(this);
        ll.setOrientation(LinearLayout.VERTICAL);
        sv.addView(ll);
        TextView tv1 = new TextView(this);
        TextView tv2 = new TextView(this);
        tv1.setText("N O  E X I T");
        tv2.setText("You just woke up in a cold dark room.");
        ll.addView(tv1);
        ll.addView(tv2);
        this.setContentView(sv);

 

Thanks again !

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this