Help making a Game with AS3

Hey Guys (and Gals)
I’m hoping one of you can help me out with a game I am making in flash.
I’ve been following through this tutorial online (http://as3gametuts.com/2011/11/11/platformer-1/) , and it seems to have missed some fundamental parts that I desperately need, and I am really struggling to work out how to do it.. I’ve vigorously Googled, but to no avail..
Basically, I need to animate the enemy sprite, but whenever I add any kind of animation to the symbol, it becomes non-collidable; the player just passes right through it!
I also need to work out a way to remove enemy sprites from the previous level, as they seem to be passing forward to the next level, and adding a ‘removeself’ function doesn’t seem to do anything. I then need to add a new, separate list of enemies for the next level..
I want to point out that I am EXTREMELY novice at flash (and coding in general), so if you could dumb-down your answers that would be really helpful.
Here is the source code: https://app.box.com/s/d6oibaw63w12e2kvcmsx
Thanks in advance!

What do you mean by animating enemy? If you are trying to add some animation to it on the main timeline - perhaps something what Amy sensed happens. The thing is that manually created animations on timeline sometimes are very difficult to fit into conventional AS3 functionality.
I suggest you try to animate enemy on its own timeline (not op the main timeline). I guess programmatic animation is too much to attempt for your level.

Similar Messages

  • Making a game with 3 layers of tiles; help

    Hi guys,
    I am busy making a game which will have 3 layers of tiles. Firstly, the terrain, then the buildings and finally the player (sprite).
    I was thinking of using JLayeredPane to achieve this. But, I was also thinking of just drawing all the layers onto one bufferedimage and then just showing that everytime? What would you say?

    Thanks, i am going to do that. question now is one of transparency.
    How do i make sure that Java treats my png properly? I have tried testing whether it treats the transparent pixels properly and it doesn't. How do i work around this?

  • How do I add flash cs4 game with AS3 to flash cs4 website??

    I have created a game in flash with ActionScript 3 and now want to add it to a website I have created with pages seperated into keyframes. Ideally, I am trying to have the game start when a link on the home page is selected. I would also like the users to be able to download the game themselves??? Any ideas for a flash novice??

    Thank you so much!!! I just added it with a UI Loader Component! Worked really well... although it looks like doing that picked up an issue with some of my code? It's now looping over and over again and the counter within my game (for giving players their score - highlighted in red), is not working?If you are a AS3 guru any help would be greatly appreciated, otherwise thank you so much for your earlier tips
    package
        import flash.display.MovieClip;
        import flash.events.*;
        import flash.utils.Timer;
        import flash.text.*;
        public dynamic class Gift extends MovieClip
            private var dx:Number = Math.random() * 10; // make gift scurry
            private var dy:Number = Math.random() * 10;
            public function Gift ()
                this.gotoAndStop(Math.ceil(Math.random() * 4));
                this.addEventListener(Event.ENTER_FRAME, scurry);   
                stage.addEventListener(MouseEvent.MOUSE_DOWN, kill);
            public function scurry (e:Event)
                if (this.x < 0 || this.x > 550)
                    this.dx *= -1;
                if (this.y < 0 || this.y > 576)
                    this.dy *= -1;
                this.x += this.dx; // make gift scurry
                this.y += this.dy;
            public function die()
                this.removeEventListener(Event.ENTER_FRAME, scurry);
                parent.removeChild(this);
            private function kill (e:MouseEvent):void
                if(e.target is Gift)
                    e.target.die();
                    score += 10;
                    scoreText.text = score.toString();

  • Help Making a Game Like Pokémon Trading Card Game.

    Hello! Im kinda new into making games in flash. And im trying hard to make a Game like the Pokemon TCG and i can't find anything on the internet that helps, so can't someone teach me how to do a game like that. Thanks!

    Well, it's not much. But i will studdy and become great!
    Thanks for your answer!

  • Help: Making a DVD with Toast, but No Audio

    I have searched on here and other places, found some helpful information and hints, but still nothing has worked out completely right.
    I have some .avi files I want to put on a DVD and I'm using the burning program Toast 7 in the DVD-Video tab to do it. I have been able to successfully burn video DVDs when the audio is mpga format, but when the audio is in either A52 or AC3 format, the video loses the audio.
    I was told I might need to get the A52Codec.comonent and the AC3 Codec.component files for QuickTime. I did that and installed them in the proper folders. I got the audio to work when the video when it is played in QuickTime (it didn't before). That's great and all, but when I burned with Toast 7, there was still no audio, only video came out again.
    I don't know what I need to do. Do I need to convert the .avi to an audio Toast 7 can read and burn (like mpga)? Or is there some .component file I can download and drop it in my Components folder, which will allow the audio to burn correctly to the DVD?
    Thank you to anyone who can assist me. I have been at this for 2 days now and have throw out a handful of DVDs trying to get this to work.

    Casper,
    Okay I want to sing the friendly ghost from the show when I see your name.
    I burn avi all the time in Toast 7.1.2 Toast and I usually convert them to divx to fit 10-11 hours of video on there, but I've done it with DVD video. A friend lent me a movie once with no sound and here is the problem that will work everytime. You need to download the VLC player to get it to work right. Here is the link: http://www.videolan.org/
    Didn't even know they had an intel one as I have the other version on my Powerbook and just transferred it to my intel one. Once it is downloaded you click on the orange striped cone and then you will see a little VLC box come up. The most effective way to view any file is to go to File up top and then scroll to open file (I've down the quick open file too and then you see a open box and a button that says browse next to it. Click the browse and find the movie or divx you want to watch and click open and then okay, then click the play arrow that is on your desktop and viola. You can go up top too and go to video and click full size screen etc.
    If this was helpful or solved your problem please click the helpful or solved button up top. If this doesn't work let me know too.
    S.

  • How to make a first-person style game with arrow key movement?

    Hey guys, I've made some simple click-to-move 1st person games with AS3, but I just wanted to know if there was a way to move around in 1st person with arrow keys, I was thinking you could get the background to move with the arrow keys, but that would be a little confusing.
    If you guys have any suggestions for me, or if it's possible, please reply! Thanks

    Here is a basic switch usage to move something with the keyboard:
    stage.addEventListener(KeyboardEvent.KEY_DOWN, move_mc);
    function move_mc(event:KeyboardEvent):void {
        switch(event.keyCode)
           case  Keyboard.LEFT : mc.x -= 5
           break;
           case  Keyboard.RIGHT : mc.x += 5
           break;
           case Keyboard.UP : mc.y -= 5
           break;
           case Keyboard.DOWN : mc.y += 5
           break;

  • Making Java Game Help ^^

    We're making a game for our Java course and we're thinking of making something like Flash Flash Revolution, only in Java. Is this anywhere near possible? Or should we just make a tile-based game like Spyhunter...?
    I'd really appreciate some help or comments. ^^

    This can 100% definetly be done.
    The only real hard part is getting the arrows to perfectly sync up with the BPM of the music. Your going to have to write a routine that can change the scroll speed and timing of the arrows based on varying BPM values.
    There are some free programs out there you can download that will give you the BPM of songs you feed it. The non free tools allow you to get a higher and more accurate BPM precision.
    Of course if you simple make the game only have 1 song, and you already know the exact BPM, then you can code the initial arrow movement speed for that one song and pretty much the rest of the game is a cake walk to program.

  • If i reset my ipad can i install paye games for free if i sign back into my apple ID. Please i need help because i need to update my games but i need to put in this billing thing and i want to get rid of it so then i cant buy games with my credit card

    If i reset my ipad can i install paye games for free if i sign back into my apple ID. Please i need help because i need to update my games but i need to put in this billing thing and i want to get rid of it so then i cant buy games with my credit card

    Hello,
    As frustrating as it seems, your best to post any frustrations about the iPhone in the  iPhone discussion here:
    https://discussions.apple.com/community/iphone/using_iphone
    As this discussion is for iBook laptops.
    Best of Luck.

  • We like to play games with Spigo. But the games do'nt come totaly on the PC. I think they are 75 %. Can you help us? r.sissing@planet.nl

    # Question
    We like to play games with Spigo. But the games do'nt come totaly on the PC. I think they are 75 %. Can you help us? [email protected]

    Do you mean that the game doesn't load or that you do not see the complete page?
    Reset the page zoom on pages that cause problems: <b>Beeld > Zoomen > Herinitialiseren</b> (Ctrl+0 (zero))
    * [[Page Zoom]]
    * [[Text Zoom]]

  • Need some help on a game im making

    Making a game called Beetle however i got stuck when trying to display the players name in the main method. As you will see the variable playerName is supposed to be returned by beetleGameIntro method but i dont think it is because when i run it the dialog box is blank...also i played with the initializing of that variable and found out that if i take away the blank quotes and make it public static the dailog box shows "null" but i want to know why its not displaying the name entered.
    public static void main(String[] args)
            boolean playAgain=false;
            boolean hasHead=false;
            boolean hasBody=false;
            boolean hasTail=false;
            boolean hasFeelers=false;
            boolean hasEyes=false;
            boolean hasLegs=false;
            int feelerCount=0;
            int eyeCount=0;
            int legCount=0;
            String playerName="";
            beetleGameIntro(playerName);
            JOptionPane.showMessageDialog(null, playerName);
            while(playAgain=true)
            System.exit(0);
        } // end main
    public static String beetleGameIntro(String playerName)
            boolean seeRules;
            playerName=JOptionPane.showInputDialog("Welcome to the Beetle Game! "+
                                                   "\n \n What is your name? ");
            seeRules=yes("HELLO "+playerName+".\n\n Would you like to see the rules (Y/N)?");
            if(seeRules)
                displayRules();
            return playerName;
        } // end method beetleGameIntro

    When you call the method beetleGameIntro from your main method, what happens is that the contents of playerInfo in the main method (" ") is copied to the variable playerInfo in the scope of the beetleGameIntro. The variable in the beetleGameIntro is not the same as the variable in the main method. The following code does exactly what your code does right now, and might clear things up, but not fix your problem. You should try to fix it yourself so that you won't run into the same problem again :)
    public static void main(String[] args)
            boolean playAgain=false;
            boolean hasHead=false;
            boolean hasBody=false;
            boolean hasTail=false;
            boolean hasFeelers=false;
            boolean hasEyes=false;
            boolean hasLegs=false;
            int feelerCount=0;
            int eyeCount=0;
            int legCount=0;
            String playerName="";
            beetleGameIntro(playerName);
            JOptionPane.showMessageDialog(null, playerName);
            while(playAgain=true)
            System.exit(0);
        } // end main
    public static String beetleGameIntro(String unusedVariable)
            boolean seeRules;
            String playerName=JOptionPane.showInputDialog("Welcome to the Beetle Game! "+
                                                   "\n \n What is your name? ");
            seeRules=yes("HELLO "+playerName+".\n\n Would you like to see the rules (Y/N)?");
            if(seeRules)
                displayRules();
            return playerName;
        } // end method beetleGameIntroI think you don't even want to pass a variable to the beetleGameInfo method, only store the result of the call in a variable in the scope of the main method:
    String playername = beetleGameIntro(); // this goes in the main method

  • I am downloading a 6.4GB game with Safari. Download starts very well, 850KB/s but systematically after 10 or 15mn speed goes down until download stops. Can somebody help please?

    I am downloading a 6.4GB game with Safari. Download starts very well, 850KB/s but systematically after 10 or 15mn speed goes down until download stops. Can somebody help please?

    systematically after 10 or 15mn speed goes down until download stops
    Check with your iSP. There may be a limit to files sizes.

  • Help making a Spot The Difference game

    Hi!
    Im pretty new at Actionscript 3.0 and I have to make a Spot The Difference game for school.. Now I followed a tutorial, but it's in AS 2.0 and I really cant get it to work in AS 3.0. Also, the tutorial isn't complete, so is there anyone that can help me any further with the code ?
    Here's the tutorial I followed:
    http://www.flashperfection.com/tutorial ... rence-Ga...
    Thanks!

    The link in the first post doesnt seem to work, so I hope it works now:
    http://www.flashperfection.com/tutorials/Create-a-Spot-the-Difference-Game-63139.html
    The code in the game Mc is:
    var differences:Number = 3;
    var found:Number = 0;
    function addDifferences(thisSide, otherSide) {
    for (var i = 1; i<=differences; i++) {
    var difference = thisSide["dif"+i];
    difference.useHandCursor = false;
    difference.found = false;
    difference.otherSide = otherSide["dif"+i];
    difference.tabEnabled = false;
    difference.onPress = function() {
    if (!this.found) {
    this.play();
    this.otherSide.play();
    this.found = true;
    this.otherSide.found = true;
    found++;
    if (found == differences) {
    found = 0;
    levels.play();
    and then on left side:
    _parent._parent._parent.addDifferences(this, _parent.rightSide)
    and on the right side:
    _parent._parent._parent.addDifferences(this, _parent.leftSide)

  • What is wrong with as3

    this is not a question about 'how i do X'. is rather a 'discussion' (flame or whatever, but to defend or argue about aspects, not people) about 'what is wrong with as3' and what aspects whould be taken into consideration for updates. right now i am using as3, and since i paid for this license, i choose this tool over some alternatives and i am using it to do stuff for other people who pay me to do it, i think it can be helpful for all of us if some actions are started in the right direction. i have already posted about 'all people in adobe are dumbasses that do not know how to make a scripting tool and are messing up my work', but i was pissed at the time (i still am pissed) but i believe this is not the right aproach. instead, if this goes to the right people in adobe, we all may get something in the future, like better and easier todo apps and web presentations.
    pre: not only about the as3 specification, but COMPLY with the specification that you set. for example, some time ago there were problems with matrix transforms. this was corrected later with a patch. but this means it is not even doing what is is supposed to do
    1. scriptable masks and movement, sprites and child sprites: there is a sprite with a mask, the mask is a shape drawn via script, something like
    somemask=new shape();
    somemask.graphics.beginfill();
    (...etc)
    somesprite.mask=somemask;
    just like that. now add some child sprites to 'somesprite', and make 'somesprite' move, scale and rotate. there you will have something like a kaleidoscope, but not what you expected to do with your script. as the child sprites move in the parent mask, you will see that the child sprites appear or dissapear kind of randomly, and if the child sprites are textfields, it may be that the text is rendered outside the mask, or partially rendered outside the mask (as in only part of the text), rendered with the wrongf rotation or in the wrong place. some child sprites are clipped correctly, some dissapear totally when only a part should dissapear (clipped) etc.
    way around: have not tried it yet, but i have the impression that bitmaps have different criteria for clipping, so i am thinking of trying this: appli an empty filter (a filter with params so it does not have any effect on the sprite or in the textfield) so the sprite is rendered as bitmap before doing anything else with it. as i said, i have not done it yet, but it may be a way around this problem, to avoid all this inconsistency with clipping
    1-b. inconsistency between hierarchy and coordinates, specially masks: you apply a mask to a sprite, yet the sprite has a set of coordinates (so 'x' in the sprite means an x relative to its container), yet the mask applied to the very same sprite, as another reference as reference for coordinates (like the stage)
    2. painting via script: in any other languaje, in any other situation, something like:
    beginFill(params);
    (...stuff 1)
    endFill();
    beginFill(params);
    (...stuff 2)
    endFill();
    (...etc)
    means: render region of block 1, then render region of block 2 etc, and no matter what, it should be consistent, since there is noplace for ambiguity. if you read it, you may think what that means, even if you dont run it you may have an idea of the picture you want to draw, but not with as3. as3 somehow manages to screw something that simple, and mixes all the blocks, and somehow uses the boundaries of one block as boundaries for other block. is like all blocks are dumped into whatever, and then uses all lines defined into it as boundaries for a unique block. it changes all boundaries and generates inconsistency between what is shown and redraw regions of the resulting picture, like lines that go to the end of the screen and then dont go away in the next frames, even tough the beginfill endfill block should prevent it
    3. event flow: i dont know what was the policy behind as3 event flow design. it is in no way similar or an extension to previous event flow, neither with any event flow in any other plattform. i dont know how most people start with as3; in my case, i unpacked, installed and when i tried to do something with what i already knew i could not, so i started reading the as3 docs, and since is like 800 pages long, i just read the basics and the rest i would 'wing it'. in the part of the event flow, there was something about bubbling and stuff, it was not clear at all and when i tried to do what is was said in the documentation (like preventing events to 'bubble', as is called in the documentation), i could not see any effect but i could see it was a mess. flash is not the only thing out there to work with pictures or to work with mouse events, but is the only one that deals with things like 'target' and 'currentTarget'. my first experience on needing this was when i was dealing with my own event handlers (so the only thing that had control over mouse was the stage, and i would admin everything via script). there were events generated everywhere, the stage got events that were not genrated directly over the stage, but got there not with stage coordinates but the coordinates relative to the sprite that generated the event. so if i hover the mopuse over the stage, and the stage has some things on it how does it work? i get multiple event calls, like it was hovering multiple times over the stage in a single frame, but in each call with different coordinates? and what if i set all child sprites as mouseenabled=false or compare like 'if (event.target != event.currenttarget)', what if i move the mouse over a child, does it prevent the move mouse event at all? or does it filter only the event call with only stage coordinates? in my case, every time i move over another clip (with mouseenabled = true), the stage gets it as 'mouse up', even tough there was never a mouse release, what the hell? do even the people at adobe know how to handle events with their own tool when they require it? why does an event 'bubble' when i have not specifically tell it to do it? mi thought is that this event flow was very poorly conceived, and tough the intention may have been that there were different cases and it shopuld cover all cases, they actually introduced new problems that were not present in traditional ways to handle it, and it is neither the easier way to handle things, and this way, a very simple problem turns into a very ugly thing because it must handle things that were not neccesary to handle, or were implicit in other situations.
    4. legacy: since as3, all interaction is different, and if you want to do things in the new plattform, using the new features, what you already knew just goes to the garbage can. when a new tool arrives, it should be an extension to previous tools (which is a reason to update instead of just buying a new tool from a different vendor). if everything i had or knew just means nothing from now on, then i can not say 'i know flash script', and my previous knowledge gives me no advantage when aproaching the new version. as3 is a new aproach that requires doc reading and stuff, even if you knew something about previous as specifications or other oo languajes. if you decide to change things from now on, like the things mentioned in this post, instead of just throwing away everything the users alerady knew about the tool, do like in java releases, they mark some things as 'deprecated', they keep working as they should, give a warning, but also a message saying this feature is deprecated, we suggest you use this library instead.
    5. lack of previous functionality: if you 'update' something, it meand all previos functionality is still there (probably improved, but not with bugs if it was working fine), plus something else. now it seems backwards, there are some things that could be done in previous versions but not in this one, like 'duplicatemovieclip'
    6. inconsistency with scripting/programming paradigms: (ok, fancy work, but fits perfectly here): as3 proposed ways to handle things, but the people who designed it got 'too creative', and they did something that is not consistent neither with previous versions of as or with other languajes. the documentations is full of things like 'it looks like x languaje or languaje family, but instead of using XXX word, you must use YYY'. great, what is this? namespaces 'work like', but 'differently' for example from java, .net, .c. its got the idea that a namespace means a grouped functionality but there are rules about where should be placed the file (ok, java has this also, .net takes care of it automatically if all files are registered in the project), but what you got is a mess that 'if you know other languajes you got the general idea, but nonetheless, even if you knew this or previosu versions of as, you still have to read whatever we decided arbitrarily just to be different'. namespaces, event handling, vars definition which is not like previous scripting neither like fully typed languajes.. is just a mess.
    7. lack of scripting and graphics integration: unlike flash and adobe tools that just got on the graphics side leaving all the scripting integratuion apart, most tools from other vendors integrate very well interacton with what is on the screen. the script editor: very poor. autocompletion? a drop down list that does not heklp at all, appears in the wrong places, and when you need it to go, it does not go (so if i want to move away from the uncalled drop down list, i have to click somewhere else, making developement slowewr instead of helping, so the drop down list does not capture all events when i dont want to). in other ides you double click somewhere and it will go to the part of code relevant to that event or whatever. for example microsoft tools, ok i am antimicrosoft, and one of the reasons was that when windows 95 got to market proposing itself as the ONLY pc os you could use if you wanted to keep useing the apps you already had, it was a lousy product full of flaws but you had to keep using it because you had no choice. what is so different from what is happening with flash just now? yet the ide of c# is awesome, works very well and seems reliable.
    adobe people: not all user are designers that just make pretty pictures. if it is not intended for scripting then why is it there. and if there are corrections to be done, they should patch all versions, not only the last one. previous version users also paid for their versions.

    Well, there is no point in arguing.
    I personally believe AS3 does exactly what it promises to do within limits (read: reasonable limits) of ECMA type of language. And sometimes it doesn’t do what we expect it to for it cannot possibly emulate everyone’s thinking process. The task, I guess, is to learn to think in terms of AS3 – not to try to make AS3 think like us. No language covers all the grounds. And no, it is not Java - with no negative or positive connotation. It is what it is. Period. I just hope that AS5 will be more Java like.
    You are right about the fact that it is not necessary to know all the aspects of language in order to perform the majority of tasks. But it is paramount to have a clear idea about such fundamental concepts as display list model and events. For instance, depth swap has no meaning in terms of AS3 because display list object stacking is controlled automatically and there is no need for all these jumping through hoops one has to perform in order to control depth in AS2. There no more gaps in depths and one always know where to find things.
    Similarly, there is no point in having duplicateMovieClip method. More conventional OOP ways of object instantiation accomplishes just that and much more. Just because OOP object instantiation needs to be learned doesn’t mean past hacks have place in modern times. duplicateMovieClip is a horse carriage standing next to SUV. What one should choose to travel?
    Events are implemented to the tee in the context of ECMA specifications. I consider Events model as very solid, it works great (exactly as expected) and never failed me. True, it takes time to get used to it. But what doesn’t?
    By the way, speaking about events, contrary to believe in Adobe’s inconsideration to their following. Events are implemented with weakly reference set to false although it would be better to have it set to true. I think this is because there are smart and considerate people out there who knew how difficult it would be for programming novices to deal with lost listeners.
    I think AS3 is million times better than AS2. And one of the reasons it came out this way is that Adobe made a very brave and wise decision to break totally loose from AS2’s inherent crap. They have created a totally new and very solid language. If they had tried to make it backward compatible – it would be a huge screw up, similar to how our friends at Microsoft are prostituting VB and VBA – extremely irritating approach IMHO.
    Also, Flash legacy issues shouldn’t be overlooked. Flash did not start as a platform for programmers. Entire timeline concept in many ways is not compatible with the best OOP practices and advancements. I think for anyone who is used to writing classes the very fact of coding on timeline sounds awkward. It feels like a hack (and AS2 IS a pile of hacks) – the same things can be nicely packaged into classes and scale indefinitely. As such I wouldn’t expect Adobe to waste time on hacking timeline concept issues by making smarter editor. They have made a new one – FlexBuilder – instead. Serious programmers realize very soon that Flash IDE is not for developing industrial strength applications anyway. So, why bother with channeling great minds into polishing path to the dead end?
    I would like to state that all this is coming form a person who knew Flash when there was no AS at all. And I applaud every new generation of this wonderful tool.
    I believe Adobe does a great job making transition from timeline paradigm to total OOP venue as smooth as possible. And no, they don’t leave their devoted followers behind contrary to many claims. They are working on making developing Flash applications as easy as possible for people of all walks. Welcome Catalyst!
    Of course there is not enough information about AS3 capabilities and features. But, on the other hand, I don’t know any area of human kind activities that does.

  • A drag and drop game with dynamic text response

    Hi,
    I am a teacher and my school has recently upgraded to Adobe Design Premium.  Our previous version was about 5 versions out of date.
    I teach A Level which requires students to create an Interactice Multimedia product.
    In the previous 6 years, I have taught students how to create simple drag and drop game with dynamic text responses.
    Since the upgrade to Actionscript 3.0 the dynamic text response has ceased working.
    When creating the game from scratch, I need to move to Actionscript 2.0 as 3.0 does not allow me to add actionscript to objects - I know and am sure that this is a better way of doing things, but I would prefer to keep working the way I am used to.
    I use a switch case statement which I have copied below to make the drag and drop work.  The objects I apply the code to work in that they can be dragged, however, my dynamic text box with a variable name of "answer" is no longer displaying the response when an answer is left on a dropzone (rectangle converted to a symbol and given an instance name).
    on(press) {
    startdrag(this);
    on(release) {
    stopdrag();
    switch(this._droptarget) {
      case "/dropzoneB":
       _root.answer="Well done";
       break;
      case "/dropzoneA":
      case "/dropzoneC":
       _root.answer="Hopeless";
       break;
      default:
       _root.answer="";
       break;
    Any help would be much apeciated.
    Thanks
    Adrian

    To drag in as3
    blie_btn is the instance of the object drawin on the stage. In AS3 you have to assign a even listener, in this case MOUSE_DOWN, and MOUSE_UP, as we want the drag to stop if the mouse is not clicked. Then we fire the functions, and tell the object to start drag.
    // Register mouse event functions
    blue_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
    blue_btn.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
    red_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
    red_btn.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
    // Define a mouse down handler (user is dragging)
    function mouseDownHandler(evt:MouseEvent):void {
         var object = evt.target;
         // we should limit dragging to the area inside the canvas
         object.startDrag();
    function mouseUpHandler(evt:MouseEvent):void {
         var obj = evt.target;
              obj.stopDrag();
    if you want to make the text do what you want then something like this might work.
    In the function, you could add a text box onto the stage, give it a instance of something like outputText
    and then:
    outputText = ("Bla Bla Bla");
    (^Not sure if this will work exactly^)
    PS. I am currently a A-level student

  • *Help* making a simple RPG for my AP CS class

    I am in desperate need of help, I am creating an RPG(of sorts, it is a purely a battle RPG in which characters level up and modify stats) there will be no storlyine (Yet) or adventure elements. I've reached a severe mental roadblock in the actual programming of the game but I have a very clear picture of exactly how the game runs. Here's how the game works, after starting a new game from the opening screen, the player begins with a simple battle against one monster. The player has four characters and each character starts with one basic attack. Battle continues in typical RPG style in which the player selects attacks, and then battle ensues in order based on the speed of each participant. At the end of each battle, all the characters level up once and the player can distribute a certain amount of stat points to each of the characters individual stats. The game continues like this for 40 levels with increasing difficulty, new attacks, and an upgrade to a new class at level 20. level 41 is a final boss fight against a typical RPG boss monster. Here is what i particularly have trouble on
    1. Determining how to create the attacks that the player can choose and figuring out how i can call upon them and have them do their damage based on certain specs
    2. Determining how to create an interactive interface that allows the player to choose the attack for each character, upgrade individual stats after each battle, and save (this will be a point and click menu system)
    3. Figuring how to create and input my own homemade graphics into the game (the book i have doesn't seem to cover putting in graphics that you create on your own, just the graphics that are part of the java package)
    Any help on this would be greatly appreciated becuase it is a major grade in my class

    Hello,
    I have been programming (in various languages) for years now. I also am in AP CS and I have been trying to think up a good game to make, i'm about 2 months ahead of my coursework in class and spend my time making and re-making various games during class.
    If i were to program this game i would go about the Attack issue by having a class called Attack (as was mentioned early). In it have the methods and variables and such for the attack, i would have a database or something along those lines of all the attacks (but for now start small with a basic one) and then each player could have one (or multiple - depending on whether or not they have an assortment of attacks) class attached to it (or if multiple perhaps an array or vector of classes). The attack class would contain basic information like the Name of the Attack, the Damage, Type, etc. And the class could even include methods which get the 'Level' of the player and calculate the damage multiplier or something along those lines.
    As far as choosing what to have the characters/players do i would (for yours and simplicity's sake) make a side menu which allows you to choose whatever attack, etc. you want. It's simple and easier to work with, just have a JPanel within the JFrame which controls the players, and it will control each player when it's their turn. This shouldn't be too difficult to do.
    The graphics part (you have already recieved some suggestions about), i prefer to use ImageIcons in my games. They're simple and easy to work with and are painted just as a circle or rectangle is. You just draw the images outside of the program and use them in the program through ImageIcons. If you have a good image-edittor (Photoshop, Flash even), you can make Animated Gifs which will add to the look and quality of the graphics of your program.
    The trick with big projects like this (and the goal of Object Oriented Programming) is to take a big problem (Like and Entire RPG Game -- The Program) and break it up into smaller problems and tackle each one, one at a time (divide the Program into an assortment of Classes).
    I wish you the best of luck, i myself am starting a small game (Something similar to Zelda i'm thinking), i'm still designing it on paper and I personally think if you design and organize everything on paper and make a checklist of sorts, things go much smoother and more organized (not to mention faster).

Maybe you are looking for

  • Iphone 4s activation user unlock

    Hi, is there any way that i can unlock the activation of my iphone without the apple id and password? I just get my old phone from my sister an she used it and attached his apple id to the phone and she dont remember de password...

  • Backup gone wrong

    I had to restore iTunes from backup over the weekend. My PC had to be reformatted, but I backup everything to an external HD. So I have restored, and tried all the steps in the KB article about getting your library back up and running. Unfortunately,

  • Teststand Report generation doc

    Hi Guys, I'm looking into TestStand reports right now, but I have to admit that I'm a little bit lost... I would like to get an easy "manual" on how to edit the reports so I can get my own formating in the report... For example, I would like to prese

  • Broadcom 4312 problems following upgrade

    Hi all, how I've written on the object, after 6 years I have to give-up to archlinux, but really I don't want.  On my first computer, Arch is working very well, but on new laptop from 8 mouths (HP dv5 1101el), I'm having big problems with wireless: l

  • Windows 10 Sleep and Hibernate with HP Spectre

     Hello After upgrading to Windows 10 my HP Spectre x360 the sleep option in the laptop is not working properly, and while in sleep mode, it is still consuming power, and heating up. Also the power options in Windows 10 is not all enabled (the advance