PDA

View Full Version : Drunken Flash


dzy2566
01-07-2004, 12:45 PM
No, it's not what it sounds like................... ;)

Well we've been talking about a new challenge, so how about this one?

Rules:
==================

<35 lines
all script, that means no attachMovie
give your project a clever and descriptive title, don't just post your script
no semicolons..........just kidding

Theme:
==================
Think drunk, make flash. No, don't get drunk and make flash......thought it is fun. I don't want to say too much because I don't want to hinder your creativity but here are a few starter ideas:


simulate drunk vision
simulate impaired control/mobility/functionality
simulate drunken interactions
can be metophorical, doesn't have to be w/rt inebriation

There's so many options. Think about what you see, think, do, how you act, how you feel, your capabilities, etc. when you are drunk. If you've never been drunk, spin around a lot before sitting down to work. Good luck!

I'll try and post something soon, though I'm not even sure how I want to approach this yet.

splict
01-07-2004, 12:55 PM
funny, i was thinking about a drink related challenge, because of subquark's asking about drink recipes. I couldn't come up with anything though. This should be fun. :)

dzy2566
01-07-2004, 12:58 PM
I hope so. Yeah, that's probably why it popped into my head.

@ subquark: I gave you a recipe, you owe me a script ;)

subquark
01-07-2004, 01:01 PM
hm, I like it. I had put out a challenge a long time ago:

http://www.actionscript.org/forums/showthread.php3?s=&postid=148658&highlight=cocktail#post148658

But tell you what, we should do a virtual cocktail party on the forum!!! That would be fun actually! What an awesome idea, you want to pull it together Timmee101? You can be the host!!! But don't invite Crunchy, he gets nuts some times . . .

went on to say: let's make party games, invitations, anything drink related (btw, proof that I was working on the ball script over 5 months ago)

keep in mind that I have to drink before I code! :p

dzy2566
01-07-2004, 01:02 PM
Well, then you're a perfect candidate for this challenge. :p

subquark
01-07-2004, 01:05 PM
hold on, let me get the olive out of my ear, . . . now what did you say? surely I misunderstood you! :p

subquark
01-07-2004, 01:06 PM
so dzy2566 what do you do for a living to have as much time as I do to goof off? really eLearning development?

splict
01-07-2004, 01:15 PM
i gotta go to the liquor store now :D so I can focus, or unfocus, whatever. I need a reference, yeah, thats a good excuse.
just one thing I'm not totally clear on- what counts as a line - but this is the way I understand it
drink = function () { //counts as a line
if (BAL > .25) { //counts as a line
person.onEnterFrame = function () { // counts
puke(); // obviously counts
} // doesn't
} else { // does
delete person.onEnterFrame;// does
drinkMore(); // obviously does
} // doesn't
} // doesn't

subquark
01-07-2004, 01:27 PM
this looks like one line to me from the opening { to the closing}.

drink = function () { if (BAL > .25) {person.onEnterFrame = function () { puke(); } } else { delete person.onEnterFrame; drinkMore(); } }

technically, yes . . .nice function btw :D

splict
01-07-2004, 01:33 PM
yeah, but then you could fit tons of stuff into just one function, so it would have to be more than one line. I'm just not sure about the else statement and the declaration statement, etc. Looking back the function doesn't really work right but it was for illustrative purposes. besides the BAL should be much higher ;)

dzy2566
01-07-2004, 01:46 PM
Everyone bends the rules a little. I would say write your script without crunching it up. Then start packing stuff into one line if you really have to. But honestly, it doesn't really have to be 35. It's sort of like the speed limit. If the speed limit is 65 and you're doing 75, it's not that big of a deal. But if the speed limit is 5 and you're doing 15, then you're more than double the speed. Just keep it reasonable..........it's a friendly competition. The cooler it is and the less lines >> the better the script. Just have fun with it.

And just for a reference, I'd call your earlier script 7 lines. Count everything but the closing }. One operation or code snippet per line. I can think of another way to count lines, but really it's too complicated to describe, plus like I said it's only a friendly competition.

EDIT: Plus part of the fun is trying to see how compact you can make your code. Not visually, but in practice (though compact in practice will lead to visually).

splict
01-07-2004, 01:53 PM
cool, thanks. I know its friendly and not strict, I just wondered how I should be counting as a reference. I was doing it the same way you are.
Hope your spinning visions are coming along well :)

subquark
01-07-2004, 02:17 PM
yeah, I agree with the standard counting . . . but maybe some giganto mega funtion that does anything?

was it here that there was that huge slideshow code?? I mean it was long as heck!

