Hi all,
I'm really frustrated with something and hope someone out there can help.
I have this game >
http://www.asherbartos.com/xmas2005/
plays very well on my 1.7 ghz pc laptop.
plays horribly on a dual 1.2 mac.
some things simply don't work, on the Mac like the arrow keys.
that sucks, but the performance is what is driving me nuts.
I expect to take a hit on the mac, but this is beyond anything I anticipated.
is there code you should just simply stay away from on the Mac?
I used a couple of listeners for arrow key control. a couple of
setIntervals. nothing too hard core at all... most of the code is below
if anyone cares to take a look.
thanks for any help anyone can offer.
Kurt
goSanta = function()
{
this.gotoAndStop(2);
var spd:Number = _root.variableSpeed;
var mX:Number = this._x;
var targ:Number = (_root._xmouse - mX)/spd;
if(_root.variableSpeed<1)
{
_root.variableSpeed = 1;
}
this._x += targ;
}
stopGame = function()
{
clearInterval(goDrink);
clearInterval(goTimer);
delete _root.santa.onEnterFrame;
_root.santa._x = -100;
}
santasWasted = function()
{
clearInterval(goDrinks);
delete _root.santa.onEnterFrame;
_root.santa.gotoAndPlay("passOut");
}
startGame = function()
{
s.stop();
_root.santa.tween("_y",440,.5,'easeOutBack');
attachSFX(_root.closingScreen,"start","start",50);
_root.variableSpeed = 1;
_root.closingScreen.gotoAndStop(1);
_root.gotoAndStop("playGame");
_root.santa.onEnterFrame = goSanta;
_root.scoreBoard.meter.tween("_yscale",.5,.3);
_root.count = 0;
secondsLeft = 0;
clearInterval(goDrink);
goDrink = setInterval(drinkGenerator,700);
clearInterval(goTimer);
goTimer = setInterval(startTimer,1000);
}
fallingDrink = function()
{
this._y+=this.spd;
if(this._y > 340 && this._y < 420)
{
if (this.hitTest(_root.santa.santasMouth))
{
attachSFX(this,this.sfx,"sfx",20);
_root.variableSpeed += this.potency;
var perLoaded =
int((_root.variableSpeed/20)*100);
_root.scoreBoard.meter.tween("_yscale",perLoaded,.4);
_root.santa.santasMouth.gotoAndPlay(2);
if(_root.variableSpeed > 20) //santa
drank too much
{
_root.santasWasted();
}
this.removeMovieClip();
}
}
//kill clip if drop too far
if(this._y > 550)
{
trace("mc dead")
this.removeMovieClip();
}
}
drinkGenerator = function()
{
var myDepth = _root.drinkContainer.getNextHighestDepth();
var randSpd = getRandomNumber(12,6);
var randX = getRandomNumber(660,105);
var randomID = getRandomNumber(_root.gameItems.length-1,0)
var randomItem = _root.gameItems[[randomID]][0];
_root.drinkContainer.createEmptyMovieClip("mc"+myDepth,myDepth);
_root.drinkContainer["mc"+myDepth].attachMovie(randomItem,"drink",1);
_root.drinkContainer["mc"+myDepth].drink._x = randX;
_root.drinkContainer["mc"+myDepth].drink.spd = randSpd;
_root.drinkContainer["mc"+myDepth].drink.potency =
_root.gameItems[[randomID]][1];
_root.drinkContainer["mc"+myDepth].drink.sfx =
_root.gameItems[[randomID]][2];
_root.drinkContainer["mc"+myDepth].drink.onEnterFrame = fallingDrink;
}
attrition = function()
{
if(_root.variableSpeed > 1)
{
_root.variableSpeed -=.5
var perLoaded = int((_root.variableSpeed/20)*100);
_root.scoreBoard.meter.tween("_yscale",perLoaded,.4);
}
}
startTimer = function()
{
_root.attrition();
_root.scoreBoard.score = 0;
_root.count++
secondsLeft = _root.totalSecondsToPlay - _root.count;
_root.scoreBoard.timer = secondsLeft + ":00";
if(secondsLeft <= 0)
{
if(_root.variableSpeed > 12)
{
_root.closingScreen.gotoAndStop("tooJolly");
attachSFX(_root.closingScreen,"puke","p",40);
}
else if(_root.variableSpeed < 8)
{
_root.closingScreen.gotoAndStop("notJolly");
attachSFX(_root.closingScreen,"snore","s",60,4);
}
else
{
_root.closingScreen.gotoAndStop("win");
}
_root.scoreBoard.timer = "00:00";
_root.stopGame();
}
}
recover = function()
{
_root.santa.onEnterFrame = _root.goSanta;
_root.variableSpeed = _root.variableSpeed*.2;
var perLoaded = int((_root.variableSpeed/20)*100);
_root.scoreBoard.meter.tween("_yscale",perLoaded,.4);
}
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders