ActionScript 2.0 :: HitTest For Coin - Adding More Money To Total Amount
Apr 10, 2005
I have a simple money script [for my game] and I want to say, ok when I walk over a coin, I want it to add $5 to the total amount of money, but the problem is, is that my code doesn't work, in the frame actions I have:
Code:
money = 0;
and in the hitTest for the coin I have:
Code:
if (_root.dude.hitTest(_root.coin) {
_root.money +1
}
View 4 Replies
Similar Posts:
Apr 10, 2005
i want it to add $5 to the total amount of money, but the problem is, is that my code doesnt work, in the frame actions i have:
[Code]...
View 4 Replies
Mar 26, 2011
My problem is with score counting, i have a score field, a main character and 5 coins.When the character collides with the coin the following happens:1. The coin disappears (Supposed to happen)2. Adds 1 point to the score (doesn't work the way it should)What happens is (i have set the score field to start at 0 with (_root.score = 0 this for some reason doesn't have any affect.Only the first coin to be hit adds (1) to the score, after hitting a second it completely disappears. Also have it set so that if the score goes to 5, the door in the top left will open. (NOTE: for some reason this seems to work, if you "collect" all the coins the door will open, but the SCORE field doesn't show the number)
View 1 Replies
Mar 4, 2009
Say I have 4 values (level_reached1, level_reached2, level_reached3, level_reached4) I want to add up to a total, and another 4 values (goal1, goal2, goal3, goal4) I want to add up to a total. How do I add these up and compare them to each other, and if the "level_reached" is equal to OR greater than "goal" I want a movie to gotoAndStop(2);
Here is what I have, which does not work, I probably have things really mixed up:
Code:
leveltotal = level1 + level2 + level3 + level4;
goaltotal = goal1 + goal2 + goal3 + goal4;
if (leveltotal >= goaltotal) {
[Code]....
View 2 Replies
Jun 23, 2008
I have an application performing a simple calculation of adding and subtracting a amout to/from a balance amount.The problem is that every thing works fine except that when i remove the lkast amout from the balance ie: 15.25 -15.25 suppose i get something like -5.32907051820075e-15
View 2 Replies
Nov 6, 2009
i have a mc called energybarmc, i have radomly multiplying and falling lightning called Lighten which has children and is getting collected by the character mcMilan when he hits it i wanted the energy bar level to increase by 10 pixels a small x and y co ordinate
this is located after a timerevent function:
if (Lighten.hitTestObject(mcMilan.hit))
{
trace("hit");
removeChild();
.....
how do i implement the score code after the remove child? or do i put it before?
View 0 Replies
Jul 31, 2009
I've got some flash 2.0 code that is supposed to add 100 points after a hitTest.
Code:
function onEnterFrame(){
connectA();
var strandID:Number
function connectA(){
for (var i = 0; i < 100; i++) {
if (this.hitTest(_root["A_" + i])) {
this.strandID = i;
_root.total = _root.total + 100;
}}
The problem is that it adds 100 points 70 times per second (the frame rate). It's supposed to add 100 points and stop. Here's a little more info: the hitTest makes two movie clips move across the screen together. Maybe because they're constantly hitting as they move, I don't know.
View 6 Replies
Mar 20, 2012
regarding adding multiple childs to an array these childs are added using timer after a time interval.actually there two classes and child of both classes are added to stage one through timer as i described and other through keyboard event. now is it possible to do this if yes than how?? and is it possible to apply hittest object between these two array.
View 6 Replies
Feb 11, 2012
I have been having a serious issue with custom video where flash is saying that the amount of the video so far played is MORE than the amount that it has downloaded, which is clearly impossible. This results in various problems, such as the playhead (scrubber) moving past the end of the loader bar. I posted a simple demo that displays the amount loaded and the amount played in text fields. You can see it at: [URL][Code]...
View 5 Replies
Feb 11, 2012
So I have been having a serious issue with custom video where flash is saying that the amount of the video so far played is MORE than the amount that it has downloaded, which is clearly impossible. This results in various problems, such as the playhead (scrubber) moving past the end of the loader bar.I posted a simple demo that displays the amount loaded and the amount played in text fields. You can see it at: URL...[code]I encoded the video at a high rate so that it would download slowly. It may not playback smoothly, which I am not concerned about. What I am concerned about is the numbers below the video what are derived from ns.bytesLoaded and ns.time. If you watch it for a bit, the amount played should exceed the amount loaded.
I double checked the video duration and the bytestotal that flash is reporting and they are correct. I don't know of any way to check the accuracy of bytesloaded.If your internet connection is super fast, you may not see the issue - it only occurs when it is playing back faster than it is downloading - if this is the case, you may need to throttle your speed down, or start downloading a large file while you are watching this demo in order to see the issue.But this is a serious issue and means that building custom video interfaces with loadbars and playheads is impossible!
View 1 Replies
May 28, 2011
var score:int = 100;var money:int = 200; btnfeed.addEventListener(MouseEvent.MOUSE_UP,feed);function feed(event:MouseEvent) { if ((score == 200)&&(money <= 0)) { score += 0; money -= 0; Cash.text = String(money)
[code].....
View 2 Replies
Apr 20, 2010
What's the better way to make a coin rotation? I tried Math.random, but the coin doesn't wobble correctly.
starter code
//ROTATION
addEventListener(Event.ENTER_FRAME, enterFrameHandler);
function enterFrameHandler(event:Event):void
[Code].....
View 1 Replies
Sep 5, 2007
What is an easy way to format a number to money? I want to add commas for every thousand, and force the decimal to 2 digits.
View 4 Replies
Aug 27, 2009
If we made a game in flash that has online, would it cost money to have the online server or something?
View 3 Replies
Oct 6, 2009
I create this : function money () {total++;income.text=total;} and a button. income.text is added by 1 each time the button is onRelease. I need only 1 point to be added no matter how many time the button is pressed.
View 8 Replies
Oct 28, 2010
I'm working on a game where I need to have a variable for money and a variable for Health, or in my case, I call it Energy. Most tutorials I'm finding are in AS2 and the AS3 ones are not this basic thing that I need. Basically, I have an item shop with a pizza button, and in their respective dynamic text fields, you can see the status of your Energy and your Money. So, let's say the person clicks the pizza to buy it, Flash will subtract 10 (for 10 bucks) from the person's total money value and add 15 for total Energy points.This is what I've written so far and I'm writing all the script in Flash, not outside using classes or packages. I can tell already that I'm missing something. How do I write it so that Flash knows to add 15 Energy from that Pizza button and can I update the values of the variables and kick off that mouse event in the same function?[code]
View 2 Replies
May 6, 2010
I have a program that adds values together. I need the variable to display with 2 decimal places. Right now $1.50 would look like: 1.5
How do I make Flash display the zero automatically?
View 2 Replies
Oct 30, 2011
I am currently writing a Flash AS3 website where users upload file(s), I take payment, and when payment has been received, the files are emailed to me to be processed, all within the same SWF.
I can get the upload and email part all working nicely. My question is about the payment part. Ideally, I would like to use Paypal but the critical point is that payment and then confirmation must all be within the same SWF. If Paypal directs to another page and returns to a different URL (or the same one for that matter), the SWF would have ended which would be a problem for the emailing part.
Is there a solution for Paypal to take money within the same SWF and just allow further functions to run on confirmation?
View 5 Replies
Mar 24, 2010
I'm using this falling snoweffect but I exhanged the snow with a coin so what I wanna do is have money falling but when they reach bottom I want them to stop. Instead they are looping and I dont know where to change it in the code.
init = function () {
width = 200;
// pixels
height = 400;
[code].....
View 1 Replies
Dec 23, 2011
I was wondering if anyone has attempted in profiting off of using Flash to make useful applications? I started the website [URL] which the products are both made in flash (one of the members here coded it for me). I am just interested in seeing if anyone else has tried selling flash as software? If your wondering I have sold about $450 worth of the basketball/football one and just started the first aid one
View 1 Replies
Jan 15, 2010
Finished with coin toss gameWhat done good, what wrong..? what need change? what method better?And now in this user can be winner just 50% ?Attached files.Also code here:
import fl.controls.RadioButtonGroup;
coinToss_btn.label="Coin Toss";
coinToss_btn.useHandCursor=true;
[code].....
View 3 Replies
Jan 9, 2012
i am trying to create a flash ticket machine where i want the user to simply insert coins into a box as a way of paying for a ticket.i have created two objects a "coin" movie clip and a "target" movie clip.what i want essentially do is, be able to drag the coin onto the target.Then for the system to determine whether it has been recognised by outputting a value in a dynamic text box(this i know how to do)Also i have given it a go and tried to drag the coin on top of the target but for some reason it keeps hiding beneath the target:[code]
View 3 Replies
May 17, 2011
I have been approached regarding building a touch screen app for a client, but as it will be for use on kiosk machine it needs to interface with a bill/coin acceptor and a printer. What are the common the ways of accomplishing this?
View 1 Replies
Jan 30, 2011
I am creating a flash money game in which you have to drag coins onto an area to add upto a certain amount and then you click a button to see if you are correct.
I'm really confused on how to assign values to each coin, a value to the area you are dragging the coins onto and how to add these up when they enter the area. Then once the button is clicked for it to check that the value matches that of the value you are adding up the coins to.
View 1 Replies
Jul 5, 2011
I'm currently making a flash game and to insert sound. The sound effect has to play everytime the character touches the coin yet the coin still has to be able to unload. I never used sound before in flash.
View 1 Replies
Feb 9, 2010
I have a project I'm working on and I am really stumped on making a seemingly simple animation work.The animation is of a coin scratching off a layer to reveal the layer beneath. I have the coin animated, and the layers in place. I am wanting to know if there is a way to erase/delete every place the coin passes over the stage, revealing the layer beneath. I've seen animations where ActionScript is used to allow a user to control the coin/pointer and activate the "scratch-off" effect. However, I am trying to come up with a method that is not a user-initiated animation since I want the effect to repeat in several places in the timeline.For the life of me I cannot figure out how to make this work. I am a moderately skilled Flash user and an ActionScript novice.
View 1 Replies
Apr 11, 2011
I had to use a setter...how would I implement that into my code, On my external AS file for the coin I have the following:
package
{
import flash.display.MovieClip
import flash.events.*;[code]....
And in the main movie I made a dynamic text box gave it an instance name of "score" and in my action script I wrote:
score.text = String(coin.coinsCollected);
View 5 Replies
Apr 12, 2007
I`m trying to flip a square. The coin flip as works fine with round shapes, but with a square it just doesn`t do it.
View 4 Replies
Jan 15, 2009
i just would like to know how to create an "hitTest" script inside a movieclip that is actually part of that hitTest code?I mean... I have mc A, and mc B. and the current hitTest code im using (that is on the timeline) makes mc A, destroy mc B when collide with it... but there are many mc B on the stage (with the same instance name) so, when mc A collide with one mc B, it destroys ALL mc's B... but i want it to destroy only the mc B that he collides, not all the others... maybe an hitTest script inside a movieclip B would work (somethig like "if MC A hitTest ME = i die" (not all the others)).
View 1 Replies
Mar 25, 2011
When i try to make like a shop game, i create a dynamic text and set it's variable to "money". When i test it, everything works fine. But when i try to add a static/dynamic text close to it, the text won't be visible.It's kinda hard to explain, so here's a preview:
The "normal" version:
megaswf.com/serve/1044057
The other version:
megaswf.com/serve/1044059
View 9 Replies