Simple game problem

I'm trying to lay the groundwork for a simple platform game. I start the game, a short animation applies when the controlled player character collides with an invisible (alpha = 0) object. This seems like it should be very simple, but after searching the web for a long time, I have not been able to find a piece of actionscript code that does this simple task. I work in Flash MX and tried many variations on this code, and none of them have worked:

onClipEvent (load) {}

{if (this.hitTest (_root.char))}

gotoAndPlay (2);

}

}

I tried to put this code in the actions of the invisible trigger of the animation, as well as to put a piece of code by replacing ".char" with ".triggera" in the actions of the character

I put it in place so that the game playable is frame 1, and the short animation is frames 2-90, concluding in another form of game.

Help, please!

probably your hittest must run repeatedly (unless you don't want to run a hittest loading your object).  for this reason, place the hittest in a onenterframe loop.  You should also attach any code to objects.

Tags: Adobe Animate

Similar Questions

  • Cannot read simple games on Satellite L30-14

    Hello

    I can't play even simple games on my laptop, such as Stronghold Crusader (what sys requirements are ok for my setup).

    The game always freezes at the main screen of windows after the launch. How can I solve this problem? The game's website says nothing about this problem.

    Other simple arcade games also crushing in the main window after the launch!

    My system:

    Windows® XP Home Edition

    : Processor Intel® Celeron® M 380 has. Clock speed: 1.6 GHz | Front Side Bus: 400 MHz | level 2: 1 MB cache

    System memory
    256 MB | maximum scalability: 2 048 MB | technology: DDR2 RAM (533 MHz)

    Graphic adapter
    ATI | Radeon® ATI Xpress 200 M

    Hi Kamal

    Did you use the original or a copy?
    I also play this game. It s nice. My phone supports a P4 with 512 MB ram 1.8Ghz. The graphics card is a radeon 7500 mobile. It s a little bit older.
    However, I don t think you laptop has a malfunction or there is something wrong with the hardware.
    I see that your device supports only 256 MB memory. Well, I m not 100% sure, but it sounds like it could be a reason for the game from problems.

    What about ram increases? upgrade memory could be the magic key

  • Error message when launching simple games

    When I try to run a simple game, I get an error message "Attempt to access an invalid address." This happens to most, but not all of my games.

    I tried to reinstall one of the games and got the same error message when I launched the setup.exe file.  It's never happened before.  These are old, simple games such as Solitaire and Jezzball.  What does the error message mean and how can I solve this problem?

    System - Windows XP Home edition with Service Pack 3.

    Mike,

    Thanks for the help.  Just as you were posting, I found a solution.  I, too, suspect Spyware, but a Virus scan and Spyware scan revealed nothing.

    A week ago, I had the help of my provider of security in the removal of a virus (PC Defender).  During the session, the technician ran a freeware program called Cleanup to remove the 'useless' my hard drive files.  I suspect that some of the deleted files were not so useless.  I ran a restore of the system back about 2 weeks.  This seems to have solved the problem.

    Again, thank you for having responded to my problem.

  • Number of Collisions in the shooting game problem

    Hello, I work a simple game in which a ship fires at the approach of asteroids, and I have problems with the collision between the ship and the

    asteroid. In the movieClipI ship made incandescent chassis 6 to mean the 3 first collisions and the loss of life, and then for the fourth collision I have

    made an alpha of the 87 frame interpolation inside the boat so that he disappeared to signify the end of the game. I used a meter as shown below but all the ship

    fact is never gets so glow frame 87. Thank you for taking the time to see it.

    import of important flash libraries.
    import flash.events.KeyboardEvent;
    import flash.events.Event;
    import flash.display.MovieClip;
    import flash.display.Sprite;

    var countCollisions:Number = 0;
    var astArray:Array = new Array();
    var speed: Number = 10;
    Initializes the variables.
    var key_left:Boolean = false;
    var key_right:Boolean = false;
    var key_up:Boolean = false;
    var key_down:Boolean = false;
    var key_space:Boolean = false;
    var shootLimiter:Number = 0;
    Checks if the player presses a button.

    var: timer = new Timer(2000, 10);
    timer.addEventListener (TimerEvent.TIMER, AddAsteroid);
    Timer.Start ();

    stage.addEventListener (KeyboardEvent.KEY_DOWN, KeyDown);
    stage.addEventListener (KeyboardEvent.KEY_UP, KeyUp);

    var ship: MovieClip = new Ship()
    var backgr:MovieClip = new Background();

    backgr.x = 0;
    backgr.y = 45;
    addChild (backgr);
    addChild (ship);

    function AddAsteroid(e:TimerEvent):void
    {

    var asteroid: MovieClip = new Asteroid();
    Asteroid.x = 800;
    Asteroid.y = Math.round (Math.random () * 700);
    astArray.push (asteroid);
    addChild (asteroid);
    asteroid.addEventListener (Event.ENTER_FRAME, asteroidmove);

    function asteroidmove(e:Event):void
    {
    Asteroid.x-
    ///

    ///

    for (var i = 0; i < astArray.length; i ++)
    {

    If (astArray [i] .hitTestObject (Ship))
    {
    countCollisions ++;
    ship.gotoAndPlay (6).

    if(countCollisions ==4)
    {
    ship.gotoAndPlay (87);
    }
    If (astArray [i] .stage)
    {
    removeChild (astArray [i]);
    removeEventListener (Event.ENTER_FRAME, asteroidmove);
    }


    }
    }

    }

    }

    addEventListener (Event.ENTER_FRAME, backgroundmove);

    function backgroundmove(e:Event):void
    {
    backgr.x-= 1;

    If (backgr.x <-2110)
    {
    backgr.x = 0;
    }
    }

    Allows the main function play each image.
    addEventListener (Event.ENTER_FRAME, Main);

    Create the main function.
    main function (event: Event) {}
    CheckKeys();
    }

    Create the function KeyDown.
    function KeyDown(event:KeyboardEvent) {}
    if(Event.keycode == 37) {//checks if left arrowkey is pressed.
    key_left = true;
    }
    if(Event.keycode == 39) {//checks if right arrowkey is pressed.
    key_right = true;
    }
    if(Event.keycode == 38) {//checks if some arrowkey is pressed.}
    key_up = true;
    }
    if(Event.keycode == 40) {//checks if the arrowkey is pressed.
    Key_Down = true;
    }
    if(Event.keycode == 32) {//checks if the arrowkey is pressed.
    key_space = true;

    }
    }

    function KeyUp(event:KeyboardEvent) {}
    if(Event.keycode == 37) {//checks if left arrowkey is released.
    key_left = false;
    }
    if(Event.keycode == 39) {//checks if right arrowkey is released.
    key_right = false;
    }
    if(Event.keycode == 38) {//checks if some arrowkey is released.}
    key_up = false;
    }
    if(Event.keycode == 40) {//checks if the arrowkey is released.
    Key_Down = false;
    }
    if(Event.keycode == 32) {//checks if the arrowkey is released.
    key_space = false;
    }
    }

    function CheckKeys()
    {
    shootLimiter += 1;

    If (key_left)
    {
    setDirection (1);
    Ship.x-= 5;
    }
    If (key_right)
    {
    setDirection (0);
    Ship.x += 5;

    }
    {if (key_up)}
    Ship.y-= 5;
    }
    {if (Key_Down)}
    Ship.y += 5;
    }

    If ((key_space) & & (shootLimiter > 8))
    {
    shootLimiter = 0;
    var b = new Bullet();
    addChild (b);
    b.x = ship.x + 50;
    b.y = ship.y + 3;
    addEventListener (Event.ENTER_FRAME, moveBullet);
    }

    function moveBullet(e:Event):void
    {
    b.x += 10;

    If (b.x > 600)
    {
    If (Contains (b))
    {
    removeChild (b);
    }
    removeEventListener (Event.ENTER_FRAME, moveBullet);

    }
    for (var i = 0; i < astArray.length; i ++)
    {
    If (astArray [i] .hitTestObject (b))
    {
    removeChild (b);
    removeChild (astArray [i]);

    removeEventListener (Event.ENTER_FRAME, moveBullet);
    }
    }
    }
    }
    function setDirection (param) {}
    If (param == 0) {}

    ship.scaleX = 1;
    } else {}
    ship.scaleX = - 1;
    }

    }

    You're a little around with it and you have not yet removed the asteroid of the table... see if what follows helps to resolve the issues...

    for (var i = 0; i)

    {if (astArray [i] .hitTestObject (Ship))}

    get rid of the asteroid
    MovieClip(astArray[i]).removeEventListener (Event.ENTER_FRAME, asteroidmove);
    removeChild (astArray [i]);
    astArray.splice (i, 1);
      
    countCollisions ++;
     
    If (countCollisions > = 4) {}
    ship.gotoAndPlay (87);
    } else {}
    ship.gotoAndPlay (6).
    }
    }

    }

  • Very simple ExternalInterface problem :)

    Hello world

    I have a simple question/problem here that in my opinion should be very easy to fix, but I can't find examples of work there!

    What I have now:

    A simple .swf with a function that makes a movieclip (ball_mc) moves to the right called when a button is clicked in the html page:

    import flash.external.ExternalInterface;
    import flash.events.Event;
    
    ExternalInterface.addCallback("sendDataToFlash", moveBall); 
    
    function moveBall():void 
    
         {
              ball_mc.x = ball_mc.x + 20;
         } 
    

    And in my html, I have the following javascript code:

    <script>
    function moveBallOnClick() {
    getFlashMovie("ExternalInterfaceExample").sendDataToFlash();     }   
    </script>
    

    And then I call this function as follows:

    <form>
    <input type="button" onClick="javascript:moveBallOnClick();" value = "Move Ball" />
    </form>

    AND IT WORKS BEAUTIFULLY!

    It's just a simple button and I have a click and move the movieclip

    What I want to do:

    Instead of using the button on the form, I just want to do exactly the same thing but with a hyperlink instead.

    I use the button on the form in my html code now is because after 5 days of internet research, I just could not find a single example of running only a simple function. They were all examples of the sending of forms of text and so on, so I just simplified there from there.

    I want to just do exactly what Im doing now, run the function moveBallOnClick, but not with a form button, just with a normal hyperlink!

    Thank you very much in advance for anyone who can take a look at my problem and may offer assistance :)

    Good bye

    I think that you can just do something like this:

    Move the ball

  • Flex can be used to create simple games?

    Hello. I think to create simple games for children 6-10 years. Games can be things such as drag-and - drop and multiple choice questions. I would like to save the results to a database. Can I use Flex Builder to do this, or do you advise me to Flash? Can you point me to a resource on this?

    The reason why I ask is that I have built web applications using Flex and have some experience with Flash Basic. Building games will be very difficult if I have to use the Flash? The project will begin in January and should be completed by the end of March 2010. Thank you.

    According to your description for games Flex should be fine. It also depends on the skills and experience you have in the technology.

  • Cannot install the simple game (Fishdom) due to the run-time error 'asked to terminate in an unusual way.

    I asked about Playrix, but they are completely clueless.  I bought Fishdom and downloaded.  When I go to install it, to the last window when he says 'launch Fishdom?' and I hit "Yes", it will not launch and I get the infamous runtime error:

    Runtime Visual C++ error library
    The application requested to terminate the duration in an unusual way.
    For more support, please contact administrators.

    Maybe it's not the exact wording, but I know that everyone is familiar with this error message. There is no error message number to identify the problem.

    I posted this under games even if my prob is perhaps not relevant to this forum.  If anyone has a suggestion of where to go, it would be very nice and I can re-post.

    I've updated my graphic drivers, Update ActiveX, DirectX, restarted, and whenever I have it re-downloaded, not only do uninstall the version I tried to install, but I go to C/program/files/Playrix and delete anything there as well.  I don't have this in-between software - as a Playrix games - car Manager at least gives me a direct download link so I'll actually not through a distributor site.

    I have XP SP3, use FireFox (current version), and my graphics driver is Express family Chipset 965 (which I think is a Ricoh or Intel product?).  It came with my Dell Inspiron 1520.  I have no other problems with anything on my computer and play frequently other simple match 3 games - online - on the MSN Games website.

    I have Malwarebytes running in the background.  I also tried to disable the real-time protection and install and which did not help.

    I really want this game, and anyone who can help me with this will have my eternal gratitude.  (A lot of promise, I know, but you'll be worth it).

    Thank you to everyone who is addressing this.  I will try what you suggest!

    Catsin

    Hi Catsin,

    I suggest you follow these methods and check.

    Method 1: I suggest that you try reinstalling from Visual C++ Runtime library.

    http://www.Microsoft.com/downloads/en/details.aspx?FamilyId=a7b7a05e-6de6-4D3A-A423-37bf0912db84

    Install the application and check.

    If the method above does not work, proceed to the next method.

    Method 2: Run the clean boot and try to install the application.

    To do this, follow the steps in this link:

    http://support.Microsoft.com/kb/310353

    NOTE: Once you check the functionality, follow the suggestions under steps to configure Windows to use a Normal startup state.

    If the previous step fails, then try to install the program in compatibility mode and check if it works.

    Method 3: How to use Windows program compatibility mode in Windows XP

    http://support.Microsoft.com/kb/292533

  • Performance while playing games problems

    Original title: stuttering problems in games that also affects the office.

    OK, so I've had this problem for a little while and for the life of me, I can't identify its cause. I noticed it about 2 months ago. During the game Saints Row 4, I noticed that this stuttering took place every now and then. Essentially, the game is very, very smooth, but it would start this weird stuttering suddenly and would last for a random time. Stuttering would occur at an almost exact frequency of every half second. When you turn the view quickly, this would make the scene jump forward as if there is lack of images for animation. I alt-tab out and back in the game, which seemed to fix it, but I was wrong on this issue. This was not a fire that difficulty, as it worked only sometimes. I assumed that the alt - tab solution may just be a coincidence. Also, sometimes I can play for hours and never see this stuttering, it's completely random when it happens. Initially, I thought it was the game, but as the days went on, I noticed it popping up in just about every game I play. I thought at first it was only using direct3d games, but I started noticing every game, even the 2d games.

    Another problem with this is, I alt tabs on a game, pulled up to see if all processes have been hitting the cpu and noticed stuttering when I re-size the window Task Manager. So I kept stretching the sides of the window back and noticed that stuttering is present on my desktop. After being on the desktop for a while, it seems to stop, how can I return to the game and play for free, for a random period of stuttering.

    I saw no process hogging the CPU on the performance tab, and the ram usage was normal. Did not notice the spikes, either, other than stuttering of weird window. I tried many things to solve this problem and many have sought a forum on stuttering, nothing helps. So far I've updated map mother drivers (including my sound chipset), rolled drivers on my video card after their update without any positive result, ran memtestx86 to rule out the possibility of problems with ram, tried different usb ports, thinking they are defective, ran programs to check the temperature of cpu and gpu (who contributed the most to 45 and 68(c) respectively), tried to launch games from a different hard disk, open my file and pulled out my video card, all dusted off and put the card in a different PCIe slot, ran malwarebytes to remove malware running in the background, disabled startup items not vital and maybe a few other things that I don't remember, right now. Long story short, I was not able to find the problem.

    I've seen people say all sorts of things, like disable the speedstep and other energy saving features, but I've also seen people try to demystify these solutions. I've always had has permitted, for almost 2 years now, so if that was the cause, I guess I would have noticed it before now. The problem with not knowing what is causing it is, it makes it difficult to reproduce the problem. Most of the time, I have to wait awhile, after trying a solution given, only to discover that stuttering is still there. It is not a performance issue. I know what bad performance in PC games, and it's something totally different. My PC runs beautifully, until this stuttering starts. Game demanding resource or not, it is present in everything that once it starts, even the office. Definitely seems to be triggered by the game, however, which leads me to believe that I can just have a problem with my gpu hardware. I have another video card I could put in there and will probably be the next day or two, but it is so old I probably would not be able to tell if I get stutters or general bad performance.

    As I said, a game can be run for hours, silky or it could immediately start stuttering, it is very random. If anyone has an idea of what I could try, your help would be greatly appreciated. I'd love to understand this, before I begin to buy new hardware or reinstall my OS, as I have very bad internet and download updates and games would be an absolute nightmare. Thank you very much for your time and congratulations, if you have done throughout this post.

    My specs are:

    Windows 7 64-bit family

    Intel Corei7 3820 @3. 6 ghz

    ASUS P9X79 Deluxe MB

    16 GB ram Corsair Vengeance

    EVGA GTX680 Sc + (2 GB)

    Samsung 840, 250 GB SSD (OS disk)

    2 x 1 TB hard drives Western Digital (games and storage)

    Corsair H100i liquid cooling

    Corsair TX850m PSU (850 watt)

    Optical mouse Logitech MX518 wired (usb)

    Keyboard game steel series (usb)

    Holy *, man, sacred *. I think that I found the solution, or at least I hope. It kinda makes me crazy, everything that makes me happy. He just started stuttering in a game and for some strange reason, I decided to join the back of my monitor and wiggle it's cable and stuttering instantly went away. I wonder if the solution is as simple as a cable, or maybe true DVI port on my monitor. Man I hope so. It could very well be a coincidence, but it stopped immediately after wiggling the cable. Hoping that I found it! : DDD

  • Puzzle game: problem with the forums?

    Hey, I'm doing a simple puzzle game, I copied the code, but it is not recognizing my symbols. Is this a problem of naming instance?

    http://www.2shared.com/file/rZdWNrNz/jigsaw.html

    Any help would be great.

    Thank you.

    To assign an instance name to an object, you pass an instance of the latter on the stage, and when it is still selected, you enter the name of the instance to do this in the properties panel.  Avoid any right-click involved.

  • scrolling game problem

    Hello, I'm trying to create a scrolling game in as3. The problem I have is how do things like explosions and rockets firing from the ground to the Player object to scroll with the background rather than remain stationery with the player during the game object. Does anyone know a simple way to keep the explosions and other stuff unrelated to the Player object, keeping scrolling with the background?

    Is there a reason that these things do not exist in the background layer?  If the problem is that they appear above the Player object, then maybe you could create a movieclip above the Player object containing all the exlposions (etc.) and have this movement as the background moves.

  • Download from itunes game problems

    iTunes game is of no use to me. I have only had it hoping that it would save everything before that my hard drive has been replaced, but no luck so I didn't renew. I downloaded all the music to my mac and my iphone, however, do not renew the service, music that had certainly been downloaded on my phone (indicated by the phone with a checkmark icon) return soley on the cloud that I have to pay $25 for. Someone else has experienced this problem or know of a way around having to spend more money to get my music? (Apple keeps the history of purchases for more than 4 years, so more that 3/4 of my library cannot be simply re-uploaded. I contacted apple several times on the recovery of past history of purchase and that the only response that actually my question that I thought they could try to search for individual songs of each order number, which I had no idea that I had to keep for thousands of purchases).

    If the media is always on your iPhone, see recover your iTunes from your iPod or an iOS device. Have you changed your Apple account information. I have purchases dating back to 2007.

    TT2

  • Display in 3D games problems

    Satellite 5105-s701 (GeForce4 440 Go)
    Windows xp pro

    When I play 3D - like CS, Call of Duty and Star Wars KOTOR games a lot of green dots appear in the areas that are supposed to be dark. Sometimes, there are no problems, and sometimes the Green errors are everywhere.

    I tried to change the display driver and I have also reinstalled the system (from recovery cd) and nothing did - I guess it's a hardware problem.

    Can someone tell me what the problem is and if I can fix it?

    Hello

    You can try to put it up using Toshiba Power Saver. Somewhere in full power properties must be option called cooling method. Use Maximum performance.

  • Simple comport problem

    Hello

    I have problem to find the difference between the example vi and mine. I just sent an ascii code simple with 3 characters and CR LF at the end. If I run ' basic series write and Read.vi "in the examples, it works fine. BUT, if I accumulate by myself, even if I use the same components, it not send \r \n as characters as commands.

    Can someone cause a glance on it?

    MFG Rainer

    LV 8.5.1

    Hey Rainer,.

    When you insert your string to write? If you use the "Schreibpuffer" entry, you must change the type of view for "code view" and then insert the "\r\n". Right-click on the control (in the public Service) and select "display-Code.

    At the moment you send '\n' as the latter sign. If you don't want it, then change the Boolean constant false.

    It will be useful.

    Mike

  • simple table problem

    I have read some data from a text file and form a table according to my requirement (the illustrious photo attached).

    What my problem was when I used this table in an other vi through the connector components, all the lines in the resulting table the width of the line of maximum size, and are filled with zeros.

    How do I remove it? I need the lines ending with its own values, here in my case two first rows should have 5 items in the table, the elements of line 7 third and so on...

    Your VI makes no sense. Why not autoidenxing? Why "delete from table?

    Here's a simple possibility (just to write the resulting string in a file).

  • I'm having trouble installing a game problem event name: BEX

    I have problems installing a game.

    Signature of the problem:

    Problem event name: BEX

    Application name: WoW - 4.0.0 - WOW-frFR - install .exe

    Application version: 4.2.0.4670

    Application timestamp: 4d081ca6

    Fault Module name: WoW - 4.0.0 - WOW-frFR - install .exe

    Fault Module Version: 4.2.0.4670

    Timestamp of Module error: 4d081ca6

    Exception offset: 0019de91

    Exception code: c000000d

    Exception data: 00000000

    OS version: 6.1.7601.2.1.0.768.3

    Locale ID: 1033

    Additional information 1: 5ac1

    More information 2: 5ac187d817eb889e7cb2fb6c438b5fda

    3 more information: 832f

    Additional information 4: 832f14b92050ce4c9ad1e3667aabcf1d

    Read our privacy statement online:

    http://go.Microsoft.com/fwlink/?LinkId=104288&clcid=0x0409

    If the online privacy statement is not available, please read our offline privacy statement:

    C:\Windows\system32\en-US\erofflps.txt

    Try the procedure described here: http://us.battle.net/wow/en/forum/topic/2416194068

    If those who do not work, try to create a new post on the Blizzard support forums.

Maybe you are looking for