This week I worked on a system that will help us incorporate graphics into stories. Each Scene object is now associated with the name of a library object that represents the scene. In the main program there is a data object that stores story state information. When a scene is used, the game engine attaches the movieclip to the stage, and it loops through the state object looking for data with the same name as the movieclips inside of the scene movieclip. It then calls gotoAndStop to move the graphic to the right state. In this way states could either be frame numbers, or named keyframes.
Example:
function openDoor(){
state.door = "open"
}
function closeDoor(){
state.door = "closed"
}
When a scene is attached, the game will look for a door movieclip and set it to either frame "open" or "closed". There is also a system to pick if the frame itself should be updated or duplicated.
No comments:
Post a Comment