Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > General > Gaming and Game Development

Reply
 
Thread Tools Rate Thread Display Modes
Old 03-20-2010, 12:06 AM   #1
Logan Walker
Registered User
 
Join Date: Mar 2010
Posts: 7
Default [AS3] I want a number of scenes to change once the user has looked at each once.

Hey guys, I was wondering if you could help me.

I’m making an interactive kind of game, and I want a number of scenes to change once the user has looked at each once.

For example, they go into three different scenes. When they finish looking at them all, Flash records this, and then when they look back at each scene again, they’ve all changed.

Anyone know a tutorial for this? Or can show me?
Logan Walker is offline   Reply With Quote
Old 03-20-2010, 04:20 AM   #2
codeman22
Member
 
Join Date: May 2009
Posts: 97
Default All sections viewed

Logan,

Here's one way to do it. Create an array to record whether a scene is new or viewed. Then, when a scene has been viewed, test if all have been viewed.

Here's some code:
ActionScript Code:
// set an array to keep track of whether scenes are new or viewed // start with all scenes being new var scene_viewed:Array=new Array("new","new","new"); // when a scene is visited, change its value in the array // // to test the code comment out some of the following lines scene_viewed[0]="viewed"; scene_viewed[1]="viewed"; scene_viewed[2]="viewed"; //whenever a scene is viewed, check to see if all scenes have been viewed check_if_all_viewed(); function check_if_all_viewed():void {     var viewed_scenes:int=0;     var i:int;     for (i=0; i<scene_viewed.length; i++) {         trace("checking scene "+i+": "+scene_viewed[i]);         if (scene_viewed[i]=="viewed") {             viewed_scenes++;             trace("number of viewed scenes = "+viewed_scenes);         }     }     if (viewed_scenes==scene_viewed.length) {         trace("change all scenes");         // put change scenes actions here                 // then reset the array to new                 for (i=0;i<scene_viewed.length;i++){             scene_viewed[i]="new";         }         trace (scene_viewed);     } else {         trace("sorry only "+viewed_scenes+" out of "+scene_viewed.length+" have been viewed");     } }

Hope this helps

codeman22
codeman22 is offline   Reply With Quote
Old 03-21-2010, 11:56 AM   #3
Logan Walker
Registered User
 
Join Date: Mar 2010
Posts: 7
Default

Thank you! That does help. I'm having a few problems placing it though. Do you have an example in flash I could look at?
Logan Walker is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:35 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.