ActionScript: Protect your Flash games on the web, sitelock all your games.

Share

If you want to submit your games on one game portals DO NOT UPLOAD YOUR GAMES WITHOUT A SITELOCK SCRIPT.

WHY ?

Your games can be “stolen” by game portals. Or if you didn’t finish your game it’s a really a “pain in the ass” to update your games spread on all the web.

I tried lot of code for sitelocking my games but some of them are in ActionScript 2.0 or totally out of date. Some of them can’t work with the “https” or without the “www” characters.
Another example when you to want to test your game on your local computer you have to comment the script. And you can forget to uncomment the sitelock script when you submit your game on the web.

So I decided to create my own script.

This is a short version of my script.
But this one is perfect for all uses.

Installation

Copy and Paste this code and add your domains into the array “[ ]” separated by commas :

["kongregate.com", ..., ...]

You can lock the local mode by adding a second parameter : false
The default value is set to true.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
sitelock(["kongregate.com","benoitfreslon.com"])

/**
 * Sitelock your swf file on domains
 *
 * @param   arrDomain   List of all authorized domains
 * @param   local       This swf can be played on local computer ?
 */

function sitelock(arrDomain:Array, local:Boolean = true):void {

    var isAut:Boolean = false;

    var url:String = root.loaderInfo.url;
    var arr:Array = root.loaderInfo.url.split("://");

    var domain:String = arr[1].split("/")[0];

    // localmode
    if (url.split("file://").length > 1) {
        if (local) {
            //trace("Local mode is autorized");
            return
        } else {
            destroy();
            return;
        }
    }
    for (var i:String in arrDomain) {
        arr = domain.split(arrDomain[i]);
        if (arr.length > 1) {
            isAut = true;
            domain = arrDomain[i];
            //trace("*** Sitelock: Domain found");
            break;
        }

    }
    if (! isAut) {
        //trace("*** Sitelock: Not authentified");
        destroy();
    }
    return;
}
/**
 * This function is called when the game is locked.
 */

function destroy() {
    // Domain error
    trace("*** Domain Error ***");
    root.alpha = 0
}
Posted on Friday January 13th, 2012 at 03:29 PM by admin · Permalink · Leave a comment
Share

In: ActionScript3 as3, Tip · Tagged with: , , , , , ,

ActionScript: Good practices in Flash developement

Share

Here some tips and a list of good practices in Flash developement.
These tips are usefull for coders and designers.

Prepare your layers

When you create a new .fla file prepare your layers like this :

Add a new layers “Actions” on the top of the list. This layer will be dedicated to ActionScript.
Then lock this layer to avoid adding  graphic elements here.

Lock the main script

In order to keep in sight your main script, I recommend to lock this script by clicking on the pin on the bottom of the Actions pannel like this :

Permit debugging

Enabled the Flash debugger to display more efficient error messages.

File> Publish settings… > Permit debugging

You can find this kind of message if you got an execution error : (My Flash player is in french language)

1
2
TypeError: Error #1009: Il est impossible d'accéder à la propriété ou à la méthode d'une référence d'objet nul.
    at Untitled_fla::MainTimeline/frame1()[Untitled_fla.MainTimeline::frame1:3]

This error is located on the 1st frame on line 3. So useful !

However you must uncheck this option before publishing your swf on the web.

The library

Order you symbols and your medias in folders. Name your folders with explicit names.

Name your folders by using the prefix “_”.
This tip can keep all your folders in the top of the list.
And you can name a symbol or a media like your foler.

Example:  _Ball Folder own the Ball symbol.

The library orders elements and folders by alphabetical order.
Your library is now more lisible.

Name your symbols and your medias correctly

When you name your symbols or you media, particularly MovieClips, Istrongly recommand using a capital letter on the first character.

Why ?

When flash adds a new MovieClip with ActionScript he uses the class name exported for ActionScript.
By convention a class name has always a capital letter on the first character.

var mc = new BlueScreenOfTheDeath();
addChild(mc)

However the symbol name match with the class name when you link the symbol for ActionScript. So keep the same name.

Naming convention

ActionScript looks like Java so use the Java naming convention.

http://en.wikipedia.org/wiki/Naming_convention_(programming)#Language-specific_conventions

 

 

