How can I organize the code with frameworks?

Hi all

I try to make a very simple game but I have a question. You give me a hand, please?  I'm not from English pregnant, so I hope you get my question

My game consists of several levels (a level on each image). Each level (or each image) consists of white walls, a green ball, a colored star and a touch of yellow... as you can see in the picture. The green ball should pass between the walls without knocking, and he must press to pick up. When the key is collected, a wall will disappear while the ball can reach for the stars, then a player wins. When the ball hits one of these walls a game more than message appears.

Each image has a different number of walls and every wall is a clip on the main stage. The walls are not inside a container or something like that. The names of occurrence of the walls are wall1, wall2, wall3... and so on.

I also have a layer for action script and I wrote the following code:

If (player.hitTestObject (wall1) | player.hitTestObject (wall2): player.hitTestObject (wall3): player.hitTestObject (wall4))

{

trace ("second try");

gameOver.visible = true;

doThisFn = false;

}


This works for executives who has wall1, wall2, wall3 and wall4.

Wall4 (for example) does not exist on frame 3 (for example), an error said: "' #2007: hitTestObject parameter should be null. '"

My question is, how to organize the action script layer and managers so that the error does not occur?


I thought of an idea that must make a copy of wall4 on layer 3, and I'm going to put wall4 in a place where the user will not see it. I don't think it's a good solution.

I had another idea, I'll do several keyframes (press F6) on the action script layer. and I'll modify the code of each keyframe in a way that the walls which lie in the IF statement mach walls on each image. but it will take a lot of effort!


Suggest a more intelligent solution, please? such as a For loop or a table... I do not know how?
Thanks in advance,

flash.png.

You can initialize an array, for example,

var wallA: Array = [];

for example, reset it on each image,

wallA.length = 0;

Fill it on each image, for example,

for (var i: int = 0; i<>

{if (this ['wall' + i])}

wallA.push (this, ['wall' + i]);

}

and then use this table in your hittests, for example

function wallHitTestF (): Boolean {}

for (i = 0; i<>

{if (Player.hitTestObject (wallA [i]))}

Returns true;

}

}

Returns false;

}

Tags: Adobe Animate

