Android Creating a playable story -
i trying create playable story progresses via choices made player.
at each stage there 2 or 3 choices.
e.g.
text.settext("you reach stairs"); button1.settext("go up"); button2.settext("go down"); button3.settext("jump off cliff");
however way can think of making work having huge line of if else statements inside each other, or having 40 different activitys.
is there simpler way of doing this?
off top of head, this:
private void stairs() { text.settext("you reach stairs"); button1.settext("go up"); button1.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { attic(); } }); button2.settext("go down"); button2.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { basement(); } }); button3.settext("jump off cliff"); button3.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { endofgame(); } }); } private void attic() { ... } ...
please notice, untested code, typed out here.
Comments
Post a Comment