Posted on Tuesday November 15th, 2011 at 11:19 AM by admin · Permalink · Leave a comment
Share

In: ActionScript3 as3, Tip

Rolling Jump – iOS highly addicting game

Share

Hello, I’m proud to present you my last game on iOS: Rolling Jump. The Flash version was designed and developed in may 2009.

The new version is co-published by Chugulu.

You can download the free version here. The free version is limited by the score : 10 000 pts max. Or buy the full version here for $1.49.

Enjoy! And thanks to the Chugulu Team.

Description

Help Lighty save the light of the world by escaping from the dark evil creatures in this incredibly FUN and ADDICTING game! Simply jump from each wheel up into the sky and stars to protect the light of the world.

In Rolling Jump, your goal is to help the hero, Lighty, jump up into the sky and away from the dark evil creatures as fast as possible. Learn secrets of the game like double tapping, jumping onto walls, and discover how to attain the rainbow path to help Lighty save the light of the world, and ultimately prove his worth.

★ 7 levels to discover the stars
★ Increasing difficulty and real challenge for the hardcore gamers
★ Multiply your score x5 with perfect jumps
★ Use wall to bounce and reach upper wheels
★ Compete in a worldwide ranking via Game Center
★ Compare your score with your friends and challenge them !
★ Cute Retina graphics

Get free tips and be the first to hear updates about Rolling Jump on Facebook :
http://www.facebook.com/rollingjump

Posted on Friday November 4th, 2011 at 04:03 PM by admin · Permalink · One Comment
Share

In: Games, iPhone, News

Nano War 2 finally playable

Share

Finally the sequel of Nano War 1 released in november 2007.

I hope that new game will be a great success llike the first episode.

Every humans own billons of nanoscopic cells.
Some of these cells are doomed to protect our organism and fight foreign organisms.
Even confined to smaller and unlikely places the war is present.

Welcome on Nano War 2.

Play Nano War 2 on Kongregate.

What’s news ?

Have fun!

Posted on Tuesday June 28th, 2011 at 01:51 PM by admin · Permalink · Leave a comment
Share

In: Flash, Games, Nano War · Tagged with: , , , , ,

Garden Rush : Facebook time management game

Share

If you like or if you don’t like vegetables, fruits, salads you can play Garden Rush on Facebook.
Garden Rush is a time management game but don’t worry it isn’t a percistant game like City Ville.
And if you like Alice Greenfingers you will also like Garden Rush.

The gameplay loop look like this one :

Plant > Arose > Weed > Seasonal illnesses > Prune > Collect > Sell

Play Garden Rush on Facebook

The game is actually fun and addictive and the graphics are pretty.  Nice work team!

The game was ordered by MesmoGames, the owner of Bouncing Balls or Gems II.
Exkee developed the game and I worked as an ActionScript coder and as a lead director for the first period.

Posted on Friday June 10th, 2011 at 11:06 AM by admin · Permalink · One Comment
Share

In: Flash, Games, News · Tagged with: , , , ,

Roll n Jump : iphone free on the app store

Share
Roll n Jump : Iphone is available on the app store for free since yesterday.
The Itunes link: http://itunes.apple.com/us/app/roll-n-jump/id428781116?mt=8&ls=1
This is my first game on iOS.
Please make a descent review a rate the game :).
I developed this version for testing the iOS developement.
This game was developed in Objective-C with cocos2d Iphone libraries.
Roll and Jump is a skill game where the goal is to climb as high as possible by jumping from a rolling circle to another.
If you liked doodle jump you will love Roll n Jump.
Tap to jump from a wall or a circle or do a double jump in the air.
Clim and do the highest score as possible.
Posted on Tuesday April 5th, 2011 at 11:15 AM by admin · Permalink · Leave a comment
Share

In: Games, iPhone, News · Tagged with: , , , , ,

Roll n Jump : android, on the market

Share

You are welcome to download my game Roll n Jump for free from the Android Market:
https://market.android.com/details?id=air.com.benoitfreslon.rollnjump

Game Description

Roll n Jump is a skill game where the goal is to climb as high as possible.
Roll and Jump is a skill game where the goal is to climb as high as possible by jumping from a rolling circle to another.
Tap to jump from a wall or a circle or do a double jump in the air.
Clim and do the highest score as possible.

Screenshots

