In this tutorial I'm explaining the most basic way of doing it.
What's on stage?
Only 2 layers, the mask and the masked.
In layer 1, the masked one, I have an image and in layer 2, the mask, a MovieClip instanced as "torch".
The actionScript there is:
startDrag("torch", true);
Mouse.hide();
And that's all. With startDrag we tell the movie to drag our MovieClip with the mouse and then we hide our mouse.
Here you can see it in action
Saturday, January 19, 2008
Friday, January 18, 2008
Shots in the Darkness
After a week looking for a sponsor, I decided to release Shots in the Darkness with MochiAds. Yesterday I started promoting it and today I submitted it to Newgrounds. It has a 3.2 score, which I think it's pretty good. I'll keep you up to date with the MochiAds earning, so you can judge if they're useful.
Here you can play the game:
Here you can play the game:
Monday, January 14, 2008
Looking for sponsor
I haven't wrote anything in the last days because I was looking for a sponsor for my new game. I haven't found any yet, so I've made a decision: if on Friday I still haven't got a sponsor, I'll release it with mochiads.
Tuesday, January 8, 2008
Adding game
Let me show you "Learn to Add Up", a game we made for young children that ended in failure. Why? Because pages that offer games for kids don't sponsor games, and pages that sponsor games don't want games for young children. Maybe I can use MochiAds and MochiBot, as a little experiment...
Play it
Play it
Thursday, January 3, 2008
Flash "Find the differences" game creation tutorial - Part 2b
Let's have a look at the actionscript in the "4 differences" game:
Frame 1:
Contains:
-1 button, instanced as playbutton (the red one with the "play the game!" text)
Actionscript:
stop();
playbutton.onRelease = function() {
gotoAndPlay(2);
}
Very easy: telling the game to stop at Frame1 (stop();) and telling it to go to Frame 2 if the "playbutton" is released.
Frame 2:
Contains:
1 - 2 similar images
2- 4 MovieClips, instanced as "Rect1", "Rect2", "Rect3", "Rect4"
3- A dinamic text instanced as "congrat"
4- 4 buttons instanced as "Df1", "Df2", "Df3", "Df4"
5- A MovieClip called Timebar, without instance name
*Remember we have the "cursor" MovieClip in our library, linked as "cursor"
Actionscript:
stop();
differences_left = 4;
//Setting a new variable, "differences_left" and setting it to 4
Mouse.hide();
attachMovie("cursor", "cursor", 1);
cursor.onEnterFrame = function() {
this._x = _xmouse;
this._y = _ymouse;
};
//Hidding the mouse and attaching the cursor MovieClip and telling it //to have the same _x and _y coordinates as the mouse.
Df1.onRelease = function() {
// If you click on the 1st difference...
differences_left -= 1;
// The variable "differences_left" is decreased by 1
_root.Rect1._x = this._x;
_root.Rect1._y = this._y;
// The "Rect1" MovieClip's _x and _y become the same as the "Df1" //button _x and _y
Df1._x = 1500;
// And then, the "Df1" button's _x becomes 1500, so you can't see or //click on it
if(_root.differences_left == 0){
gotoAndPlay(3);
}
// Checking if the variable "differences_left" is 0, if so telling the //game to go to Frame 3, the one with the "You win" text
_root.congrat.text = "You found a difference! Only " + differences_left + " more to go";
// Making the "congrat" text become "You found a difference! Only x //differences more to go", where x is the current value of the //variable "differences_left"
};
Df2.onRelease = function() {
differences_left -= 1;
_root.Rect2._x = this._x;
_root.Rect2._y = this._y;
Df2._x = 1500;
if(_root.differences_left == 0){
gotoAndPlay(3);
}
_root.congrat.text = "You found a difference! Only " + differences_left + " more to go";
};
// The same as in the "Df1" button
Df3.onRelease = function() {
differences_left -= 1;
_root.Rect2._x = this._x;
_root.Rect2._y = this._y;
Df3._x = 1500;
if(_root.differences_left == 0){
gotoAndPlay(3);
}
_root.congrat.text = "You found a difference! Only " + differences_left + " more to go";
};
// The same, too
Df4.onRelease = function() {
differences_left -= 1;
_root.Rect4._x = this._x;
_root.Rect4._y = this._y;
Df4._x = 1500;
if(_root.differences_left == 0){
gotoAndPlay(3);
}
_root.congrat.text = "You found a difference! Only " + differences_left + " more to go";
};
// The same again
Now let's check what's inside the "Timebar" MovieClip:
5 Layers: stroke, mask, fill, dots and background
Take special attention at the masking (highlighted with a red rectangle in the image). The layer Mask is masking the layers "fill" and "dots", but not the layer background. (You can modify masking by right clicking on the layer>properties )
The layer Mask contains a MovieClip instanced as "bar".
And now, see the actionscript in the "Timebar" MovieClip (not inside it) :
onClipEvent(enterFrame){
this.bar._x -=0.25;
// The "bar" MovieClip's _x decreases
if(this.bar._x<=0){
// If it's _x gets to 0...
_root.gotoAndPlay(4);
// The game goes to Frame 4 ( the loser one )
}
}
Frames 3 and 4 only have a static text saying "Loser" or "You win" and a stop(); in its actions layer
Frame 1:
Contains:
-1 button, instanced as playbutton (the red one with the "play the game!" text)
Actionscript:
stop();
playbutton.onRelease = function() {
gotoAndPlay(2);
}
Very easy: telling the game to stop at Frame1 (stop();) and telling it to go to Frame 2 if the "playbutton" is released.
Frame 2:
Contains:
1 - 2 similar images
2- 4 MovieClips, instanced as "Rect1", "Rect2", "Rect3", "Rect4"
3- A dinamic text instanced as "congrat"
4- 4 buttons instanced as "Df1", "Df2", "Df3", "Df4"
5- A MovieClip called Timebar, without instance name
*Remember we have the "cursor" MovieClip in our library, linked as "cursor"
Actionscript:
stop();
differences_left = 4;
//Setting a new variable, "differences_left" and setting it to 4
Mouse.hide();
attachMovie("cursor", "cursor", 1);
cursor.onEnterFrame = function() {
this._x = _xmouse;
this._y = _ymouse;
};
//Hidding the mouse and attaching the cursor MovieClip and telling it //to have the same _x and _y coordinates as the mouse.
Df1.onRelease = function() {
// If you click on the 1st difference...
differences_left -= 1;
// The variable "differences_left" is decreased by 1
_root.Rect1._x = this._x;
_root.Rect1._y = this._y;
// The "Rect1" MovieClip's _x and _y become the same as the "Df1" //button _x and _y
Df1._x = 1500;
// And then, the "Df1" button's _x becomes 1500, so you can't see or //click on it
if(_root.differences_left == 0){
gotoAndPlay(3);
}
// Checking if the variable "differences_left" is 0, if so telling the //game to go to Frame 3, the one with the "You win" text
_root.congrat.text = "You found a difference! Only " + differences_left + " more to go";
// Making the "congrat" text become "You found a difference! Only x //differences more to go", where x is the current value of the //variable "differences_left"
};
Df2.onRelease = function() {
differences_left -= 1;
_root.Rect2._x = this._x;
_root.Rect2._y = this._y;
Df2._x = 1500;
if(_root.differences_left == 0){
gotoAndPlay(3);
}
_root.congrat.text = "You found a difference! Only " + differences_left + " more to go";
};
// The same as in the "Df1" button
Df3.onRelease = function() {
differences_left -= 1;
_root.Rect2._x = this._x;
_root.Rect2._y = this._y;
Df3._x = 1500;
if(_root.differences_left == 0){
gotoAndPlay(3);
}
_root.congrat.text = "You found a difference! Only " + differences_left + " more to go";
};
// The same, too
Df4.onRelease = function() {
differences_left -= 1;
_root.Rect4._x = this._x;
_root.Rect4._y = this._y;
Df4._x = 1500;
if(_root.differences_left == 0){
gotoAndPlay(3);
}
_root.congrat.text = "You found a difference! Only " + differences_left + " more to go";
};
// The same again
Now let's check what's inside the "Timebar" MovieClip:
5 Layers: stroke, mask, fill, dots and background
Take special attention at the masking (highlighted with a red rectangle in the image). The layer Mask is masking the layers "fill" and "dots", but not the layer background. (You can modify masking by right clicking on the layer>properties )
The layer Mask contains a MovieClip instanced as "bar".
And now, see the actionscript in the "Timebar" MovieClip (not inside it) :
onClipEvent(enterFrame){
this.bar._x -=0.25;
// The "bar" MovieClip's _x decreases
if(this.bar._x<=0){
// If it's _x gets to 0...
_root.gotoAndPlay(4);
// The game goes to Frame 4 ( the loser one )
}
}
Frames 3 and 4 only have a static text saying "Loser" or "You win" and a stop(); in its actions layer
Monday, December 31, 2007
Flash "Find the differences" game creation tutorial - Part 2
Here comes the second part. Today I don't have time enough to write it all, so I'm going to split it in two parts: Part 2a and part 2b.
This first part will consist only in the game and the source code and the next will be the explanation.
Download the source code if you want, but don't worry,I will explain it soon.
This first part will consist only in the game and the source code and the next will be the explanation.
Download the source code if you want, but don't worry,I will explain it soon.
Friday, December 28, 2007
A prototype
This is a game we made. I think it's quite interesting.
I plan to make a tutorial in a few days, but till then you
can download the .fla if you want.
Your ball moves with arrow keys
I plan to make a tutorial in a few days, but till then you
can download the .fla if you want.
Your ball moves with arrow keys
Subscribe to:
Posts (Atom)