dzy2566
01-07-2004, 02:22 PM
Ok, here's a quick 5 minutes crack at the sucka. Maybe I'll revise it soon, maybe I'll start over with a new idea.//click the screen to have a beer
depth = 1;
walkingSpeed = 25;
beers = 0;
function createWall() {
wallSection = _root.createEmptyMovieClip("block"+depth, depth);
wallSection.lineStyle(1, 0x000000, 100);
wallSection.moveTo(-25, -25);
wallSection.lineTo(25, -25);
wallSection.lineTo(25, 25);
wallSection.lineTo(-25, 25);
wallSection.lineTo(-25,-25);
wallSection._x = 550/2;
wallSection._y = 400/2;
wallSection.onEnterFrame = function() {
this._xscale += walkingSpeed;
this._yscale += walkingSpeed;
this._rotation +=1*beers;
if(this._xscale - walkingSpeed*5 == 100){ createWall() };
if(this._xscale > 2500){ removeMovieClip(this) };
};
depth++;
};
_root.onMouseUp = function(){beers+=.3;};
createWall();

subquark
01-07-2004, 02:28 PM
wow! I can't wait to get home and try it! Good job, you WIN! :)

splict
01-07-2004, 02:29 PM
@ dzy2566 Nice :) I saw these square things when I was looking through the old challenges. Definately a good start, but if you can do that with 23 lines, I wanna see what you can do if you pack in 35 lines of code :D

@subquark you mean 'The MAMMA of all prototypes ever created'? :) yeah buggedcom did a crazy function for that. Talented stuff

dzy2566
01-07-2004, 02:35 PM
Square things from the old challenges????

subquark
01-07-2004, 02:48 PM
yeah, that's it: buggedcom!

maybe you should go for 50 lines, that way it'll be twice as good as Bit-101! :p

dzy2566
01-07-2004, 02:50 PM
Now I have no idea what's going on? What about Bit-101.com? Squares? Oh.............I need a drink. :p

subquark
01-07-2004, 02:56 PM
is'nt Bit-101 the one that does the 25 lines or less annual contest? :confused:

I have no clue what he is babbling about with the squares thing?

A drink? Good idea. And boyzdynasty just said I turn any thread into drinking! The nerve, btw, I need ideas for flashmartini.com! Hey, I'll be glad to post the contest files on that! Ah ha! :)

50 line AS only contest and an under <20 KB interface design! Due by March 26th!

dzy2566
01-07-2004, 03:11 PM
How about a drinking games section. Not programmed games, like text explaining good party games. Flash/Drinking annecdotes. I don't know. Let's make it a fun site, I'll contribue material if people come up with what would be neat. Of course if I make anything especially good, it's going on my portfolio site as well :D

splict
01-07-2004, 03:26 PM
I would happily contribute to flashmartini with some good drinking games and such :)
about the squares: I was refering to this thread which has very similar stuff:
http://www.actionscript.org/forums/showthread.php3?s=&threadid=30492
but I see now that you weren't even involve in that thread so never mind.
I better get started, I keep getting distracted:(

subquark
01-07-2004, 03:31 PM
text explaining games? so that you can make the games? really?

Okay, sounds good to me and fun for you!

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --











fine print: any further correspondence, including games, game concepts, or anything that makes a buck becomes the sole property of subquark. in fact anything that makes a buck will be matched by you, the reader. all intellectual property is automatically placed in the assets of subquark. this agreement is binding in all 50 United States, and all Canadian provinces with the exception of Newfoundland and sometimes PEI, and some of the European Union, but only the fun countries there, and Australia ;cause they are pseudo British, but not the Kiwis, they are exempt. any said violations of this agreement constitute a $50,000.00 penalty payable to subquark

dzy2566
01-07-2004, 03:36 PM
Wow, that does look a lot like mine. I hadn't even seen that either. Oh well, it's not like I thought I had come up with anything groundbreaking :D

dzy2566
01-07-2004, 03:38 PM
Oh, I'm sorry. I just meant like......

Rules of Asshole:......
Rules of Three Man:......
Rules of Beer Pong:.......

But perhaps game tutes might be interesting. Time consuming, but interesting.

subquark
01-07-2004, 03:39 PM
:confused: okay, a contest and a fun cocktail themed section! :)

subquark
01-07-2004, 03:51 PM
game tuts? sure, I'll put them up and list you as the author of course (Tutorial by Your Real Name, also known as subquark on as.org! :p )

splict
01-07-2004, 04:06 PM
less chit chat and more scripting or my entries gonna whip you all:p
-splict (*who really hopes you know he's just kidding*)

subquark
01-07-2004, 04:18 PM
Aye, aye, Sir! Oh, that does not apply to me. I'm done with all my scripting (see the sig) :p

splict
01-07-2004, 04:19 PM
how long till you get home? you have to participate, after all you started this whole drinking thing. ;)

subquark
01-07-2004, 04:23 PM
I get home in about 4-5 hours and then some real web work for a client, but I want to start thinking about really holding this contest thing! :)

splict
01-07-2004, 07:01 PM
Well, I kind of cheated with that first line, but not technically, I guess ;)
Click on drink (and hold) to drink alchohol
Release to sober up

