Text highlighting

Blitz3D Forums/Blitz3D Beginners Area/Text highlighting

Eren(Posted 2015) [#1]
Hello!

I'm looking to create a fully-fledged text adventure in blitz, and I'm wondering how I can get the player to pick a choice by highlighting a choice.

For example, if the player wants to go left, he/she would use the arrow keys (or the mouse) to hover over the text 'left', and then click on it which triggers a command.

Anyone know how to do this? You probably can, but I'm not that good.


RemiD(Posted 2015) [#2]
Take a look at these functions :
Rect()
Text()
Line()

Here : http://www.blitzbasic.com/b3ddocs/docs.php


Omnicode(Posted 2015) [#3]



Hope this helps.


Eren(Posted 2015) [#4]
Thanks for the reply Omni, but to be honest I'm fairly new to this language and I don't understand all of it. Could you break it down? Thanks.


Kryzon(Posted 2015) [#5]
You are having trouble because you're trying to do something that you don't understand yet. You need to study software architecture. No one can do this for you, but yourself.
Read this intently: http://en.wikipedia.org/wiki/Model–view–controller

There are two things you're trying to do here:

1) You're trying to change the state of the program. The user presses keys and changes the selected option. There's nothing on the screen in this context, this is all internal. The user is changing values stored in variables.

2) You're trying to represent the state of the program visually to the user, in some specific way. You will interpret the state of the program (the values in the variables) and will display graphics that represent this state. This means drawing the 'n' amount of options, and highlighting the one option that is selected.

You need to clearly see these two separate concepts or else you won't move forward and make your fully-fledged text adventure game.
Whether you're using Blitz3D, Java, Python etc. the logic is the same. So reflect if you're having trouble with the logic (how the program should behave) or having trouble with the implementation (the actual Blitz3D code for checking key presses, drawing text on the screen etc.).


Omnicode(Posted 2015) [#6]



Eren(Posted 2015) [#7]
Thanks guys, omni, for the explanation, and kryzon for the heads-up. I knew that I needed to get to know the language, program order etc, but I never knew where to start.


RemiD(Posted 2015) [#8]
To reword what Kryzon has explained :

You need to separate the "logic" and the "drawing"

In the case you describe,
depending on the previousstate and the playerinput (keys pressed), determine the nowstate
depending on the nowstate, determine what to draw on screen
choose a buffer where to draw (usually the backbuffer)
draw on the buffer
flip to display the results to the player