Posts Tagged Actionscript

Posted on Programming

Chromatic Restitution!

Last Game Demo Festival (GDF4, if i’ve decremented correctly) I thought up a neat but simple game idea, and my implementation was truly terrible. The result? A submission known as Worst Game Demo Ever (WGDE) which shames me even today.

The problem was of course laziness.
At least some representation of physics was important to the design, and I had a very specific use of sound in mind. Without those it wasn’t so much a game demo, and very much wasn’t the one I’d intended.

I tried again with GDF5, but decided to try a physics library and settled on Box2d for flash. It wasn’t as difficult as I’d expected! I’m happy with how using it turned out. There were some strange issues that were almost definitely due to my misuse of the library, but avoidance solved those as it does most things.

In order to add a certain potential for complexity, each x position was to play a different note on collision. I totally (sorta) accomplished this using frequencies, sine waves, and the SampleDataEvent. For consistency in representation, the sound generated is stereo – loudest on the side it’s closest to (this is not the case in the example below).

Click the area below and then hit keys to play sounds

Once sounds and physics were basically implemented, I added the import game-elements including and consisting solely of an ability to accrue points. The point system works as follows:

var coeff = 1;
var bonus = 0;
var base = 10;
switch( e.value ) {
	case 2:
		coeff = 1.2;
		break;
	case 1:
		coeff = 1.4;
		break;
	case 0:
		coeff = 1.6;
		bonus = 5*(++explosionChain);
		if ( ballPool >= maxBalls )
			ballPool++;
}
var p:Number = base*coeff+bonus;
points += p;
dispatchEvent( new GameEvent( GameEvent.SCORE_CHANGE, points ) );
// Make it harder
if ( points > 25 ) {
	maxBalls = 2;
}
if ( points > 100 )
	maxBalls = 3;
if ( points > 200 )
	maxBalls = 4;
if ( points > 350 )
	maxBalls = 5;
if ( points > 600 ) {
	maxBalls = 6;
}

Pretty simple! The more times you hit a ball, the more points you get. If you eliminate a ball, you get a bonus proportional to the length of your elimination-chain (the number of balls you have eliminated in a row).
At certain score levels, your number of maximum balls in current play increases. If the number of balls in the ball pool is greater than or equal to that value on an elimination, a ball will be added to your ball pool. This is done so that players can’t simply eliminate the last one ball over and over.

 

So that is Chromatic Restitution! It’s closer to what I’d wanted, and I am happy with the result.

Of course there are some things I wish I’d added but forgot with the distraction of ever decreasing distance to deadline. Additional sound events would have added texture: wooshes when you miss a ball, some sort of triumphant ring when you eliminate one – that sort of thing.
Particles or some other animation on elimination, or even bounce (sparks) would have been nice. In general more colours, lights and sounds and movement. Casinos have taught me people love those things.

Karl added an OpenID thing to the GDF library. I attempted to add it to the GDF Overlay prior to my submission, but failed and was too tired and confused to worry about it. That would have been a nice addition as well.

 

Posted on Programming

Tic Tac Whatsit

Long days ago I spoke with a dentist of game demos, and of a festival dedicated to those. We talked of Ticktacktoe, a classic game of boxes and shapes — a boring, beatable game, but an easy one to program. It’d be easy to program, right? We could probably make one with flash in less than thirty minutes, couldn’t we? At least one way to find out!

Yup. Sure could!
(more…)

Posted on Art

Save the princess, she is feeble

I can tell from the hurtful lack of emails and comments that this past week without update has been noticed by most of you.

I can explain. And this isn’t just one of those explanations meant to stall for time and an opportunity for escape. It is that, but also nothing more.

There were a lot of things to be done after coming back from Victoria this past weekend. Most interesting being a second game demo contest with Shaun Kiernan, to be judged by his girl-friend’s sister’s boy-friend, Richard.
(more…)

Posted on Programming

A Flash gallery frontend

I wrote a flash gallery front-end a week or so back. There’s a picture of it above.

Just kidding, it’s an actual instance! Some of the thumbnails might take a while to load. That is because they are not thumbnails but giant, giant images.

It uses ExternalInterface and Javascript to display the descriptions in the HTML. I’ll post the relevant code with an explanation next time, but let me tell you right now – having more than one gallery per page doesn’t pose a problem ( programmatically ).

The gallery is described by XML, and added to a page with a simple Javascript call.
(more…)

Posted on Programming

Using ExternalInterface to communicate between Javascript and Actionscript 3: Or, I want Paypal buy now buttons in Flash

The statement that Flash TextAreas ( TextFields, etc. ) can display HTML can be deceptive. They can certainly display a subset of HTML. But this is a very limited subset, and for good reason.

While it’s easy to understand why this is the case, it can still be frustrating.

Say, for example, you’re building an image gallery and would like to have some of Paypal’s buy-now buttons in the image descriptions. A Paypal button can be perhaps a deceptive thing — it’s a tiny form, whose only visible element is the buy-now image — which cannot easily be accurately displayed by Flash.

But don’t worry, especially if your Flash will be displayed within a browser, for that is a thing built to display HTML. It’s one of its primary and most useful purposes.
(more…)

Posted on Programming

a flash slideshow

JB and I have basically mastered the test game I made (from the last post). I think I should make another one. Maybe a nibbles/worm/snake styled game? That should be easy-ish.

I’ve been doing a lot of flash lately (mostly Actionscript 3, thankfully). A week ago, I posted a Ron C. concept in a flash slideshow.

Oh, yeah, I made a slideshow that is super easy to use if you were the one who made it and did so recently.
(more…)