How object can travell on other objects?

I want create game. In game will player. And this player must go on blue boxes(so, player can go to left, right and jump). How i can do it?:)
Also attached picture and files.
code:
package code{
     import flash.events.Event;
     import flash.events.*;
     import flash.events.KeyboardEvent;
     import flash.display.MovieClip;
     import flash.display.*;
     import flash.ui.Keyboard;
     import flash.utils.*;
     public class Travelling extends MovieClip
          // Properties:
          public var left:Boolean=false;
          public var right:Boolean=false;
          public var jump:Boolean=false;
          // Animation
          public var speed:Number=15;
          // Constructor:
          public function Travelling()
               // Listen to keyboard presses
               stage.addEventListener(KeyboardEvent.KEY_DOWN,keyPressHandler);
               stage.addEventListener(KeyboardEvent.KEY_UP,keyReleaseHandler);
               // Update screen every frame
               addEventListener(Event.ENTER_FRAME,enterFrameHandler);
               my_fps.text = String(stage.frameRate);
               my_points.text = "0";
          // Event Handling:
          protected function enterFrameHandler(event:Event):void
               var points:Number = 0;
               // Move left, right, jump
               if (jump && ! right && ! left)
                    trace("jump");
               if (left&&! right) {
                    trace("go to left");
                    player_mc.x-=speed;
                    player_mc.scaleX=-1;
                    if (player_mc.x-player_mc.height/2<warField_mc.x) {
                         player_mc.x = warField_mc.x + player_mc.height / 2;
                         player_mc.gotoAndStop(1);
               if (right&&! left) {
                    trace("go to right");
                    player_mc.x+=speed;
                    player_mc.scaleX=1;
                    if (player_mc.x+player_mc.height/2>warField_mc.width) {
                         player_mc.x = warField_mc.width - player_mc.height / 2;
                         player_mc.gotoAndStop(1);
               function hideBlood() {
                    blood_mc.visible=false;
               if (player_mc.hitTestObject(enemy_mc)) {
                    enemy_mc.visible=false;
                    blood_mc.x=enemy_mc.x;
                    blood_mc.y=enemy_mc.y;
                    setTimeout(hideBlood, 1000);
                    points += 100;
                    my_points.text = String(points);
          protected function keyPressHandler(event:KeyboardEvent):void {
               trace(event.keyCode);//in output  you can find number of key;)
               switch (event.keyCode) {
                    case Keyboard.UP :
                         jump=true;
                         player_mc.gotoAndStop(3);
                         break;
                    case Keyboard.LEFT :
                         left=true;
                         player_mc.gotoAndStop(2);
                         break;
                    case Keyboard.RIGHT :
                         right=true;
                         player_mc.gotoAndStop(2);
                         break;
          protected function keyReleaseHandler(event:KeyboardEvent):void {
               switch (event.keyCode) {
                    case Keyboard.UP :
                         jump=false;
                         player_mc.gotoAndStop(1);
                         break;
                    case Keyboard.LEFT :
                         left=false;
                         player_mc.gotoAndStop(1);
                         break;
                    case Keyboard.RIGHT :
                         right=false;
                         player_mc.gotoAndStop(1);
                         break;

you'll need to use a hittestobject to determine if your player is encountering a blue box and needs to change his y property.

Similar Messages

  • How we can remove  one authorization object from multiplt roles

    How we can remove one authorization object from multiplt roles

    > Correct me if I am wrong !!
    O.K., Here I go
    > But if the object is maintained in SU24 and if you use Expert mode for generation of the role then again those objects may be pulled.(make sure you never use expert mode once you delete the objects)
    Actually using expert mode and choosing 'edit old status' is the only way to avoid objects being 'pulled in' after menu changes.
    > As jurjen said, you may download the tables and instead of deleting the object from the excel sheet, change the value of the object in column "DELETED" = X, by doing this only the objects get inactivated(but remain in PFCG).
    I am not speaking of downloading tables but about downloading roles from PFCG. This will not get you a spreadsheet but a flat textfile. If you whish to set the object status to deleted you'll have to swap the space on position 207, right behind the 'U, S, G' flag,  with an 'X' for all corresponding lines.
    Jurjen

  • Why jvm maintains string pool only for string objects why not for other objects?

    why jvm maintains string pool only for string objects why not for other objects? why there is no pool for other objects? what is the specialty of string?

    rp0428 wrote:
    You might be aware of the fact that String is an immutable object, which means string object once created cannot be manipulated or modified. If we are going for such operation then we will be creating a new string out of that operation.
    It's a JVM design-time decision or rather better memory management. In programming it's quite a common case that we will define string with same values multiple times and having a pool to hold these data will be much efficient. Multiple references from program point/ refer to same object/ value.
    Please refer these links
    What is Java String Pool? | JournalDev
    Why String is Immutable in Java ? | Javalobby
    Sorry but you are spreading FALSE information. Also, that first article is WRONG - just as OP was wrong.
    This is NO SUCH THING as a 'string pool' in Java. There is a CONSTANT pool and that pool can include STRING CONSTANTS.
    It has NOTHING to do with immutability - it has to do with CONSTANTS.
    Just because a string is immutable does NOT mean it is a CONSTANT. And just because two strings have the exact same sequence of characters does NOT mean they use values from the constant pool.
    On the other hand class String offers the .intern() method to ensure that there is only one instance of class String for a certain sequence of characters, and the JVM calls it implicitly for literal strings and compile time string concatination results.
    Chapter 3. Lexical Structure
    In that sense the OPs question is valid, although the OP uses wrong wording.
    And the question is: what makes class Strings special so that it offers interning while other basic types don't.
    I don't know the answer.
    But in my opinion this is because of the hybrid nature of strings.
    In Java we have primitive types (int, float, double...) and Object types (Integer, Float, Double).
    The primitive types are consessons to C developers. Without primitive types you could not write simple equiations or comparisons (a = 2+3; if (a==5) ...). [autoboxing has not been there from the beginning...]
    The String class is different, almost something of both. You create String literals as you do with primitives (String a = "aString") and you can concatinate strings with the '+' operator. Nevertheless each string is an object.
    It should be common knowledge that strings should not be compared with '==' but because of the interning functionality this works surprisingly often.
    Since strings are so easy to create and each string is an object the lack ot the interning functionality would cause heavy memory consumption. Just look at your code how often you use the same string literal within your program.
    The memory problem is less important for other object types. Either because you create less equal objects of them or the benefit of pointing to the same object is less (eg. because the memory foot print of the individual objects is almost the same as the memory footpint of the references to it needed anyway).
    These are my personal thoughts.
    Hope this helps.
    bye
    TPD

  • How do I travel to other countries and have my phone still work and not get any surprises in the bill?

    How do I travel to other countries and have my phone still work and not get any surprises in the bill?

    Depends on what you mean by "surprises" in the bill. Verizon's rates for using your phone internationally are pretty expensive, ~$0.99/minute. I would certainly think a 10 minute call for $10 would be surprising!
    Well it would certainly depend on your phone, but if it is a 4G LTE phone, you can simply purchase a prepaid SIM card from the location you are going, switch that with the SIM card currently in your phone and you would be using your phone locally in that location. Of course you would need to notify people needing to contact you of your "temporary" new international phone number. Make sure you keep your Verizon SIM card safe as you would want to switch back to it when returning to the states.
    You can see Verizon's global services information HERE. It includes a trip planner and would be more specific on the prices you would expect to pay if you chose to use Verizon's service rather than a local SIM card from where you are visiting.

  • Newbie question, object stays underneath every other object on the layer?

    I'm trying to create a logo with a glass shine and shadfows. Now there something funny. On one layer an object stays beneath every layer. While doing so in the layers panel the object is placed on top. Tried ctrl_x and then ctrl-f but the object stays below every other object. But in the layer panel its placed on top???
    TIA

    The layer itself is normal 100% opacity. Now the black object stays behind all the other objects...

  • How to make references to other objects

    Hello, I have a project that I need to do and I am not sure how to start it. I need to have a class that has references to four other objects. I have the class, but am unsure how to do the references. would i use extends? like the class name extends the object name? thanks in advance.

    jn3al wrote:
    i marked it as correct because i thought it was funny that he said that. And to the person talking about driving and other stuff i am not like that when someone cuts me off i just laugh and turn the radio up, I do not cut anyone off and if i do on accident i wave my hand to say thanks. I am not that type of personYour massive overreaction here suggests otherwise.
    i just wanted help without having to read because i read those java things all the time and sometimes i dont understand what it is saying.So you expected someone here to read your mind and know what you read, what you didn't understand, and why you didn't understand it, and to then offer a different explanation? Yeah, that sounds way better than the usual approach of "I read such-and-such, and it said, 'X', but I don't understand what they mean by 'X'. Can you clarify it?" Your mind-reading approach cuts through that annoying communication BS. I like it.
    Im sure this is the simplest thing but for some reason i couldnt think what to do. Ive read posts on here were people ask easier things than that and they get help and not directed to a tutorial.I doubt you've seen enough threads here to have a statistically valid sample. Almost always, if the answer is in a tutorial, the OP will be directed there. There's no reason to repeat what's already been said.
    Not to mention the fact that your question makes no sense whatsoever.
    w/e im going to ask my teacher who helped make java, smarter than anyone here. Odd that you didn't ask him/her in the first place then. And where did you get hold of our IQ test results?

  • How to analyse impact to other objects?

    Hi Friends,
    Suppose i will change any object sometimes definitely that changes impact on other relating objects. Am i right? then my requirement is i have changed one object,now first of all how to find relating objects and then how to analyse impact of those changes.
    Ex: Changes in infoobject that impact on other objects are Cubes, ODS, reports and rules etc.
    Please guide me in this regard <removed by moderator>.
    Thanks,
    Ramki
    Edited by: Siegfried Szameitat on Dec 1, 2008 12:31 PM

    If your upcoming changes will affect any of the compounded objects then rest assured that the concerned InfoObjects shouldn't contain any data otherwise your infoobjects will be unstable and would be throwing error after activation...
    as far as the related objects are concerned then just remember the thumb rule(extended star schema):
    All the objects in BW are related to each other by a key: Fact table is linked to Dim tab by Dim ID,,Dim Tables linked to SID tables by Surrogate ID(SID) and this SID points to Master data tables(Text, attr and Hier)
    So going from Fact table to Master data table, if you make any changes in fact table (including or excluding Key figures) or in Dim table (including/excuding Characteristics) then you have to activate your master data so  that SIDs will be generated and vice-versa
    Edited by: Alok Kashyap on Dec 1, 2008 12:46 PM

  • No object can select when collecting objects for transport

    Hi.Experts:
        When I use RSA1 and want to collect objects for transport,I found that no objects can be found for some object type,such as ISTD/TRFN etc, any body who know this situation?
    Best Regards
    Martin Xie

    Hi Martin,
    best way to collect objects into transport request is throught RSA1 -> Transport connection.
    in Transport connection, you have different options to collect objects into transport request.
    In data flow before...
    here you can see objects that are already have transport request, package...
    Regards
    Daya Sagar

  • How to copy cubes and other objects?

    Hello All,
    I have implemented APO -Demand Planning Project for one hub Europe in our BW system.NOw we want to roll out the implementation globally and want to copy all the BI objects for seven hubs only changing the field of hub whereever we are using it in routines.
    One way of copying all the objects is XML export and import.But for that purpsoe i have to change the XML file maually.We have four cubes , ten ODSs and number of reports and lots of user exit code.Data in ODSs are coming from flat files and it is further updating Cubes.
    Anybody knows here any other way to copy the cubes and ODSs and other related objects such as infosources and infopackages etc.
    Thanks and Regards
    Yogesh Mali

    You need to change the format
    double tap on the work and then you can select how much you want to copy, to paste just long press on any empty space > paste
    Navigation does work, but you must make a map offline (open maps > select the area/city > menu > offline) 
    Don't forget to give Kudos (Click on the half star + )
    "I'd rather be hated for who I am, than loved for who I am not." Kurt Cobain (1967-1994)

  • Modification of an object deactivates transformations of other objects

    Dear Gurus,
    I have the following issue:
    I want to modify an object, eg. GFIFISPER. There is only one transformation related to this object: RSDS DS_GFIFISPER_ATTR BWFLATFILE -> IOBJ GFIFISPER.
    However, when I modify and activate GFIFISPER, not only this one transformation gets inactive, but also all transformations related to objects in which GFIFISPER is an atrribute.
    This happens not only for GFIFISPER but also for all other InfoObjects in this box (server).
    It didn't happen earlier and also in other boxes (like a sandbox) it doesn't happen (only transformations related to the changed object get inactive). Are these any particular settings of the box which were changed in the meantime? What can I do to prevent all these transformation from deactivating?
    Thanks in advance,
    Peter.

    Hi,
    Instant Solution to make active all other  transformations is RSDG_TRFN_ACTIVATE and RS_TRANSTRU_ACTIVATE_ALL
    I am still looking on How to prevent this situation.....?
    Regards,
    Suman

  • How can I put 1 object in a photo in color but the rest in black and white?

    I have iPhoto '08, and I have seen many photos that have interesting effects like the one I mentioned before. I would really like to know how I can allow the main object in the photo to remain its natural color, but change the rest of the picture to black/white or sepia.

    Welcome to the Apple Discussions. You mean like this?
    Click to view full size
    This was created by Photoshop. But it's a little over the top for must of what we want to do. Photoshop Elements can do the same as can some of Larry's other suggestions. I've worked with PSE and it's an excellent editor with about 75% of PS's capabilities at about 1/7 the price.
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto (iPhoto.Library for iPhoto 5 and earlier versions) database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    I've created an Automator workflow application (requires Tiger or later), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. There are versions that are compatible with iPhoto 5, 6, 7 and 8 libraries and Tiger and Leopard. Just put the application in the Dock and click on it whenever you want to backup the dB file. iPhoto does not have to be closed to run the application, just idle. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.
    NOTE: The new rebuild option in iPhoto 09 (v. 8.0.2), Rebuild the iPhoto Library Database from automatic backup" makes this tip obsolete.

  • How I can  enumerate objects in temporary store?

    TEMP_IN_USE_SIZE is constantly increased in my application. How i can get information about objects in temporary storage?

    Hi Vladimir,
    I am not sure wherher you will be able to see actual objects occupying the temporary memoray usage as most of these will belong to internal TT operations when queries use SORTING such as having, group by, order by clauses etc.
    However, I guess there is one or two applications that in your case do excessive use of temporary memory space. You can check the temporary memory that a query uses by observing the high water mark for temporary memory usage. The high water mark represents the largest amount of in-use temporary space used since the high water mark was initialized or reset.
    For example if you can get hold of query then you can do
    1) use dssize command to check TEMP_IN_USE_SIZE and TEMP_IN_USE_HIGH_WATER
    Command> dssize
    PERM_ALLOCATED_SIZE: 1048576
    PERM_IN_USE_SIZE: 284072
    PERM_IN_USE_HIGH_WATER: 284072
    TEMP_ALLOCATED_SIZE: 524288
    TEMP_IN_USE_SIZE: 19447
    TEMP_IN_USE_HIGH_WATER: 21543
    2) Call the ttMonitorHighWaterReset procedure to reset the TEMP_IN_USE_HIGH_WATER to the current value for TEMP_IN_USE_SIZE.
    Command> call ttMonitorHighWaterReset;
    Command> dssize
    PERM_ALLOCATED_SIZE: 1048576
    PERM_IN_USE_SIZE: 284072
    PERM_IN_USE_HIGH_WATER: 284072
    TEMP_ALLOCATED_SIZE: 524288
    TEMP_IN_USE_SIZE: 19447
    TEMP_IN_USE_HIGH_WATER: 19447
    3) Run your query or the query that is suspected of causing the problem. I guess you need to get the code from developers or through a cronjob running ttXactAdmin <DSN> in regular interval to nidentify what transactions are long running. SAy a code like below with group by, having and order by!
    Command> select cust_id "Customer ID",
    > count(amount_sold) "Number of orders",
    > sum(amount_sold) "Total customer's amount",
    > avg(amount_sold) "Average order"
    > from sales
    > group by cust_id
    > having sum(amount_sold) > 94000
    > order by 3 desc;
    9 rows found.
    4) Use dssize to check TEMP_IN_USE_HIGH_WATER for peak memory usage for the query.
    Command> dssize
    PERM_ALLOCATED_SIZE: 1048576
    PERM_IN_USE_SIZE: 284072
    PERM_IN_USE_HIGH_WATER: 284072
    TEMP_ALLOCATED_SIZE: 524288
    TEMP_IN_USE_SIZE: 19447
    TEMP_IN_USE_HIGH_WATER: 20199
    HTH,
    Mich

  • How to recover a state of  one objects threads by other object

    hi everyone
    how to recover a state of one object's threads by other object..
    i am creating a object in that i have 10 thread..... i have started it then i have closed that object ...then i am creating a new object for the same class ...i need to stop those thread which i have started earlier

    saiyath_babuhussain wrote:
    hi everyone
    how to recover a state of one object's threads by other object..Objects don't own threads so that's hard to understand
    >
    i am creating a object in that i have 10 thread..... i have started it then i have closed that object ...then i am creating a new object for the same class ...i need to stop those thread which i have started earlierWe don't so much stop threads as inform them politely that their services are no longer required. When you have a long running thread it's almost always a loop, often with a wait or sleep which causes it to wait until it's activitty is needed.
    So if you want to be able to wind up a thread from another thread then you put a boolean flag in which can break the loop. The other thread then changes that flag and calls interupt() on the thread it's trying to stop. Interupt will kick the thread out of wait or sleep if that's where it is, causing an InterruptedException. On discovering that the flag indicates it should stop, or on catching an InterruptedException the thread should then clean up and finish.
    The master thread can call join on the thread it's stopping if it needs to wait for it to terminate.

  • How to refer to other objects?

    Greetings,
    I'm not sure how objects should refer to other objects.
    Example:
    Class Automobile needs to refer to objects from other classes, namely to tires, color, motor and company.
    So, the way I would do this in C++ or VB is to store all tire, color, motor and company objects into arrays and then store Integer ids in class automobile refering to the index. Like
    tiresId
    colorId
    motorId
    companyId
    So if I would like to know the name of the company of this automobile, I would have to do the following:
    company(automobile.getCompanyId).name
    I'm not sure however if this is the right OOP-Way of doing it. Should I rather put object references into class automobile instead so that I would only have to
    automobile.getCompany ?
    The problem I have with this solution is that I have to read and store the automobile data into files and while it's pretty easy to store an integer-id I'm not sure on how to store object references. They are a little "obscure" to me on this point.
    Thanks in advance for any advice.

    if you just want to save the type of company, color and so on for every automobile, i think integer ID is a good way,
    similar to the existing Color-class with constants:
    Color.BLACK, Color.RED, ..
    the way with references would also work, then all referenced objects will be saved too,

  • Is there inbuild Handler in weblogic using which i can get the MessageContext object

    HI,
    I need MessageContext object in my application but i dont want to use the Handler,As
    there is AxisEngine in axis soap engine,is there any similar implementation in
    weblogic.
    AxisEngine.getCurrentMessageContext() we can get the MessageContext what about
    in weblogic..any body any idea???
    Regards,
    Akhil Nagpal

    HI,
    yeah i had to make use of Handler to get the MessageContext object and play with
    that.
    Thanks & Regards
    Akhil Nagpal
    "manoj cheenath" <[email protected]> wrote:
    You can get to MessageContext from a handler. Check out an example of
    handler
    to see how you can get Message out of MessageContext.
    -manoj
    "Akhil Nagpal" <[email protected]> wrote in message
    news:[email protected]..
    HI manoj,
    Thanks for your reply.otherwise i thought that i wont get any morehelp
    on this
    forum :-) ...
    anyway its good that we will have such thing in next version,duringthe
    development
    i feel that more functioanlity should be in build in appserver. Likeone
    more
    thing i could not find out is how we can get the "message" object inweblogic
    like we can in axis using its MessageContext class's static method.if it
    is there
    can you please let me knwo about that.
    The other problem i had to make use of handler and my appl is workingas of
    now :-)
    Regards
    Akhil Nagpal
    "manoj cheenath" <[email protected]> wrote:
    You can not do this in WLS 7.0. The next major release (WLS 8.1) will
    fix
    this problem.
    -manoj
    "Akhil Nagpal" <[email protected]> wrote in message
    news:[email protected]..
    HI,
    I need MessageContext object in my application but i dont want
    to
    use
    the Handler,As
    there is AxisEngine in axis soap engine,is there any similarimplementation in
    weblogic.
    AxisEngine.getCurrentMessageContext() we can get the MessageContextwhat
    about
    in weblogic..any body any idea???
    Regards,
    Akhil Nagpal

Maybe you are looking for

  • Post freight cost in diff. G/L of the material cost Accnt Cat. E

    Hi MM experts, I created a PO in reference to Sales Order (account assignment E-Trading materials) In condition I added a custom condizion for freight (SPRO Cond.category B, flag on accruals). When I received material the freight cost was added in to

  • Checking Frequency of a record

    I have a table that has information about customer payments per day. Now I want to extract the information on which clients made a payment everyday, for the past month. I have an oracle 11g Database. Edited by: user12184158 on Jul 26, 2012 2:07 AM

  • Questions about the Clusterware

    Please confirm my following understandings 1.Prior to 11gr2 ,asm (in 10gr1,10gr2,11gr1) a.included in database software only b.must be installed as oracle c.will have separate ASM_HOME 2.From 11gr2 on wards ,asm a.Packed in grid infrastructure softwa

  • I synced my iPhone and lost purchased songs

    I synchronized my iPhone yesterday and realized that recently downloaded song disappeared after the sync. 

  • Fan runs at full speed - no other issues

    Can't see a subject that has come up in search in the last year that addresses this, so here goes: I've had a 15" MBP Retina for a month or so.   Never heard a peep of noise from it (so much so I'd even wondered if it had a fan !) Tonight, out of now