Similar Questions

  • How can I put HTML codes with muse cc? I have to put a watch on my site, I only codes HTML

    How can I put HTML codes with muse cc? I have to put a watch on my site, I only codes HTML

    Hi Antonio,.

    You can use the object > option to insert HTML code to add your code to the page.

    Kind regards

    Aish

  • How can I configure the element with the script names?

    Could Hello someone give me a hand?

    I created symbols on the stage of this script below.

    ------------------------------------------------------

    for (k = 0; k < 5; k ++) {}

    sym.createChildSymbol ("mySymB", "Stage");

    }

    ------------------------------------------------------

    How can I configure the element with the script names?

    Because, when I try to control a symbol by using the getSymbol("---") command.

    I need to know the name of the item given to each symbol.

    Concerning

    Yes, you're right.

    Using 'Code-Example' If you write sym.getSymbol ("mySymB") that edge returns the undefined value.

    With "Drag-and-drop-Example", you can use sym.getChildSymbols ().

  • How can I find the codes of codecs

    How can I find the codes of codecs

    Hello

    All you need is good Codec - get these if 32-bit.

    -Free - CCCP also get free of insurgents tool - has also excellent forums
    http://CCCP-project.NET/

    FFDSHOW - free
    http://sourceforge.NET/projects/ffdshow/

    Check here:

    Plug-ins for Windows Media Player
    http://www.Microsoft.com/windows/windowsmedia/player/plugins.aspx

    ---------------------------------------

    VLC needs, of no use so usually Codec as a backup when asked to support associations of files just say no.

    VLC - free
    http://www.videolan.org/VLC/

    -------------------------------------------------------------

    If 64 bits and you need codec.

    Read this 1st and go that route, or use the one below. (Vista or Windows 7)

    http://www.Vistax64.com/sound-audio/152850-Vista-codec-pack-32bit-64bit-Media-Player-codecs.html

    --------------------------------------------------------------------

    If 64-bit - can run WMP in 32 or 64 bit mode.

    Or try these: download - SAVE - go to the place where your put them RIGHT CLICK – RUN AS ADMIN.

    For 32-bit use these - OR the 32 bit ones listed above which I prefer.

    K - Lite Codec Pack 6.2.0 (or newer)
    http://www.codecguide.com/

    Use them for 64-bit:

    K - Lite Codec Pack 3.7.0 (64-bit) (or newer)
    http://www.codecguide.com/

    -------------------------------------------------------------
    You know that you use WMP 32 or 64

    Change, change or set 64 - Bit Windows Media Player 11 (WMP11) in Windows Vista x 64 as default
    http://www.mydigitallife.info/2007/01/19/switch-change-or-set-64-bit-Windows-Media-Player-11-WMP11-in-Windows-Vista-x64-as-default/

    -------------------------------------------------------------

    And you can use it when necessary because no codex is usually required.

    VideoLAN - VLC media player
    http://www.videolan.org/

    I hope this helps.

  • How can I update the rubrics with WebServices?

    How can I update the rubrics with WebServices?

    /Anyone/ has some success with this?

    It becomes important to our business objectives in order to solve the problems within the control elements.

    I can't enter the number of line by line in order to uniquely identify it. How can I get that number, so I can send it with xml "update"?

    A little nudge in the right direction would be much appreciated.

    Aaron.

    You must use a field on the form as the one on the line items, NOT the line number that appears in the journal of the line item. If I understand correctly, the LineItemIdentifier can be any field on the form, even the short description. It is best if you know you will use web services to update the line items, you add a (potentially hidden) field to the form and fill that with unique values when positions are created. If you are working with existing elements of line, then you must choose a field that will be usually unique within a single record and hope, you don't have a lot of duplicates.

  • How can I get the code to save Pixillion Image converter? [was: glory614]

    How can I get the code to save Pixillion Image converter

    It's not Adobe software.

    You will need to go to the manufacturer's Web site and get your code from them

    http://www.nchsoftware.com/ImageConverter/

  • How can I make the popup with empty fields and create new record?

    I would use a popup create new record.
    I created an af:popup drag and drop a data control VO in jsff. Then, I created a button and place an af:showPopupBehavior. I was able to pop-up window by clicking on the button.
    However, the window filled with information from the record 1. and when I select a record in the table and click on the popup, the popup is filled with this record.
    How can I make the popup with empty fields and create a new record by recording the popup?
    Thank you

    Hello

    You must call the CreateInsert for the underlying ViewObject operation when opening the popup because it does not allow to clear the input field, you must have a new record created

    Frank

  • How can I organize my music with iTunes and iTunes game folder?

    I used iTunes for Windows for a few years and 2 years ago started with iTunes game. There are 81 000 files in my folder of music, with 35 000 files in a subfolder of my iTunes. iTunes has about 10,000 songs. Some songs are in my music only and some are in the music/iTunes/media folder. Some are both. With 81 000 files, it is impossible to set this manually. Is it possible to do this with iTunes?  I've never played music with other programs. Is the set of the 'my music' folder in Windows managed by iTunes?  I have a double file Finder application that will get rid of DUP, but I worry that a lot of the music is not in iTunes game. How can I fix the entire folder? Where can I I start again with iTunes game?

    These links may help:

    Manage and backup your iTunes media library - Apple Support

    iCloud library: understand the differences between music from Apple and iTunes game - Apple Support

    The link above:

    When iTunes game adds these songs in your music library from iCloud, iTunes game is not change or modify your original files music located on iTunes for Mac or PC, or on your iOS devices, where they have been added.

  • How can I use the AppleCare with replacements USA helmet in Israel?

    How can I use an AppleCare with replacements USA headphones for my iphone in Israel 6plus? Am I covered overseas?

    Technically, no. The warranty is valid only in the country where the phone was originally sold. However, that restriction is based on the differences between the models of phones sold in different countries and the availability of substitutes service. You may very well be able to get the headphones replaced here since there is no difference between those who were included in phones AND those that are included with the phones sold in your country. Make an appointment at the genius bar or take it to your local CENTER and see what they can do for you.

  • Re: Satellite A50 - how can I change the boot with BIOS password priority?

    I have a Satellite A50. I need to restore to factory default to recover DVD, how do I boot from the DVD?

    The default boot priority is the HARD drive and is more bootable has been formatted. My BIOS is password protected, how can I change the boot priority? After having inserted the password, its always boot from the HARD drive.

    Thank you

    The boot priority, that you can change in the BIOS.
    Go into the BIOS with ESC, enter your password and then you can change it.
    But don t forget to save the changes.

    That s all and then you can boot from the CD.

  • I had to change my Apple ID because of accusations of fraud but my iPhone 6s 9.2 still has the old Apple ID and will not accept old or new passwords. How can I update the iPhone with the new Apple ID 9.2 6s?

    I had to change my Apple ID due to fraudulent charges but my iPhone 6s 9.2 still has the old Apple ID and will not accept old or new passwords. How can I update the iPhone 6s 9.2 with the new Apple ID and password? I tried to perform a complete reset, but which requires the Apple ID and password that doesn't work not... pretty frustrated here.

    YYou have unlink the old iphone you as find my iphone the reset all devices on this subject from your account then plug it to your iTunes then restore a new one after that reset password that under the new phone then connect

  • How can I find the code for the iTunesi

    How can I find the ocated

    What is the code you are looking for?

  • How can we identify the code that triggered the promotion discount in order?

    Hello

    As we can create coupons and promotions assign them to give discounts. How can we identity coupon code that is added to the promotion which caused the discount in order?

    Kind regards

    Chede

    I give you an example. Here's how you do it from the order level promotions. OrderImpl (object) (API below give you orderpirceinfo and second link gives adjustments.)

    http://docs.Oracle.com/CD/E35319_01/platform.10-2/APIDoc/ATG/commerce/order/OrderImpl.html#getPriceInfo )

    OrderPriceInfo that extends AmountInfo, the following method gives adjustments

    http://docs.Oracle.com/CD/E35319_01/platform.10-2/APIDoc/ATG/Commerce/pricing/AmountInfo.html#getAdjustments )

    Now browse adjustments, for pricingmodel (i.e. promotion) and coupon applied on order

    PricingAdjustment (ATG Java API)

    PricingAdjustment (ATG Java API)

    Hope that gives you an idea where to start.

    -Kiss

  • substr? How can I retrieve the codes that are only 6 characters

    I have this request
     
    SELECT 
    distinct
    SUBSTR(A.STVSBGI_CODE,1,6),
    SUBSTR(B.STVSBGI_CODE,1,6),
    A.STVSBGI_TYPE_IND,
    B.STVSBGI_CODE, 
    B.STVSBGI_TYPE_IND
    FROM 
    stvsbgi A ,
    stvsbgi_TEST6C B
    WHERE A.STVSBGI_TYPE_IND = 'C'
    AND B.STVSBGI_TYPE_IND = 'C'
    AND instr(A.STVSBGI_CODE,1,6) =  instr(B.STVSBGI_CODE,1,6)
     
    I want to be able to extract ONLY the values (STVSBGI_CODE) where the SUBSTR (A.STVSBGI_CODE, 1, 6).
    There are codes in the tables of 4 characters, the query gives me 4-6 characters...
    How can I write the query to get the 6-character codes
    Thank yoou

    Hello

    If you want to only include lines in the output, if the code is at least 6 characters?
    Add to the WHERE clause:

    AND     LENGTH (a.stvsbgi_code)     >= 6
    

    It doesn't matter if you use a. stvsbgi_code and b. stvsbgi_code in this State; the join condition is already excluding the lines where it is less than 6 characters but the other is not.

    I hope that answers your question.
    If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all tables and also post the results desired from these data.
    Explain, using specific examples, how you get these results from these data.
    Always tell what version of Oracle you are using.

    Published by: Frank Kulash, November 18, 2011 12:58

  • How can I replace the windows with ScanGear tool analysis tool much better? MX882 on Windows 10 Pro. ?

    I have a PC on which I instaled the Canon drivers live cannon and I love the ScanGear interface. It surved upgrade Windows 7 to 10 Professional. On the other hand, for my other PC in the home group, I let windows install the drivers for the MX882. Scanning windows interface is limited! How can I get the ScanGear interface to replace the windows tool?

    Thank you!

    B

    ScanGear is just the scanner driver. Are you talking about software, Canon MP Navigator EX scanning? Which is available for download from the Web site.

Maybe you are looking for

  • How can I get my emails?

    Thunderbird has been updated and I can't retrieve my emails.

  • Cannot add lyrics

    With the help of itunes 12.4.1 and I have an album that I bought on itunes. I try to add the lyrics because the song did not come with them, but the fields are gray when I click on 'Get Info'. I re - sync my library and disconnected and reconnected m

  • Looking for set up the NI 9233 module, well through which bus?

    I'm a bit new to conducting analysis of vibration at high speed... I see a ton of information on the programming side of things software, although my main concern now is getting the correct 1st place material. Right now my apron for the acquisition o

  • Veriton X 270-Windows 10

    Hello world I have a Veriton X 270 with Windows 8, and I was wondering if I will upgrade to Windows 10 all drivers will be available. I don't want to do the upgrade and after to find out that I can not install the card LAN or the sound. Thank youStef

  • Problem uninstalling SAM 2003

    I'm running it in compatibility mode, because my machine OS is Windows Vista Home and SAM 2003 does not support. Now, when I go to uninstall the program, I get an error in the uninstall of SAM program that says: 'SAM has detected an operating system