Things to fix:
1. Ugly coding
2. better spinning function - I just threw one in there that looked kinda cool - didn't realize how it jumps when you press/release till now.
3. Drink fades instead of going down, cause I'll have to redo how I draw the stuff in order to easily scale it down.
4. Some code that won't work when its more compact and I don't know why.
5. Bad artistry :o

Will work on it more later but I'm gonna take a break for a bit.
Enjoy! :D

-splict
newer version on lower post

dzy2566
01-07-2004, 08:12 PM
Very cool. I like it! No I have to come back with one of my own, that hasn't already been done in another forum (though unbeknownst to me)

subquark
01-07-2004, 09:45 PM
hey that code really works and it's really fun. It made me laugh! Thanks.

35 lines, not bad, so do you think that's a good number? I guess we could have a few categories: 35 and under, 50 and under and Godzilla (no limit)?

That is such great code, really a riot! :D

splict
01-07-2004, 10:24 PM
yeah - it works - but I would consider 609 characters on one line as cheating - i could slim down the graphics though, I guess.
Thanks for the feedback guys - and the contest idea - its fun to do :D

cleaned up the code a bit,
fixed the spinning so it looks a bit better - though I do think I learned that circle stuff from someone else - here I think.

/*================================================= ============
LEGEND OF DRUNKEN FLASHER by splict
v0.6
35 lines
================================================== ===========*/
// build table and glass -----------------------------------------------
aSceneInfo = new Array("leg1", 0xC6A639, -185, 125, 200, 125, 200, 207, 185, 207, "leg2", 0xC6A639, -370, 125, 385, 125, 385, 207, 370, 207, "leg3", 0xC6A639, -207, 178, 222, 178, 222, 260, 207, 260, "leg4", 0xC6A639, -392, 178, 407, 178, 407, 260, 392, 260, "toptop", 0xC6A639, -178, 110, 382, 110, 420, 163, 194, 163, "topfront", 0xC6A639, -194, 163, 420, 163, 420, 183, 194, 183, "topside", 0xC6A639, -178, 110, 194, 163, 194, 183, 178, 130, "glass", 0xE9E9E9, -308, 78, 359, 78, 338, 121, 338, 143, 349, 149, 318, 149, 329, 143, 329, 121, 308, 78, "liquid", 0x0099FF, -316, 83, 351, 83, 333, 111, "end");
function drawWorld(who) {
_root.createEmptyMovieClip(who, x++);
for (i = 0; i < aSceneInfo.length; ) {
if (typeof (aSceneInfo[i]) == "string") {
current.endFill();
current = _root[who].createEmptyMovieClip(aSceneInfo[i++], depth++);
current.lineStyle(1);
current.beginFill(aSceneInfo[i++]);
mt1 = Math.abs(aSceneInfo[i++]);
mt2 = aSceneInfo[i++];
current.moveTo(mt1, mt2);
} else {
lt1 = aSceneInfo[i++];
lt2 = aSceneInfo[i++];
current.lineTo(lt1, lt2);
}
}
}
drawWorld("world1");
drawWorld("world2");
// make things spin -------------------------------------------
_root.onEnterFrame = function() {
px = Math.cos(z += .2) * width;
py = Math.sin(z) * height;
world1._x = px;
world1._y = py;
world2._x = -world1._x;
world2._y = -world1._y;
_root.world1._alpha = _root.world2._alpha = 100 - width;
};
_root.world1.glass.onPress = _root.world2.glass.onPress = function () {
_root.world1.onEnterFrame = function() {
if (_root.world1.liquid._alpha > 0) {
_root.world1.liquid._alpha = _root.world2.liquid._alpha -= .2;
height = width += .2;
}
};
};
_root.world1.glass.onRelease = _root.world1.glass.onReleaseOutside = _root.world2.glass.onRelease = _root.world2.glass.onReleaseOutside = function () {
_root.world1.onEnterFrame = function() {
if (width > 0) {
height = width -= .15;
}
};
};


not sure about this though:

// why does this work-
lt1 = aSceneInfo[i++];
lt2 = aSceneInfo[i++];
current.lineTo(lt1, lt2);
// but not this????
current.lineTo(aSceneInfo[i++],aSceneInfo[i++]);

-splict

dzy2566
01-08-2004, 11:11 AM
I didn't see anything when I tested your second script.

P.S. I hope to come up with something good today, but no promises. :D

splict
01-08-2004, 11:54 AM
works fine for me. no errors? sure you got it set at 1.0 (if you have 2004)?
I expect something cool from you. Cooler than my lame attempt at drunk vision, anyways. I did drink a martini while I wrote it though. :D
Well, only two entries, huh? :( Subquark? Anyone???

dzy2566
01-08-2004, 11:59 AM
Yeah, good call on the 1.0. I see it (them) now. I like this version of it better. Nice work. I'll try and crank something out at work today or after work tonight.