Flash Action Script hitTest, change of Variable

Hello! I'm a flash game that is my own point of view on Pacman.  I have to try to make a wall that when a character reaches, the character moves at all.  When I put the code on the wall itself, the character would be hit, then move forward 10 pixels while the key was pressed and spring back 10 pixels when he was in no hurry.  Is it possible to do something completely solid? This is the code that I used before.

onClipEvent (enterFrame) {}

If (this.hitTest (_root.char))

{

_root. Char._x += 10;

}

}

The code of the character (char) has been

onClipEvent (enterFrame) {}

var a_variable = 10;

If (Key.isDown (Key.LEFT))

{

This ._x a_variable-=;

_root. Char.gotoAndStop (2);

}

Else if (Key.isDown (Key.RIGHT))

{

This a_variable ._x +=;

_root. Char.gotoAndStop (1);

}

Else if (Key.isDown (Key.UP))

{

This ._y = a_variable;

_root. Char.gotoAndStop (3);

}

Else if (Key.isDown (Key.DOWN))

{

This ._y += a_variable;

_root. Char.gotoAndStop (4);

}

}

I wonder if there is a way to define the variable a_variable to 0 when the character hits the wall.

Thank you.

~ Walt

normally with a hittest positive, you must immediately return the mobile objects to their previous post.

Tags: Adobe Animate

