Problem with properties when Open/Close door

Started by fovmester, Thu 26/05/2005 14:28:19

Previous topic - Next topic

fovmester

I've made it so that the status-line gets a property whenever the mouse-pointer is over a hotspot (in this case a door). So if you have the Use-command it reads the hotspot's Use-property for the text to be displayed in the status-line. Use Door -> Open Door.

The problem is that when the door is opened I want the status-line to read Close door. But the Use-property of the door is "Open" from the start, and I can't change properties at run-time. I can think of several work-arounds. But I want something that is general and don't mean that I have to hard-code some test (to see if this particular door is open or not ) into the status-line-code. Because then I'll have to do it for every door in the game, which will make sloppy and unreadable code before long!

Has anyone tried doing the same thing as I, and come up with a good solution?

Ishmael

You could make a state2 property, which is read whenever a global variable, that you'd set up for all objects that can be toggled, is read to in position 1, when it initially was in postition 0...

Add two properties, the global state ref number, and the state2, and set up an array like objstate[num] and if you set number 3 to the door you'd read objstate[3] and use the correct property based on what the var reads. Then you'll only have to hard-code the var reading process.
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

fovmester


SMF spam blocked by CleanTalk