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!)
How to implement an image on each turn/room entry
Moderators: Ice Cream Jonsey, joltcountry
- Paul Robinson
- Posts: 160
- Joined: Fri Sep 30, 2011 9:40 am
- Location: Just ask TDarcos; he knows
-
- Posts: 2256
- Joined: Mon Apr 29, 2002 6:23 pm
- Location: Milwaukee
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:
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?
- 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>
}
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?
- Paul Robinson
- Posts: 160
- Joined: Fri Sep 30, 2011 9:40 am
- Location: Just ask TDarcos; he knows
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?Roody_Yogurt wrote:(1)draw window show graphic (2)
graphic stored global variable (3) update gv in room object:
(4) do for DoLookAround
-
- Posts: 2256
- Joined: Mon Apr 29, 2002 6:23 pm
- Location: Milwaukee
-
- Posts: 2256
- Joined: Mon Apr 29, 2002 6:23 pm
- Location: Milwaukee
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