Google has just announced it's making an offline version of its Gmail e-mail service available today. The new feature will be initially available to users of its Googles Apps online suite of productivity applications, which includes Gmail.
Over the next few weeks, Google said it will make the feature available to consumers and others who use the stand-alone version of Gmail.
This is a simple bar like the ones we see in shooting games that shows how much life,health or energy left for you, I just made a very simple example to show how it is done.
As you can see I made two buttons Shoot Me and Help!!. when you click on Shoot Me your energy will be decreased,
if you click on Help!! it will increase.
What I did to make this bar is that I created a movieclip ,inside it I drew a rectangle and expanded it to frame number 20,
then created a shape tween on it. So every time Shoot Me is clicked the bar will be decreased by one frame,
and when help is clicked the bar will be increased by one frame.
Lets take a look at the code and see how it works:
//At the begining the life is full, //the frame number of the bar is set to the last frame,//which is frame number 20
life.gotoAndStop(life.totalFrames);shootMe.addEventListener(MouseEvent.CLICK,shootMeFun);help.addEventListener(MouseEvent.CLICK,helpFun);function shootMeFun(e:MouseEvent){//checking if the frame number is greater than 1
//to decrease the frame numberif(life.currentFrame>1){ life.gotoAndStop((life.currentFrame-1));}//if the frame number is 1 and got shot then you must DIEelse{
//this is a text on the stage that //tells you the status either alive or dead lifeTxt.text="Dead";//disable the shooting and help buttons,
//YOU ARE DEAD NOW shootMe.removeEventListener(MouseEvent.CLICK,shootMeFun); help.removeEventListener(MouseEvent.CLICK,helpFun);}}function helpFun(e:MouseEvent){//if you still alive and your energy is not completeif(life.currentFrame<life.totalFrames){ life.gotoAndStop((life.currentFrame+1));}}
The code is documneted and I will be happy to answer any question..
Hi there,
I am making a little game and this code is perfect for what I need. However, instead of making the health increase or decrease upon the click of a button I would like it to go up and down when triggered by different content embedded in each frame. So the content of one frame could add 5 health, and the content of another could decrease it by 1, is this possible?
Good morning. Paradise is exactly like where you are right now... only much, much better.
I am from Afghanistan and learning to read in English, please tell me right I wrote the following sentence: "This academia has reported canada to some decision to available sound elements.All conditions sold from momentum computations will be designated into a role bank depreciation until they can be found eventually into the financial fund.Also the hands-on excess time has been accumulated closely and with them the legal style practice.Regarding to the finance, if all balances include on company, the second will edit about the new escrow of this office."
Creating a simple shooting game where a player can shoot bottles going by on a conveyor belt. I have an energy/ammo bar that should go down as the player clicks the mouse . When I shoot the 1st bottle in my game, the ammo bar will decrease, but only after I have shot that 1st bottle. When I click "Play Again", my ammo bar never returns to a full level. Here is the code:
The bar is not reset to its full length because of this event " stage.addEventListene r(MouseEvent.CLICK, updateAmmo); "
What is happening is when you click on "Play Again", " updateAmmo " will be called because "Play Again" is part of the stage.
The solution to that is to stop " updateAmmo " from being called when the reply button is clicked by removing the event listener > stage.addEventListene r(MouseEvent.CLICK, updateAmmo);
in your reset section to the following:
1- replace "ammo_mc.bar_mc.scaleX = 1; // reset the players energy level" by "resetBar();"
// reset our game variables
BottlesCreated = 0;
BottlesDestroye d = 0;
resetBar();
score = 0;
bottlesToWin = 10;
2- add this function:
function resetBar(){
//remove the stage event to stop the bar from decreasing
stage.removeEventList ener(MouseEvent.CLICK, updateAmmo);
//I'm using a timer to call "wait", which will reset the scaleX to 1 and add back the stage event
//the timer will give the game some time to apply removing the stage event
var t:Timer=new Timer(1,1);
t.addEventListene r(TimerEvent.TIMER_COMPLETE,wait);
t.start();
}
3- add this function:
function wait(t:TimerEvent){
ammo_mc.bar_mc.scaleX=1;
stage.addEventListene r(MouseEvent.CLICK, updateAmmo);
}
Nice idea. After the movie Matrix it is populat to give a choice to people in such a form. But of course I maybe mistaken. Well, what I really see, is that this idea is very nice but it needs to be developed. You know I read a lot about peoples habit. There are very nice book by Allan and Barbara Pease, I found some at the pdf search engine http://pdf.rapid4me.com . In their books I find explanation to our deeds.
Comments
I am making a little game and this code is perfect for what I need. However, instead of making the health increase or decrease upon the click of a button I would like it to go up and down when triggered by different content embedded in each frame. So the content of one frame could add 5 health, and the content of another could decrease it by 1, is this possible?
All the best,
Ben
I am from Afghanistan and learning to read in English, please tell me right I wrote the following sentence: "This academia has reported canada to some decision to available sound elements.All conditions sold from momentum computations will be designated into a role bank depreciation until they can be found eventually into the financial fund.Also the hands-on excess time has been accumulated closely and with them the legal style practice.Regarding to the finance, if all balances include on company, the second will edit about the new escrow of this office."
Thanks :(. Phoebe.
Do you want to change the amount the life lose or gain?
stage.addEventListene r(MouseEvent.CLICK, updateAmmo);
function updateAmmo(event:MouseEvent){
// we need to check to see if the player has run out of bullets
if (ammo_mc.bar_mc.scaleX
// reset our game variables
BottlesCreated = 0;
BottlesDestroye d = 0;
ammo_mc.bar_mc.scaleX = 1; // reset the players energy level
score = 0;
bottlesToWin = 10;
// and lastly, start making enemies again!
BottleMaker = setInterval(createBottle, 750);
}
// ---------START GAME----------- --------------- --------------- --
initializeGame();
The bar is not reset to its full length because of this event " stage.addEventListene r(MouseEvent.CLICK, updateAmmo); "
What is happening is when you click on "Play Again", " updateAmmo " will be called because "Play Again" is part of the stage.
The solution to that is to stop " updateAmmo " from being called when the reply button is clicked by removing the event listener > stage.addEventListene r(MouseEvent.CLICK, updateAmmo);
in your reset section to the following:
1- replace "ammo_mc.bar_mc.scaleX = 1; // reset the players energy level" by "resetBar();"
// reset our game variables
BottlesCreated = 0;
BottlesDestroye d = 0;
resetBar();
score = 0;
bottlesToWin = 10;
2- add this function:
function resetBar(){
//remove the stage event to stop the bar from decreasing
stage.removeEventList ener(MouseEvent.CLICK, updateAmmo);
//I'm using a timer to call "wait", which will reset the scaleX to 1 and add back the stage event
//the timer will give the game some time to apply removing the stage event
var t:Timer=new Timer(1,1);
t.addEventListene r(TimerEvent.TIMER_COMPLETE,wait);
t.start();
}
3- add this function:
function wait(t:TimerEvent){
ammo_mc.bar_mc.scaleX=1;
stage.addEventListene r(MouseEvent.CLICK, updateAmmo);
}