Google recognizes I am an authority
After giving me a PR7, then slapping me down to PR4 because (Google said) I was selling links, after giving me a PR5 and after marking my blog as a blog that could harm your computer, now Google says I am an authority.
Look what happens when you search for my name:

An authority result!
Now I have to update “My Works” page…
How to sitelock a Flash movie
Sometimes you need to make your Flash movie (or game) to work only on selected domains. Sometimes you may want to blacklist some domains so they can't display your Flash content.
This is called sitelocking, and means you lock a movie to a specific site.
Let's see how can you sitelock a Flash file.
The first thing we need to know is where the movie is been played.
With the _url property we can determine the absolute path of a movie clip.
I will create a movie with a text field instanced as domain with this actionscript:
domain.text = _url;
This is the result:
Next we have to determine the domain name, so we need some string functions. First we need to strip all characters before :// (:// included).
Using the split method, I'll split a the domain name into substrings by breaking it wherever :// is found, in this way:
domain_parts = _url.split("://");
domain.text = domain_parts[1];
Splitting the domain name by :// will create an array with its first element (at index 0) containing http (or https, or whatever I'll find before the ://), and the second element with the remaining part of the domain. Look:
We are few steps away from having only the domain name.
In the same way as before, now I have to split the string when I find a /
-
domain_parts = _url.split("://");
-
real_domain = domain_parts[1].split("/");
-
domain.text = real_domain[0];
Here it is:
Now, we are ready to sitelock the game. Just remember that some portals do not use their domain to host Flash games. For example, NewGrounds uses uploads.undergrounded.net while Kongregate uses chat.kongregate.com.
Anyway, the customer who will request to sitelock your Flash movie will tell you which domain you have to lock the game on.
Now, let's think about what to do when the movie is played in a site you don't want to be played. The easiest thing is making the root transparent so it will impossible for the surfer to use it.
-
sitelock("www.emanueleferonato.com");
-
function sitelock(url_to_lock) {
-
domain_parts = _url.split("://");
-
real_domain = domain_parts[1].split("/");
-
domain.text = real_domain[0];
-
if (real_domain[0] != url_to_lock) {
-
_root._alpha = 0;
-
}
-
}
This function will display the game only if played on my domain.
Now, the last interesting thing... how to sitelock to more than one site.
-
urls_allowed = ["www.emanueleferonato.com", "www.triqui.com"];
-
sitelock(urls_allowed);
-
function sitelock(urls_allowed) {
-
lock = true;
-
domain_parts = _url.split("://");
-
real_domain = domain_parts[1].split("/");
-
domain.text = real_domain[0];
-
for (x in urls_allowed) {
-
if (urls_allowed[x] == real_domain[0]) {
-
lock = false;
-
}
-
}
-
if (lock) {
-
_root._alpha = 0;
-
}
-
}
This one only allows movie to be played on this domain and on triqui.com
Hope you will find it useful
BallPusher: new Flash game prototype
Here it is another fresh Flash game prototype by FrozenHaddock, that jumps from the forum to the blog. FrozenHaddock was playing around with Flash as he says, when he come out with an interesting prototype.
Something I was fiddling about with, might work well as a puzzle game of some
sort. Some people might find it interesting :)
I found it very interesting... and probably I'll turn it into a complete one-day game.
In this prototype actionscript is not in a single frame but every object has its own code.
This is the code for the pusher (that's not a drug dealer in this case)
-
onClipEvent (load) {
-
rad = 100;
-
r = 15;
-
}
-
onClipEvent (enterFrame) {
-
xdis = (this._x-_root._xmouse);
-
ydis = (this._y-_root._ymouse);
-
distance = Math.sqrt((xdis*xdis)+(ydis*ydis));
-
this._x = _root._xmouse += xdis/distance*rad;
-
this._y = _root._ymouse += ydis/distance*rad;
-
angle = Math.atan2(ydis, xdis);
-
this._rotation = angle*57.2957795;
-
for (i=0; i<5; i++) {
-
bi = _root["b"+i];
-
bi.r = (_root["b"+i]._width)/2;
-
xbidis = _root["b"+i]._x-this._x;
-
ybidis = _root["b"+i]._y-this._y;
-
bidis = Math.sqrt((xbidis*xbidis)+(ybidis*ybidis));
-
if (bidis<(this.r+bi.r)) {
-
force = bidis-(r+bi.r);
-
_root["b"+i]._x -= xbidis/bidis*force;
-
_root["b"+i]._y -= ybidis/bidis*force;
-
}
-
}
-
}
While every ball has this code
-
onClipEvent (load) {
-
r = this._width/2;
-
this._x = random(400)+50;
-
this._y = random(300)+50;
-
}
-
onClipEvent (enterFrame) {
-
for (i=0; i<5; i++) {
-
bi = _root["b"+i];
-
bi.r = (_root["b"+i]._width)/2;
-
xbidis = _root["b"+i]._x-this._x;
-
ybidis = _root["b"+i]._y-this._y;
-
bidis = Math.sqrt((xbidis*xbidis)+(ybidis*ybidis));
-
if (bidis<(this.r+bi.r) && bidist != 0 && this.r>=bi.r && !_root["b"+i].hitTest(_root.pusher.inner)) {
-
force = bidis-(r+bi.r);
-
_root["b"+i]._x -= xbidis/bidis*force;
-
_root["b"+i]._y -= ybidis/bidis*force;
-
}
-
}
-
}
And this is the result:
Download the source code and make it a playable game!
Special thanks to FrozenHaddock for sharing this code. He also runs a site, check it out.
Displaying enemy’s energy bar in Flash games
In almost all "kill the enemy" games you can see a green energy bar turning orange and red as the foe get wounded by our fire.
It's time to show you how can you do this.
In this example, I will start from the Flash prototype of a game like Balloon Invasion example but obviously you can apply the same concept to whatever game you want.
The first thing to do is drawing the energy bar. You can do it dynamically with Flash drawing functions but I suggest you to create your bar as a tween movieclip because Flash drawing functions only allow you to draw primitives while if you design your bar by yourself you can make it look better.
In my example, I have a 25 frames energy bar that goes from a full green bar to an empty red one.
Then, I include the bar movieclip in the enemy movieclip with a instancing it as bar
Now the actionscript does not change a lot...
-
Mouse.hide();
-
attachMovie("crosshair", "crosshair", 1);
-
attachMovie("tank", "tank", 2, {_x:450, _y:350});
-
fire_array = new Array();
-
fire_delay = 30;
-
just_fired = 0;
-
crosshair.onEnterFrame = function() {
-
this._x = _xmouse;
-
this._y = _ymouse;
-
};
-
tank.onEnterFrame = function() {
-
mousex = _xmouse-this._x;
-
mousey = (_ymouse-this._y)*-1;
-
angle = Math.atan(mousey/mousex)/(Math.PI/180);
-
if (mousex<0) {
-
angle += 180;
-
}
-
if (mousex>=0 && mousey<0) {
-
angle += 360;
-
}
-
if (angle>160) {
-
angle = 160;
-
}
-
if (angle<20) {
-
angle = 20;
-
}
-
firepower = Math.sqrt(mousex*mousex+mousey*mousey);
-
if (firepower>200) {
-
firepower = 200;
-
}
-
this.cannon._rotation = angle*-1;
-
};
-
function onMouseDown() {
-
if (just_fired>fire_delay) {
-
just_fired = 0;
-
angle = tank.cannon._rotation;
-
start_ball_x = tank._x+48*Math.cos(angle*Math.PI/180);
-
start_ball_y = tank._y+48*Math.sin(angle*Math.PI/180);
-
cannonball_fired = attachMovie("cannonball", "cannonball_"+_root.getNextHighestDepth(), _root.getNextHighestDepth(), {_x:start_ball_x, _y:start_ball_y});
-
cannonball_fired.dirx = Math.cos(angle*Math.PI/180)*firepower;
-
cannonball_fired.diry = Math.sin(angle*Math.PI/180)*firepower;
-
cannonball_fired.fire_coord_x = _root._xmouse;
-
cannonball_fired.fire_coord_y = _root._ymouse;
-
cannonball_fired.onEnterFrame = function() {
-
this._x += this.dirx/50;
-
this._y += this.diry/50;
-
dist_x = this._x-this.fire_coord_x;
-
dist_y = this._y-this.fire_coord_y;
-
dist = Math.sqrt(dist_x*dist_x+dist_y*dist_y);
-
if (dist<20) {
-
fire_array.push("explosion"+_root.getNextHighestDepth());
-
exp = attachMovie("explosion", "explosion"+_root.getNextHighestDepth(), _root.getNextHighestDepth(), {_x:this._x, _y:this._y});
-
exp.onEnterFrame = function() {
-
this._width += 2;
-
this._height += 2;
-
this._alpha -= 2;
-
if (this._alpha<0) {
-
for (x in fire_array) {
-
if (this.name == _root[fire_array[x]].name) {
-
fire_array.splice(x, 1);
-
}
-
}
-
this.removeMovieClip();
-
}
-
};
-
this.removeMovieClip();
-
}
-
};
-
}
-
}
-
_root.onEnterFrame = function() {
-
just_fired++;
-
new_enemy = Math.random()*100;
-
if (new_enemy<1) {
-
enemy = attachMovie("enemy", "enemy"+_root.getNextHighestDepth(), _root.getNextHighestDepth(), {_x:-40, _y:Math.random()*200+50});
-
enemy.speed = Math.random()*2+1;
-
enemy.energy = 100;
-
enemy.onEnterFrame = function() {
-
this._x += this.speed;
-
if (this._x>550) {
-
this.removeMovieClip();
-
}
-
for (x in fire_array) {
-
dist_x = this._x-_root[fire_array[x]]._x;
-
dist_y = this._y-_root[fire_array[x]]._y;
-
dist = Math.sqrt(dist_x*dist_x+dist_y*dist_y);
-
if (dist<(this._width+_root[fire_array[x]]._width)/2) {
-
this.energy -= 2;
-
this.bar.gotoAndStop(25-(this.energy/4));
-
if (this.energy<0) {
-
this.removeMovieClip();
-
}
-
}
-
}
-
};
-
}
-
};
And this is the result:
Download the source code and enjoy
A new player control concept
Well, I don't know if it's really new or some of you already saw it elsewhere... but I've never seen this way to control the player
It works this way: you move the mouse pointer. When you click the mouse, the player will move in the opposite direction of your mouse pointer. The closer the pointer, the slower the movement.
It's just a prototype, but remember that BallBalance was started from this prototype and ended with this sponsorship...
-
_root.attachMovie("ball", "ball", _root.getNextHighestDepth(), {_x:250, _y:200});
-
_root.attachMovie("pnter", "pnter", _root.getNextHighestDepth(), {_x:250, _y:200});
-
moving = false;
-
Mouse.hide();
-
pnter.onEnterFrame = function() {
-
this._x = _xmouse;
-
this._y = _ymouse;
-
};
-
ball.onEnterFrame = function() {
-
dist_x = this._x-_root._xmouse;
-
dist_y = this._y-_root._ymouse;
-
total_dist = Math.sqrt(dist_x*dist_x+dist_y*dist_y);
-
angle = Math.atan2(dist_y, dist_x);
-
this.arrow._rotation = angle*57.2957795;
-
if (moving) {
-
dir = this.arrow._rotation;
-
xspeed = total_dist/25*Math.cos(dir*0.0174532925);
-
yspeed = total_dist/25*Math.sin(dir*0.0174532925);
-
}
-
this._x += xspeed;
-
this._y += yspeed;
-
xspeed *= 0.9;
-
yspeed *= 0.9;
-
};
-
_root.onMouseDown = function() {
-
moving = true;
-
};
-
_root.onMouseUp = function() {
-
moving = false;
-
};
and the result is...
Download source code and make something decent.
Experiment: monetizing a Flash game - Part 8
Multipart tutorial: available parts 1, 2, 3, 4, 5, 6, 7, 8, 9
More than a month passed since the last update of the experiment. Now it's time to show you how things are going.
As you can see on the weekly updated widget, my games are still performing well, with the only exception of Tileball, that I will discuss later.
But let's see some details and goals: unfortunately the dollar is getting weaker and weaker against the euro so the minimum goal is now set to 46 dollars per hour of developing/branding/promoting, while only a month ago was 44.
Circle Chain: $71/hour
Chirstmas Couples: $62/hour
Tileball: $4/hour
GuessNext: $42/hour
Glomb: $96/hour
I'll make a more detailed report in next update, because the aim of this update is not showing my past games but introduce you my new one: BallBalance, at the moment released only on Kongregate, scored with a 2.93/5
The aim of the game is simple: You control a ball with the mouse, and you have to drop it on a balance. Once you drop it, you will control another ball that you have to drop, and so on. Every ball has a set weight and affects the balance according to its distance from the fulcrum. Match three or more balls of the same color horizontally or vertically to make them disappear. When a side of the balance hits the ground, it's game over.
Then I added some features to the game:
9 levels with increasing difficulty (the higher the level, the heavier te balls)
bonus points for quick combos or combos involving more than three balls
3 different powerups
MochiAds leaderboards
It's almost an one-week game (it took me 18 hours to make it) based on A new Flash game prototype post.
You should always check for new prototypes because new prototype = new game concept.
But the the thing I want to focus in this post is how did I try to monetize the game. I already reviewed flashgamelicense.com in the post Find a sponsor for your Flash game with Flash Game License and this game was a test drive to determine how this service works.
So I submitted the game when it was a pre-alpha with just some colored circles moving here and there, and to increase the appeal of the game I promised a review of the portal sponsoring it.
I thought "some minor portal will be happy to catch a review on my 3,000 unique visitors day blog for free!".
It's ironic how the portal that sponsored the game is one of the most famous ones in the web...
Well, as said, I received feedback from a sponsor after some hours, then I got a couple of non exclusive sponsorship requests and finally an exclusive sponsorship request with MochiAds allowed. I was about to accept the offer when Chris (flashgamelicense.com owner) told me that Kongregate would like to sponsor the game... and when I say "Kongregate" I mean
At this point, I could update the offer waiting for an higher bidder... but I thought Kongregate is a sponsor that a Flash game developer must have in his portfolio, so I accepted the offer.
I won't unveil at the moment how much Greg (Kong's owner) gave me for the sponsorship, but I'll tell you how his sponsorship works.
In my (and Chris) opinion, Kong's sponsorship is one of the best types of deals out there right now... it's a so-called "Primary License", that means I can still sell non-exclusive licenses to sites if I site lock the game to those sites. Otherwise the game must have Kongregate's logos and links in the game.
Moreover, I have MochiAds in the game (that won't be displayed in Kong) and will also get revenue share from Kongregate's site.
On the other side, the game must be only on Kongregate for the first week.
I am very excited for this sponsorship and I can't wait the week to be over so I can submit my game to other portals.
What did I learn?
Time to share my thoughts about this experience...
1) Once your game is complete, shut down your computer
No matter if it's a one day game or a one week game... when you are close to complete your game, you only think about releasing.
If you shut down your computer, once you turn it on again you will realize you forgot something or that enemy sprite could be better.
Don't be a victim of the "got-to-release-it-right-now" syndrome like most AAA games...
2) Once your game is REALLY complete, insert MochiAds and MochiBot
Once your game is really complete, create a MochiAds account if you don't already have one and insert both MochiAds ads and MochiBot statistics.
3) Upload your game to Flash Game License
Let this site work for you.
Create an account on flashgamelicense.com and upload your game, with your requests.
I have both a developer and a sponsor account in the sponsored one I can see a lot of three figures sponsorship offers... and some four figures too... there is no need to waste time looking for sponsors elsewhere... use that time to produce your next game!
For your security, you should sitelock the game to flashgamelicense.com (I'll write a tutorial about it next days) and encrypt it with a software like Amayeta’s SWF Encrypt.
The software costs $125, that's less than 10% of a single interesting sponsorship, and you can protect any amount of games with it...
4) Wait...
That's the hardest part. At this point you really want to release your game.
Just wait at least a week. Use that week to start making another game.
5) Publish it and remember who helped you
Once you deal with the sponsor logos placement, sponsorship policies and so on, publish the game.
At this time you have the money and you are very happy. Don't forget who helped you making this possible.
Send Chris 10% of the sponsorship for the service and feel free to buy me a beer, or twenty.
This is not mandatory, but if you give Chris his commission I am sure he will help you to get the best sponsorship he can, next time you upload a new game. And about my beer... well, I am italian... did you see The Godfather movie?
See you next time.
* Last minute update: Chris is co-owner of Flashgamelicense, and Greg is not the owner of Kongregate. He is in charge of community relations and sponsorships :)
Multipart tutorial: available parts 1, 2, 3, 4, 5, 6, 7, 8, 9
Create a nice Flash photogallery with gridNavigation component
Today I'll show you a Flash component that you will find very useful for a photogallery or an interactive portfolio.
Remember that there are thousands of sites showing their best photos/works, and you must show your work in an interesting way if you want to get noticed.
Personally, I don't click anymore on the classic "click here to open the image in a popup". We are in 2008, and we are looking for something new.
That's why I am going to recommend you the gridNavigation component by Flashloaded.
The gridNavigation is a thumbnail based navigational system or a portfolio/photo gallery in a grid or pyramid style layout. The thumbnail content is clickable and zooms in to display the selected full size content while the other thumbnails are pushed aside. Content can be external images, animated SWFs or movie clips. Content can be added or changed directly in the Component Inspector, through ActionScript or using an external XML file.
Ok... that was a simple cut/paste. When I review something, I do a test drive.
Like all components, you can install gridNavigation with a double click on the .mxp file provided in the package.
There is not any manual in the zip file provided by Flashloaded but you can find an complete guide at this link.
Let's start our fancy example!
First, from the Components window, drag and drop the component on the stage and set its size as you like.

Then, you can just play with the parameters in the component inspector like in the other million galleries released in these years, or feed the component with an XML file (much, much better).
Let's see this XML Read more
Flash prototype of a game like Balloon Invasion
One of the latest successful games released last week was Balloon Invasion.
It's a mix between an artillery and a defense game, with a World War II theme.
I made a little prototype of the game, that will be explained another day. It's nothing so interesting, just a mix between Create a flash artillery game and Managing multiple collision detection with Flash tutorials.
That's the good point when you write a lot of code: the more you write, the more you can recycle.
The main difference however is the firing system: enemies don't get hurt by bullets but mby explosions bullets make when they come to the spot you fired on... just like "real" artillery Read more


