How to program a character with a movement messy scene, including the diagonal movement and Exchange sprites from all directions. (AS3).

Please, someone help me.

Did you expect a code within the main timeline? It is a code that should be put in the class of a document. Who is the most recommended method.

To do this, create a new folder, fill it with the FLA file and create a new folder called 'classes', where you must have a class (.as) file. Call the "Main.as".


Then open your FLA file and, without anything selected, open the Properties window. There is a text entry field that represents the class. Write "classes. Hand '. After that, open the window of the library, where you should have your 4 sprites. One of them right click and select Properties. A new window will appear where you must check the option button "export for ActionScript". In the field of text entry class write "classes. Sprite1 ". In my previous answer, I told you what should be the Sprite1, Sprite2, Sprite3 and Sprite4... Well, that's when you use this formula. In the second entry of text field (which I do not know how it is written in the English version of the program... perhaps Base class?), write "flash.display.Sprite" and finally click OK. Do the same thing with each of the other 3 Sprites.


In the "Main.as" class file, paste this code:

{classes package

import flash.display.MovieClip;

import flash.geom.Rectangle;

import flash.display.Sprite;

import flash.display.Graphics;

import flash.utils.Timer;

import flash.events.TimerEvent;

SerializableAttribute public class Main extends MovieClip {}

public var enemy: Sprite = new Sprite();

public var _Sprite1: Sprite1 = new Sprite1();

public var _Sprite2: Sprite2 = new Sprite2();

public var _Sprite3: Sprite3 = new Sprite3();

public var _Sprite4: Sprite4 = new Sprite4();

public var sprite: Array = new Array (_Sprite1, _Sprite2, _Sprite3, _Sprite4);

public var movements: Array = new Array ("Right", "Left", "Top" and "Down");

public var EnemyInicialPosition: Array = new Array (100, 100); X, the values Y

public var EnemySpeed:Number = 20;

public var MovementsDelay:int = 500; Miliseconds

public var: delay = new Timer (MovementsDelay);

public void Main() {}

CreateEnemy();

RandomMovements();

Delay.addEventListener (TimerEvent.TIMER, TimerFinished);

Delay.Start ();

}

public void CreateEnemy() {}

Enemy.x = EnemyInicialPosition [0];

Enemy.y = EnemyInicialPosition [1];

stage.addChild (Enemy);

Enemy.addChild(Sprites[0]);

for (var i: int = 1; i)< sprites.length;="" i++)="">

The sprites [i] .visible = false;

Enemy.addChild (Sprites [i]);

}

}

public void RandomMovements() {}

var IndexNumber:int = Math.floor (Math.random () * (Movements.length));

var Direction: String = movements [numero_index];

for (var i: int = 0; i)< sprites.length;="" i++)="">

The sprites [i] .visible = false;

}

If (direction == 'Right') {}

Enemy.x += EnemySpeed;

Enemy.y += EnemySpeed;

Sprites [numero_index] .visible = true;

}

If (direction == 'Left') {}

Enemy.x = EnemySpeed;

Enemy.y = EnemySpeed;

Sprites [numero_index] .visible = true;

}

If (direction == 'Up') {}

Enemy.x += EnemySpeed;

Enemy.y = EnemySpeed;

Sprites [numero_index] .visible = true;

}

If (direction == 'Down') {}

Enemy.x = EnemySpeed;

Enemy.y += EnemySpeed;

Sprites [numero_index] .visible = true;

}

}

private void TimerFinished (e:TimerEvent) {}

RandomMovements();

}

}

}

Tags: Adobe Animate

