Thursday, October 18, 2007

Feeding Whinsey



I first made a page like this long ago in JavaScript. Thought I'd rebuild it in Flash. woah was that a lot of code. Have fun.

7 comments:

Linda Davick said...

Not able to comment. Speechless with joy.

Namowal (Jennifer Bourne) said...

I think I popped your horse. Sorry about that. ;)
p.s. Pardon my ignorance, but what specifically is this code you speak of?

Anonymous said...

what fun! thanks
i can enjoy eating all these things vicariously
and I'd better go paint some cakes and things now like Wayne Thiebaud

Sally said...

Namowal, It's ActionScript 2.0 I have a book about Actionscript 3.0 that weighs seven pounds and is scary. This is Flash code. It looks like this:

stop();
var dragging=false;
var eat=1;
pik=[1,0,1,1]
function eatup(){explain._visible=false;
var baa=Math.floor(Math.random()*pik.length);
//trace(baa)
eat+=pik[baa];
eaten=eat.toString();
//status_txt.text =eaten//+" "+pik[baa];
return(eaten)
}
var eaten=eat.toString();
var foodo1 = new Object();
foodo1.target=f1
Mouse.addListener(foodo1);
foodo1.onMouseMove = checkbabe;
foodo1.onMouseUp = gobble;

var foodo2 = new Object();
foodo2.target=f2
Mouse.addListener(foodo2);
foodo2.onMouseMove = checkbabe;
foodo2.onMouseUp = gobble;
var foodo3 = new Object();
foodo3.target=f3
Mouse.addListener(foodo3);
foodo3.onMouseMove = checkbabe;
foodo3.onMouseUp = gobble;

var foodo4 = new Object();
foodo4.target=f4
Mouse.addListener(foodo4);
foodo4.onMouseMove = checkbabe;
foodo4.onMouseUp = gobble;
var foodo5 = new Object();
foodo5.target=f5
Mouse.addListener(foodo5);
foodo5.onMouseMove = checkbabe;
foodo5.onMouseUp = gobble;
var foodo6 = new Object();
foodo6.target=f6
Mouse.addListener(foodo6);
foodo6.onMouseMove = checkbabe;
foodo6.onMouseUp = gobble;

var foodo7 = new Object();
foodo7.target=f7
Mouse.addListener(foodo7);
foodo7.onMouseMove = checkbabe;
foodo7.onMouseUp = gobble;
var foodo8 = new Object();
foodo8.target=f8
Mouse.addListener(foodo8);
foodo8.onMouseMove = checkbabe;
foodo8.onMouseUp = gobble;

var foodo9 = new Object();
foodo9.target=f9
Mouse.addListener(foodo9);
foodo9.onMouseMove = checkbabe;
foodo9.onMouseUp = gobble;


function checkbabe(){
if(dragging==true){
if (this.target.hitTest(zone1)) {
var dest="zz"+eaten+"1";

whin1.gotoAndStop(dest);
}else if (this.target.hitTest(zone2)) {

whin1.gotoAndStop("zz"+eaten+"2");
delete this;}
}}

function gobble(){
if (this.target.hitTest(zone3)&&dragging==true) {

whin1.gotoAndPlay("zz"+eaten+"3");
this.target._visible=0;
dragging=false;//try that!
delete this;
}

}


f1.onPress=function(){ this.startDrag(false);
dragging=true;}
f1.onRelease= function(){stopDrag();dragging=false}
f2.onPress=f3.onPress=f4.onPress=f5.onPress=f6.onPress=f7.onPress=f8.onPress=f9.onPress=f1.onPress;
f2.onRelease=f3.onRelease=f4.onRelease=f5.onRelease=f6.onRelease=f7.onRelease=f8.onRelease=f9.onRelease=f1.onRelease;

Namowal (Jennifer Bourne) said...

You weren't kidding with the "lot of code" comment. It looks a bit like LSL, the scripting language from Second Life. Perhaps they share a common ancestor.

Anonymous said...

I'm back, just checking on things. This makes me so hungry.

Sally said...

Namowal, it's related to JavaScript. Many scripting languages look similar. The ones that have looked oddest to me are Lingo, now mostly passe- the Director language-- and the new version of ActionScript which is all about objects and classes and makes me feel really stupid.