Posted on Thursday March 24th, 2011 at 07:07 PM by admin · Permalink · Leave a comment
Share

In: Android, Games · Tagged with: , ,

Nano War 2 : Gameplay video, singleplayer

Share

Posted on Wednesday March 16th, 2011 at 03:56 PM by admin · Permalink · Leave a comment
Share

In: Flash, Games, Nano War · Tagged with: , , , ,

Poker Geeks Left Out in the Cold by Apple (but Loving Android)

Share

Apple’s iPhone has been a huge success and its iPad tablet has gotten off to a hot start as well, but Apple’s strict policy towards gambling apps in the App Store have left a lot of poker geeks out in the cold. In many ways the iPhone and iPad are the poker players’ dream device, letting them enjoy all the action on the fly and cram in a few hands here and there when they have some spare time, whether at work, waiting for friends, or working on ActionScript projects like how to create a gravity like a Mario platformer.

The only hitch in those plans is while there are a ton of poker apps available for the iPhone and iPad, none of them let poker fans play on the two major online sites — Full Tilt and PokerStars. Apple has adopted a strict policy to the types of apps it approves for listing in the App Store and so far any app that can be used for real money wagering at a site that accepts US players has gotten the cold shoulder. Throw in Apple’s refusal to support Flash (which rules out the possibilities of players using any of the available Flash-based no-download poker rooms or casinos) and you’ve got a lot of frustrated poker players ready to chunk their iPhone out the window.

Frustration with Apple isn’t new for poker players, as it took years for all the major sites to provide Mac poker clients for players. While there’s no great solution to the current problem, it’s an area in which owners of Android devices are having the last laugh. With much looser restrictions on what can be distributed in the Android Market, many poker app developers are focusing on Android apps instead. Full Tilt has already made some of its real money games accessible through an Android app, with other online poker sites to follow shortly.

As was the case when developing poker sites for Mac clients, online operators have to balance a lot of factors when developing clients and apps, and potential market size is an important one. While some have held back on developing Android apps for poker and casino gaming, the rising popularity of Android devices is making it a market that can no longer be ignored, likely resulting in more and more poker apps coming to the Android Market soon.

Olivier MacLennan

Posted on Wednesday March 9th, 2011 at 01:57 PM by admin · Permalink · One Comment
Share

In: News · Tagged with: , , ,

ActionScript: Tutorial How to create a gravity like a Mario platformer

Share

In this little tutorial you will learn how to create a gravity like a Mario platformer.

Let’s start!

Get files

Create the Hero MovieClip

Add the jump script

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// The game gravity
var gravity = 0.8;

// The floor position (y)
var floor = 300;

// Add the hero MovieClip
var hero = new Hero();
// Set the x position
hero.x = 550/2;
// Set the y position on the floor
hero.y = floor;
// Set the hero state to "stand"
hero.gotoAndStop("stand");

// Add hero on the display list
addChild(hero);

// Create and set the speedY property to 0
hero.speedY = 0
// Create and set the jump impulsion to 10
hero.impulsion = 10;
// Add an enter frame event
hero.addEventListener(Event.ENTER_FRAME, heroEnterFrame)
function heroEnterFrame (pEvent)
{
    // On each frames...

    // Set the world gravity
    hero.speedY += gravity;

    // Move the hero with his speedY
    hero.y += hero.speedY;

    // If the y property is larger than the floor position
    if (hero.y > floor)
    {
        // Set the hero on the floor
        hero.y = floor
        // Cancel the current speed
        hero.speedY = 0;
        // Change the state to stand
        hero.gotoAndStop("stand");
    }
}

// Add a mouse event on the stage
stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown)

function mouseDown (pEvent)
{
    // When the user click on the stage...

    // If the hero is standing
    if (hero.currentLabel == "stand")
    {
        // Set the new speedY with the hero impulsion
        hero.speedY = -hero.impulsion;
        // And change the state to jump
        hero.gotoAndStop("jump");
    }
}

Get Adobe Flash player

Download sources: www.benoitfreslon.com_Create_gravity_like_a_mario_plateformer

Posted on Wednesday February 2nd, 2011 at 02:21 PM by admin · Permalink · 7 Comments
Share

In: ActionScript3 as3, Game Design, Tip, Tutorial · Tagged with: , , , , , , , ,