Page 1 of 1

How to implement an image on each turn/room entry

Posted: Sun Sep 02, 2012 12:36 pm
by Paul Robinson
I'm not sure exactly how to do it, but how is it in some games, and I think CryptoZookeeper does that, where, when someone goes into a room it shows an image, i.e. the picture image of the room - perhaps as an alternative or in addition to describing it - so that it's showing the image when someone enters the room. If there's source code around showing how this is done, that's fine but I wanted a general idea how it's done.

I think forcing things into 8 lines has sharpened my thinking. I've got to be much more careful to be precise now. (Again, just squeaked into 8 lines!)

Posted: Sun Sep 02, 2012 2:54 pm
by Roody_Yogurt
What I would do is:

- Have a routine called by main that draws the window that will show your graphic (as main is called after every successful turn)
- Have the graphic being drawn be stored in a global variable so you can easily update what graphic is being shown.
- Have code that updates the global variable in applicable situations, like putting the following in your room object:

Code: Select all

after  {
        location MovePlayer
           {
           current_graphic = <room>
           &#125;
That'd change the current_graphic global variable to whatever you want, which would then be drawn when main is called after the turn is over.

You could do the same thing for DoLookAround (to bring the graphic back to the room after looking at something else).

Does that help, or would you like me to go in further detail about something?

Posted: Sun Sep 02, 2012 4:39 pm
by Paul Robinson
Roody_Yogurt wrote:(1)draw window show graphic (2)
graphic stored global variable (3) update gv in room object:
(4) do for DoLookAround
Does #3 mean putting routine every room or can have list of pictures assigning one to each room and how assigned? E.g. @ entrance to Freeway, show freeway entrance with sign. @ entrance to airport, airport entrance; approaching warehouse, the building, etc. Or could there be a window at the top for a graphic, the text scrolls below but window stays fixed, then on a move, it changes the image in window?

Posted: Sun Sep 02, 2012 5:22 pm
by Roody_Yogurt
Paul Robinson wrote: Or could there be a window at the top for a graphic, the text scrolls below but window stays fixed, then on a move, it changes the image in window?
Yeah, I was describing how to do this (it's the style used in Guilty Bastards and Robb's graphical games).

Posted: Sun Sep 02, 2012 5:26 pm
by Roody_Yogurt
You can look see for yourself how Guilty Bastards does it by looking at GB's source, too: http://ifarchive.org/if-archive/games/s ... source.zip