Re:Doors

Gary Brown
14 Jun 2005, 14:13
Is there a way to make an object belong to 2 rooms at the same time. I'm trying to figure out a way to make doors. I'd rather not have to make two doors, and have to set them both to either open or closed. I'd much rather have a single door that exists in both rooms that it connects.

Gary

francisstokes
14 Jun 2005, 15:07
What about writing a script that when the player walks out of room a, the door object moves to room b.ill show you:


' "test"
' Created with QDK 3.53 - UNREGISTERED VERSION

define game <test>
asl-version <350>
gametype singleplayer
author <francis stokes>
start <a>
game info <Created with QDK 3.53 - UNREGISTERED EVALUATION VERSION.>
end define

define synonyms
end define

define room <a>
north <b>
script if not here <door> then move <door; a>
end define

define room <b>
south <a>
script if not here <door> then move <door; b>

define object <door>
end define

end define

define text <intro>

end define

define text <win>

end define

define text <lose>

end define




If you plan to use the door more than this, turn the script into a procedure.then imsted of writing
script if not here <door> then move <door; a>


you write
do <door_move>

Gary Brown
15 Jun 2005, 18:04
Thanks. That does look like it would work. I was just hoping there'd be a way to make an object belong to two rooms at the same time. Just would've probably been easier, and I'm er... uh... lazy. hehe

Gary

francisstokes
16 Jun 2005, 10:24
Well i did that in qdk in less than 3 mins so its worth just doing that.

But, its not possible to have an object in 2 rooms at the same time.Of course, you could always clone the door but this is what id do since you can use it over and over (not that i include doors as objects in my games, unless theres something significant about them).

Arbutus
24 Jun 2005, 15:26
You can also put the door in the room descriptions and use a flag to define if the door is open or not. For the door direction, use a condition that checks the flag (eg. door_library_study) and moves the player or says the door's closed. Add a room command to open the door that changes the flag. That's what I do!

Gary Brown
24 Jun 2005, 16:08
Okay! Thanks Arbutus. I like that solution, cool. Thaks to both of y'all.

Gary