Similar Questions

  • When I try to download a program, it tells me that I have to uninstall the 32-bit and install a 64-bit.

    Original title: 32-bit

    my information of the computer says it has a 64-bit, but when I try to download a program, it tells me that I have to uninstall the 32-bit and install a 64-bit. Why is this and how to do this. I don't have a disk for this computer since I bought it used. It's a core of windows 7 I5.

    Thank you

    Hello

    Type of control panel - system - system - he says it?

    You can run the as most 32-bit programs on Windows 64-bit, however you can not run a

    64-bit on 32-bit Windows programs.

    If you have 64-bit Windows which programs you are trying to install.

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle="" -="" mark="" twain="" said="" it="">

  • I had Adobe Photoshop Elements back in January 2011 and this laptop doesn't work anymore. I was wondering how to get it on my new laptop.  I have the serial number and everything.

    I had Adobe Photoshop Elements back in January 2011 and this laptop doesn't work anymore. I was wondering how to get it on my new laptop.  I have the serial number and everything.

    If you have problems with activation, go here: find solutions to activation errors that may occur when you launch Adobe apps.

    Click on contact us in the link if you need to reset your activation. It's when you can't access your old computer and you get the activation limit exceeded message.

  • The email that I use as an ID is no longer in service, how can I change to a new ID if I know the old ID and the old password?

    The ID I used before is is longer in service, how can I change to a new ID if I know the old ID and the old password?

    Start here:

    Change your Apple - Apple Support ID

  • How can I get pages for free if I already have the last update and it doesn't show up on my macbook air?

    How can I get pages for free if I already have the last update and it doesn't show up on my macbook air?

    What to do if you already have?

    Peter

  • Help with the Powershell script to collect logs from all domain controllers

    I am writing a script to retrieve the last 5 days of application, security and log files from all domain controllers. The script runs, but fire the logs from the local server only. The variable $Computer has all of my DC so it's the fine mark. I guess it's a problem with my line ForEach-Object, but is not error. See the below script.

    $log = 'application '.
    $date = get-date-format MM-DD-YYYY
    $now = get-date
    $subtractDays = new-object System.TimeSpan 5,0,0,0,0
    $then = $Now.Subtract ($subtractDays)
    $Computers = get-ADDomainController-filter *.
    ForEach-Object - InputObject $Computers - process {Get-EventLog - LogName $log - after $then - before $now - EntryType error | select EventID, MachineName, Message, Source, TimeGenerated |} ConvertTo-html | {Out-file $env:TEMP\Applicationlog.htm}
    Invoke-Expression $env:TEMP\Applicationlog.htm

    Thank you

    Rich

    Hello

    To help with the repost the question script to the script Center Forum

    http://social.technet.Microsoft.com/forums/scriptcenter/en-us/home

  • I got my computer back on the first day and now I lost all my pictures how do I get those photos back

    I got my computer back on the first day and now I lost all my pictures how do I get those photos back

    From Internet Explorer

    Original title: C:\Users\%USERPROFILE%\AppData\Local\Microsoft\Windows Live Mail\Storage Folders\Deleted items

    Backup, backup, backup, this is something everyone needs to do, and if you had you would have had your photos. Now that being said, you can get them at the root of your c: / in a folder named Windows.old. Good luck, but I'm afraid that this may turn out to be an expensive lesson.  Hope this helps and if you need another post to help and we will be happy to help you.

    The above opinion is mine and mine nothing and does not necessarily reflect that of Microsoft, it's employees, or any other Member of this forum.

    "When we try to take anything by itself, we find it hitched to everything else in the universe." -John Muir

  • How can I create VI with inputs that run immediately when the update?

    I'm using LabView for controlling stepper motors. I would create a VI with a front panel that has 4 arrows, 2 per engine. My goal is to be able to run the VI and then press a button to move the engine.

    I created separate VI for each funcition of engines - one vi to set current operations, to determine the current travel, another to move up by a certain amount and so on. Work of these vi and I can move and adjust engines, but only by running separate VI.

    How can I combine them into a single VI and make them run to the pressure of a button or the change of a property? An example would be to establish a new current holding company and place the operation current vi run immediately and send the order to the engine. Then continue to press the arrow keys without having to hit 'run' on an another vi.

    Thank you very much


  • How to include the install date and time in the registry keys

    Hi all

    I hope someone can help me. I'm creating a Setup program that includes properties in the construction specifications. I also wannt to include certain registry keys to add during installation:

    1. I understand the application installation directory by providing the key to [INSTALLDIR] value. This seems to work fine and I have no problem with that.

    2. the other key I would include (but I don't know how) indicates the date and the time of installation. Is it possible to automatically include this in a (similar to INSTALLDIR) registry key?

    I look forward to your expert advice!

    Kind regards

    Larry

    Larry,

    You can configure an exe must be run after Setup is finished. So, you can write a small application using the registry functions of Windows that retrieves the current timestamp and store it in some key.

    Norbert

  • Double click on the photo (my photo) causes PC freeze with message "not responding" (scheduled for the windows fax and picture viewer)

    WINDOWS XP

    "This program is not responding...". »

    I then have to click on the right upper window X two times to close the window. When it closes Finally, everything on the desktop disappears for about 3 seconds then reappears as if the PC restarted, but it does not actually restart.

    My images, the other day, all open without this feeze/final issue. I don't have these problems when you use Windows XP Paint, Jasc Paint Shop, or Quicktime to open images, once set by default... Just does not work with Windows Picture and Fax Viewer more and all my photos are already defined (default) to open with Windows Picture and Fax Viewer - clicking Properties confirms this.

    Also, if I right click on the individual image to 'open with' and manually choose 'open with' Windows Picture and Fax Viewer, it will then open and I can scroll all the following pictures an image in Windows Picture and Fax Viewer. "But I can't just click on an individual picture, otherwise, it will freeze just straight up.  Difficulty It Center Microsoft could not automatically repair because the shimgvw.dll file already exists.

    I used to always use Windows Picture and Fax Viewer with no such problems. I have not the slightest idea what happened... even though I was messing around with 1) Component Services > Security Com > permissions & launch Activate and Run permissions) 2 > Regedit > Edit > "Permissions" last week and changed "Registered Owner" in HKEY LOCAL MACHINE and some other stuff like that. Could permissions and changing names have caused this unexpected problem in Windows Picture and Fax Viewer? If so, the changes I made will not be changed back, then how can I fix a broken Windows Picture and Fax Viewer?  And if these changes, last week, have nothing to do with this "opening images in the image Windows and Fax Viewer problem,' so what?

    I did your suggestion before posting here. I saw the same solution as your addition, the interpreter, but it does not solve the problem because I already had the shimgvw.dll etc. in their proper place and my photos/images were not always open with Windows Picture and Fax Viewer the way I wanted them to open.

    Since I got my photos all open as I wanted (as before) this way to use Windows Picture and Fax viewer:

    Control Panel > Folder Options > File Types: I changed then each file/folder associated with 'images' to open with Windows Picture and Fax Viewer. I determined this by reading the details for each extension / the item highlighted. If the referenced details 'images', I then clicked on change and choose Windows Picture and Fax Viewer to open the extension.

    I went through everything everyone who was not obvious that they are. I made a change: BMP, GIF, EMF, JFIF, JPE, JPEG, etc... I changed at least 12 (more than I thought it was).

    Immediately after changing all of these types of files, I rebooted and Windows Picture and Fax Viewer was still working the way I wanted to (as before).

  • How can I get rid of ZoneAlarm engine of search in the address bar and of the way page search box?

    I downloaded ZoneAlarm firewall. There you install Chrome and choose its search engine when you download. I had heard that it was removed easily later. I have reset Google in the search bar upper at right.
    Now Firefox starts OK, but every time I will use a tab to open another search ZoneAlarm window is in the address bar and in the area of research of the Center, and Google search is in the top right search bar. How can I get rid of all ZoneAlarm search everywhere?

    I have the latest version of Firefox and Windows 8.1.

    You can check if you have the search engine of ZoneAlarm file in the browser\searchplugins folder in the Firefox program or in the searchplugins folder in the Firefox profile folder.

    You can use this button to go to the Firefox profile folder currently in use:

    • Help > troubleshooting information > profile directory: see file (Linux: open the directory;) Mac: View in the Finder)

    You can delete the search.json file and the possible search - metadata.json and the search.sqlite files in the profile folder of Firefox to reset the default search engines.

    Firefox will rebuild the file search.json from the default search engines in the "browser\searchplugins" folder in the program of Firefox and the searchplugins folder in the Firefox profile folder.

  • I am unable to Type or use the keyboard in Firefox 18.0 anywhere, including the search bar and URL bar. How should I fix this?

    I am unable to type anything or use the keyboard to type in Firefox. I use Firefox 18.0 installed on Windows 7.
    I am able to paste in the URL bar and the search bar, but absolutely not able to type in it.
    I already tried the 'reset' option but are still unable to type.
    Also tried Firefox in safe mode with disabled addons but are still unable to type.
    Install a new copy of firefox after Firefox uninstall and delete the old "Mozilla Firefox" in windows folder. but always impossible to type.
    Please tell me a solution to this.

    Have you tried restarting the computer?

    It is possible that you have activated the keyboard by chance to one who does not work in Firefox.

    Windows remembers the setting by application keyboard layout and you have probably changed the keyboard by accident via a keyboard shortcut.

    • Make sure you have the language bar visible on the Windows taskbar
    • You can do this via the context menu of the taskbar: toolbars > language bar
    • Check the language setting (keyboard) keyboard for the application that has focus via the icon in the language bar
    • You need to do that while Firefox has focus because Windows remember the keyboard by application setting

    Control Panel > regional and Language Options > keyboards and languages > change keyboards > advanced key settings > change key sequence

  • How get rid you of a virus on windows xp that addresses your computer from all directions?

    OK, so I got this virus on my pc for some time now.  First I start my pc as usual, it starts as usual.  Then a few seconds later the background picture on my desk blue towers, more seconds after a program called "MS Removal Tool" is running a program, saying it is "searching for virus" then after that the scans completed, he says I have all these infections and that I should 'click here' to solve the problem.  I close the program and try to open the the Task Manager, AVG Antivirus, Malware anti-octets, nothing opens, I can't open even Google Chrome, Mozilla or Internet Explorer, I can't access the CMD prompt, can not wipe even the pc reset everything to factory settings as when I got the pc, it is literally taking my pc this virus is crazy I have to run my pc in safe mode with network.  Please can someone help me!

    Click you on something like 'Security Alert, click here to solve the problem.'?  You may have a virus called "Antivirus XP", he says that you have a virus that itself is a virus. Try this if you think it is XP Antivirus, there are a lot of articles on this site (Microsoft Answers) with other ways to remove it, but this site came several times (this is the same as the above link) http://www.bleepingcomputer.com/virus-removal/remove-win-7-internet-security-2011

    I hope this helps!

  • 3 related issues: slow movement; the photos are all from the first image; and no sound from the soundtrack to the DVD downloaded.

    I put a DVD in my computer. It plays fine in Windows Media Player. When I transfer to Windows Movie Maker Live, three things happen: 1) the thumbnails are all the same - the first image. (2) the movement is slow. I tried it accelerates, but it is simply not the movement in real time - either too slow or too fast. (3) the soundtrack plays for a fraction of a second.

    What is the problem and how to fix it?

    I converted DVD to WMV format. This fixes the movement of the image and I can hear the music (not quite synchronized), however the thumbnails are still just the first image. In addition, every single feature that I blow (editing, effects, forwards, etc.) the picture freezes and yet the soundtrack plays again.

    ===================================
    It is normal that video to be the first image thumbs.

    Since it was a DVD... I guess it's a big project
    and the gel could be due to a lack of system resources.
    If you wait it can dissipate.

    Some video converters are better than others... Freemake
    maybe worth a try.

    It is also possible that your video driver may need an update.

    Verify that the video driver is problematic is to
    reduce the graphics hardware acceleration:

    Windows 7 - reduce graphics acceleration
    (see following article)

    More low hardware acceleration
    http://help.AOL.com/help/microsites/microsite.do?cmd=displayKC&docType=kc&externalId=15391
    (Windows 7 / Vista / XP / 98 / ME / 2000)

    Good luck...

  • How to make a sum of a subquery which first determine the time period and then the total sum.

    Hello

    I know how to solve it in two of the query, but I want to merge this in a single query.

    I have records in a table with the status 1. I also have records in the table with the State 2 and 3. But the 2 and 3 folders can have a period different kind of these must be determined in advance when this is, mind a deviding through 3 or 12 months.

    Double nesting is not allowed with Oracle, I detected. There may be more than 1 card whose status is 2 or 3 and I want to collect these and return as a sum value.

    select clk.clickid
          ,clk.uidclickstatus
          ,clk.period
          ,clk.STARTTIME
          ,clk.stoptime
          ,clk.CREATETIME
          ,clk.VOLUME "Open click volume"
          ,sum(tot_volume) --This doesn't work and is my problem!
          ,(select case
                     when ec.period = 'M' then
                        ec.volume
                     when ec.period = 'Q' then
                        ec.volume / 3
                     when ec.period = 'Y' then
                        ec.volume / 12
                     else
                        0
                   end as tot_volume
            from click ec
            where ec.uidcontract    = clk.uidcontract --807430
              and ec.starttime      = clk.starttime --Maybe the good reader will be saying why are you deviding, this is now directly related to keep it simple for now
              and ec.stoptime       = clk.stoptime --Maybe the good reader will be saying why are you deviding, this is now directly related to keep it simple for now
              and ec.uidclickstatus in (2, 3)
           ) sourced_volume
    from click clk
        ,lscmcontract ctr
    where clk.UIDCONTRACT       = ctr.UIDCONTRACT
      and ctr.UIDCONTRACT       = 807430
      and clk.uidclickstatus    = 1
    order by clk.uidclickstatus asc, clk.period, clk.starttime
    ;
    

    Can someone help me how to solve this problem?

    I'm not a guru on SQL. Straight motion is not a problem but what advanced...

    Thank you

    Nico

    OK, I've already said I'm not a guru, but I solved my problem. I didn't know that it is possible to put a sum around a case. In the end, it is the solution:

    select field
    ,field
    ,(select sum(case
                      when clk.period = 'M' and ec.period = 'M' Then
                            (ec.volume)
                      when clk.period = 'M' and ec.period = 'Q' Then
                            (ec.volume / 3)
                      when clk.period = 'M' and ec.period = 'Y' Then
                            (ec.volume / 12)
                      when ((clk.period = 'Q' and ec.period = 'M') or (clk.period = 'Q' and ec.period = 'Q')) Then
                            (ec.volume)
                      when clk.period = 'Q' and ec.period = 'Y' Then
                            (ec.volume / 4)
                      when clk.period = 'Y' Then
                            ec.volume
                      end) as Month_Vol
    from ec.table
    where ...
      and ...
    ) volume
    from clk.talble
    where ...
    

    Nico

Maybe you are looking for

  • Why can't I get gmail

    Since I installed this app I can not get my gmail. What is happening.

  • GPG Add on for firefx?

    Hello y at - it across an add-on to use gpg directly in firefox as the old firegpg add-on? http://de.getfiregpg.org/s/homeIt would be nice to encrypt and decrypt the text directly from firefox. a friend showed me an extension for google chrome and se

  • T430 advanced docking station

    Is there a such docking station like 2503 for older ThinkPad (IE. T61)? If this is not the case, 2503 would work with T430? I am particularly interested in a docking station to upgrade to the external GPU. http://support.Lenovo.com/en_US/detail.page?

  • TDMS-2503 error recovery - delete the index file does not

    My team worked an acquisition of data on some test machines, and I went today to begin the analysis of the data.  It turns out that two of the TDMS files that we generated cannot be opened in Diadem, Excel or use the controls file TDMS Opend in LabVI

  • Anyone running a Cintiq off their w520?

    All, I have the opportunity to purchase a Cintiq for five years at the speed of editing on my w520. It requires a DVI connection. There must be DisplayPort-DVI adapters but it that perhaps this device will make different demands on the connector. The