PDA

View Full Version : [AS2] find objects in room game


Natoush
01-13-2007, 03:18 PM
to better explain what im tryin to do (mystery case files, titanic expedition, even certain parts in paparazzi) of course i dont wanna do sth as complicated as those... just 1 level. 1 room filled with objects and a list with the name of the objects on the right.
i already had a lil help with the actionscriptm, so now, when an object is clicked, it's name disappears from the right.
but this is not exactly what i had in mind, i cant fit all the object names on the right (i have each name as movie clips) the first thing i need help with..

"is how to just turn it into a normal list of lets say 10 words under each other.. and when i click the object on the picture, the name of the object will disappear from the list, and a new object name which wasnt previously on the list appears, until lets say all 22 objects are found..." "or another choice for the list is to just keep is as a list of 12 objects, and have it be random, everytime the game is replayed or started and of course once the object is clicked the name of the object disappears from the list."

"another problem i also do not know how to solve is... putting a timer... lets say a 30, or 60 seconds timer to find all the objects, if they aint found then its game over..."

and lastly... once all objects are found ... to jump into the next frame (or screen)

ok... its a lot i know.... but.... it's important to me to have it working perfectly... and unfortunately... without help, i wont be able to do so...
so... if ny1 can help in anyway.... with any of the problems... just let me know

Natoush
01-14-2007, 11:50 AM
hey... can some1 please tell me how exactly to set a timer for lets say 1:30 min.... that counts down to zero. and when it reaches zero.. lets say it goes to frame 4....
been trying everything, and it's just not working...

Kazekage
01-14-2007, 01:30 PM
Here's the code for the timer.

_root.createTextField(instanceName="timerField", _root.getNextHighestDepth(), 10, 10, 100, 22);
_root.timerField.textColor = 0x000000;
_root.myTextFormat = new TextFormat();
_root.myTextFormat.bold = true;
_root.myInterval = new Object();
_global.timer = 90; //in seconds

function checkTime() {
if (_global.timer>0) {
_global.timer--;
}

tempmin = Math.floor(_global.timer/60);
tempsec = _global.timer-(tempmin*60);
_root.timerField.text = tempmin+" : "+tempsec;
_root.timerField.setTextFormat(_root.myTextFormat) ;

if (_global.timer<=0) {
_root.timerField.text = "OUT OF TIME!";
_root.timerField.textColor = 0xFF0000;
_root.timerField.setTextFormat(_root.myTextFormat) ;
_root.gotoAndPlay(4);
clearInterval(myInterval);
}
}

_root.myInterval = setInterval(checkTime, 1000);

Natoush
01-14-2007, 02:15 PM
thanks... u really helped me with half my problem! :)

Natoush
01-14-2007, 07:34 PM
the code for the timer worked perfectly... there's just a couple of things i cant figure out on my own about the timer yet... once the timer reaches 0:0, it's supposed to go to the next frame... ok it does that... but he problem is that the 0:0 doesnt go away... it stays on the next frame... so how do i stop that from happening... sth else is that the mouse cursor changes when it's on top of the numbers.... i want it to remain the same....

rrh
01-14-2007, 10:24 PM
Does the "OUT OF TIME!" message appear behind or ontop of the 0:0 or not at all?

and

_root.timerField.selectable=false;

will make your mouse not change over it.

Kazekage
01-15-2007, 03:29 AM
Add this code to where you want to delete text

_root.containerMC.removeMovieClip();

And here's the new code for the timer:

_root.createEmptyMovieClip(instanceName="containerMC", _root.getNextHighestDepth());
_root.containerMC.createTextField(instanceName="timerField", _root.containerMC.getNextHighestDepth(), 0, 00, 100, 22);
_root.containerMC._x = 10;
_root.containerMC._y = 10;
_root.containerMC.timerField.textColor = 0x000000;
_root.containerMC.timerField.selectable = false;
_root.myTextFormat = new TextFormat();
_root.myTextFormat.bold = true;
_root.myInterval = new Object();
_global.timer = 90; //in seconds
function checkTime() {
if (_global.timer>0) {
_global.timer--;
}
tempmin = Math.floor(_global.timer/60);
tempsec = _global.timer-(tempmin*60);
_root.containerMC.timerField.text = tempmin+" : "+tempsec;
_root.containerMC.timerField.setTextFormat(_root.m yTextFormat);
if (_global.timer<=0) {
_root.containerMC.timerField.text = "OUT OF TIME!";
_root.containerMC.timerField.textColor = 0xFF0000;
_root.containerMC.timerField.setTextFormat(_root.m yTextFormat);
_root.gotoAndPlay(4);
clearInterval(myInterval);
}
}
_root.myInterval = setInterval(checkTime, 1000);

Natoush
01-15-2007, 11:13 AM
hey... thanks for the mouse cursor removal thing... it worked... but
lets say i have the timer on frame 4 as the time ends, i have it go to frame 5(the timer 0:0 is still there)
i tried writting what u wrote... and that removes the timer completly... i dunno what im doing wrong!


forget it... thanks... figured it out.. it was stupid mistake of mine
hehe :)