Similar Questions

  • Beginner of Flash Action Script 3

    Hi friends,

    I worked as a graphic designer and web and am very interested in learning Flash Action script 3.

    Please guide me to choose a straight path.

    Thanks in advance!

    You will be better to go straight to the AS3... you need not to learn first AS2, and in doing so may confuse learning AS3.

  • Flash action script 3 settings

    How can I change the 3 action script settings? I want to make sure the default scene dimensions are different.

    This isn't really an Actionscript parameter. Open the Properties window for the movie, be sure that it says, 'Document' at the top of the window. In the Properties section, select the icon for key to the right of the dimensions of the stage. Which opens a new window. Here, you can define a new default step size, and then click make default in the lower left corner.

  • Projector is "full screen" look a Cs5.5 Flash action script

    How can I set up a projector for "Full screen" display Flash Cs5.5

    Knowing he already has action script.

    I tried to add FSCommands on top, nothing helps.

    stage.displayState = "fullScreen";

  • In FLex and Flash action script

    Please give me advice.

    I understand just that flex and different flash actionscript?

    If so can you give me the reference material action script in flex?

    ActionScript is the same in flash & flex.   Think that flex is a framework actionscript for the flash player.

  • How to control the Captivate 4 variable using Flash Action Script 3.0?

    Hi all.

    I'm working on Captivate 4.

    According to my requirement, I need to control externally Captivate system variables in Flash using the AS3 version.

    I found a script somewhere in the forums to control system in AS1 and AS2 variables. But I need them in AS3.

    "this._parent._parent._parent.rdcmndPause = 1;  "

    "this._parent._parent._parent.rdcmndresume = 1;  "

    I tried the same way in the AS3 version but could not do.

    It is an important condition for me.

    How to control variables in Flash AS3 Cp4?

    Kind regards

    Kartik.P

    Use the following code:

    MovieClip (this.root) .rdcmndPause = 1;

    MovieClip (this.root) .rdcmndResume = 1;

    This should solve your problem

  • Width of the action Script mysteriously change things?

    Hello
    I'm working on this site and I decided to add some flash to the first page in the form of a gallery of images with a nifty slide effect.
    The problem is the following. For a reason unknown sound intrudes on my images. When you look in the script, you will see that I've set the width of the image to the width of the stage, but when you test the movie that they have crashed to about 3/4 of the width of the stage (ive double checked both the size of the image).
    I hope that you will see something that I missed.

    Thanks for your help, it's bugging me no end!
    -Brian

    While the problem has nothing to do with ActionScript, you posted this in the wrong forum given that the file uses AS2.

    The problem has to do with changing the scale of the movieclips in which images are loaded.  If you open the imgscroller movieclip, select all places few whites in the upper left corner (clip1 thru clip7) and select Edit-> Remove transform, it will restore their normal scale.

  • How copio movimiento of Flash Action Script 3?

    Manual por: crear Flash debo hace despues "Select Edition > tiempo Linea > copy movimiento como ActionScript 3.0" pero en select "edición > Linea tiempo >" no tengo the option "copy as ActionScript 3.0 movimiento.". ¿Solucion?

    This feature no longer exists in flash pro cc.  You can use copy motion as xml in flash pro cc or use flash pro 6 If you want to copy a motion as actionscript

  • Flash Action Script key Restrictions

    Hello, so I do a Pacman game and use the following script for the movement of my character.

    onClipEvent (enterFrame) {}

    Speed = 10;

    If (Key.isDown (Key.LEFT))

    {

    This ._x-= speed;

    _root. Char.gotoAndStop (2);

    }

    If (Key.isDown (Key.RIGHT))

    {

    This speed of ._x +=;

    _root. Char.gotoAndStop (1);

    }

    If (Key.isDown (Key.UP))

    {

    This ._y = speed;

    _root. Char.gotoAndStop (3);

    }

    If (Key.isDown (Key.DOWN))

    {

    This ._y += speed;

    _root. Char.gotoAndStop (4);

    }

    }

    The problem I encounter is that when I press on the right and down keys, or any other two keys that have a diagonal shift, the character goes in that direction.  I want only the character must be able to move to the right, left, up and down.  The _root.char.gotoAndStop (3); part of the script is just for the character is facing in that direction.  Is there a way to limit the number of keys that can be both a? Or to make sure that only the first of the two keys or the second of the two keys pressed is used? If not, is it possible to turn RIGHT and DOWN, press result in diagonal movement which also must face the character in this way? Or stops the character completely? I'd like to mass appreciate any help on this! Thanks in advance!

    Walt

    One way would be to incorpate "else" of for the last three parolees.  It is therefore the first key determined to be down would be the key that determines the movement.

    onClipEvent (enterFrame) {}

    Speed = 10;

    If (Key.isDown (Key.LEFT))

    {

    This ._x-= speed;

    _root. Char.gotoAndStop (2);

    } Else if (Key.isDown (Key.RIGHT)) {}

    This speed of ._x +=;

    _root. Char.gotoAndStop (1);

    } Else if (Key.isDown (Key.UP)) {}

    This ._y = speed;

    _root. Char.gotoAndStop (3);

    } Else if (Key.isDown (Key.DOWN)) {}

    This ._y += speed;

    _root. Char.gotoAndStop (4);

    }

    }

  • using flash action script 3 just won't work to create a link to a url

    If I received a file that has a transparent background button you are looking for linking to url .com, and for the life of me (very probably just too tired) I do not see what to do so that the link to the full animated advertising

    any help would be thank you very much

    You can create a button symbol, in the button Edit mode, keep his place, more and down from executives as white and just specify the affected area by drawing a rect in the fourth.

    Turn on the main timeline and use code extract (in the Windows Menu) to add the code snippet - click here to go to a Web page. Set your url and test the desired animation.

    It should work fine now.

  • Flash beginner needs help with Movie Clips/Action script

    HI -.

    I'm having a problem with my video clips playing simultaneously and cannot, for the life of me, know what I did wrong. I'm new to flash so I can I have created something wrong but this is what I have so far:

    11 layers, total: 1 layer with 10 buttons, each button with the following actionscript code:


    on (release) {}
    gotoAndPlay (85);
    }


    When the number changes with regard to keyframes, the next film is about.

    I have 10 films, total, but they are only video clips, mainly photo slideshow with audio, does everything in the library.

    The problem occurs when I click on the second or third button. Not only the movie I selected starts to play, but all previous clips are as well, he has completely blurred all the sounds. I don't know what Miss me in action script, as my Action layer has a stop command to this topic at each keyframe where there is a new clip to play.

    I tried to add a stopAllSounds command, but I'm afraid that does nothing because it is not an "audio file" in itself playing in the timeline panel.

    I'm at the end of my rope and really need help to understand this one. My project is hanging in the balance on this point, I wrote everything correctly and it works beautifully.

    Help, please!

    Thank you
    Caroline

    Start your sounds in frame 2 and place stopAllSounds() on each keyframe where begins a movieclip.

  • I'm on a W7 PC, of FlashProCC. -Have a Z1, jpg in the library. Choose Properties, export for ActionScript and get name Z1, class flash.display.BitmapData - how I introduce in a display by using Action Script 3.0 object?

    I'm on a W7 PC, of FlashProCC. -Have a Z1, jpg in the library. Choose Properties, export for ActionScript and get name Z1, class flash.display.BitmapData - how I introduce in a display by using Action Script 3.0 object?

    var z1:Bitmap = new bitmap;

    Z1. BitmapData = new Z1 (1,1);

    yourDisplayObject.addChild (z1);

  • Advanced action scripts - y at - it a variable that tells me which button is clicked?

    Lilybiri gave me some great tips on the use of conditional tip action scripts. Now, I have another related question.

    I have three buttons A, B and C. Each button performs exactly the same series of actions to hide everything on the page, but shows another group of objects depending on which button was clicked - that is, to display the Group A and Group B group C.

    Currently, I have a separate advanced action script for each button (in fact a lot more than three) because of this difference, then want to combine in a single conditional script. However, I can't understand how I would like to know which button was clicked.  In other words, I think that my conditional script should look like this:

    The condition "always."

    If 1 is equal to 1

    [Script to hide all]...

    Continue

    Condition 'has '.

    If MyButton is equal to 'A '.

    See the group_A

    On the other

    Continue

    Condition 'B '.

    If MyButton is equal to 'B '.

    See the group_B

    On the other

    Continue

    Condition 'C '.

    If MyButton is equal to 'C '.

    See the group_C

    My problem is that I don't know how to set or get the value of MyButton to perform conditional tests. Is there a system variable that returns the value of a selected object? I looked at all the variables, and I don't see one. Or y at - it another way to do what I'm missing?

    You probably can find with Javascript, but not with advanced actions. All the available system variables that can be used - there are more - are in a table that you can download here: System variables in Captivate 8 - Captivate blog

    I have several articles on the shared use of stocks. You apply the same instance of a common action several times and don't have that to indicate parameters, in your case these parameters will be for most groups and objects. I hope that stocks shared will expand more in the future. They have several advantages: given that you use multiple instances of the same action that they do not increase the file size as duplicate advanced actions. In addition, you have them in the library that makes management much easier.

  • CC - Flash don't support action script 2

    I have some programs that use action script 2, but when I try and open them in the new version of the CC for flash it says that it does not support AS2

    I have to keep the program on an older computer with a previous version of flash

    It is not cost-effective to update *-any suggestions on what I can do in the new version of CC?

    or CC have access to previous versions of flash?

    Wayne

    Previous through Cloud http://helpx.adobe.com/creative-cloud/help/install-apps.html#previous

  • Action Script 3.0 for Flash Professional CC running Windows

    Hello world

    I am trying to learn Action Script 3 on Flash Professional CC. The video I'm following courses on Lynda.com and they all speak when referencing an instance of a clip that hits this instance name followed by the (dot) will show a list of available properties for this instance. I see this in action when you watch the video, but when I try properties do not appear. For example, I have a video clip of a circle on my scene and the instance of this clip is named mv_Circle

    When I type the line 1 > mv_Circle.   There should be a list appears displaying the properties, but this does not happen, so I try to guess what the property could be and what its value might be. Example of setting the alpha of this instance I type

    1 > mv_Circle.alpha = 0.5;     but the word alpha does not appear in the supposed list. I'm doing something wrong or I have put in implementation hurt somewhere. My OS is Windows 7 64 bit or victory 8 64-bit. No computer will give me this option.

    I really hope that someone can help me because it drives me crazy. Thank you in advance.

    Dougie

    You can "type" (in other words, explicitly tell Flash of the object class) first mv_Circle:

    var mv_Circle:MovieClip;

    .

    .

    .

    Enter mv_Circle point, you should see the available properties.

Maybe you are looking for