How do I make a sprite jump

Hi everyone,
I recently made a program that can move a sprite around but not jump. It seems that im lost on the logic behind writting a jump. My goal for the sprite is to make it jump off the ground and comback to it. However, my loop just stays still when i use the space bar to jump. I have tried 2 differnt ways.
FIRST:
KeyEvent.VK_SPACE){
            //then jump
            guy_y= 250;
            while(guy_y < 400)
                   guy_y++;
        }SECOND:
for(guy_y = guy_y - 20; guy_y < 400; guy++)
     guy >= 400;
}please help me.

      Allow me to explain in greater detail. First let me start by apologizing for any confusion that I have caused. Ok, moving on, my sprite is standing on 400 so my goal is for when i press the jump button he will go up 20 pixels. in that case he would be at 400 - 20 pixels. then go down in increments of 1 or what have you. I hope that levities any confusion that i may have caused.
As for morgalr i believe that the code does tell it to go back to the ground being 400 that is why told it that :
if(guy_y < 400){      //  If your less than 400 on the y scale
                guy_y++; //  Then add plus one till you are not less than 400
            }

Similar Messages

  • How do I make track end jump go to menu and highlight next button.

    I have a DVD with several programmes each with its own menu button, with track (button) one as the highlighted default. I would like the end jump of each programme to be back to the menu (easy) BUT with the button for the next track highlighted. How do I do that.

    Click on the Track your want to jump from - then in the properties panel select "End Jump". A pop out menu will appear giving you the choice of where to go. Select the Menu you want and choose the Button you want to land on in the list.

  • I am frustrated with how my cursor jumps around while typing.  How can I make the arrow follow the cursor so this doesn't happen?

    Macbook Pro with OSX Yosemite:  I am frustrated that when using Word for Mac, the cursor keeps jumping around all over the page.  How can I make the pointer follow the cursor so this stops?

    Start Firefox in [[Safe Mode]] to check if one of the add-ons is causing the problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    * Don't make any changes on the Safe mode start window.
    See:
    * [[Troubleshooting extensions and themes]]

  • How can I make the spry accordion remember the panel open when I refresh the page or jump to a new page?

    How can I make the spry accordion remember the panel open
    when I refresh the page or jump to a new page?
    I am using the accordion feature on all my pages as a
    navigation aid. It has three panels. When you refresh the page the
    panel goes back to the default pane... Is there a way of
    controlling this so that the browser can remember the pane that is
    open (say set a variable, cookie, other?)

    Look for "Set the default open panel" on the following page:
    http://labs.adobe.com/technologies/spry/articles/accordion_overview/index.html
    Keep in mind you would need to change that bit of code on
    every page. The only way to do it more dynamically would be to
    include a custom javascript or PHP/ASP style script in order to
    change the value.

  • HT4623 I upgraded to the iOS 7 and now I have a moving blue box jumping around my screen that I can't get rid of. How do I make it go away?

    I upgraded to iOS 7 and now I have a moving blue box jumping all over my screen. How do I make it go away?

    Settings>General>Accessibility>Switches>Switch Source
    Turn it off!

  • How can I make multiple quizzes within one Captivate project?

    Hi guys! Really liking Captivate 5.5, especially the way random question slides can lift questions out of a question pool...very elegant!
    Sadly though, I've come up against a bit of a wall. In my project, I want to have 3 separate quizzes that all use the same question pool; a 10, 30 and 50 question-long quiz. Each one needs to have its own results page.
    It's easy enough to see what I mean by looking at the screenshot below:
    The idea was to have about 105 slides in total, with slides 10 - 20 being the 10 quiz slide, 21 - 51 being the 30 question quiz and 52 - 102 being the 50 question quiz.
    There are three invisible buttons placed over those 10, 30, 50 text boxes. In the picture, the '10 question' button would jump to slide 10, the '30 question' button would jump to slide 21, and the '50 question' button would jump to slide 52, jumping the user to the start of their designated tests.
    Though I can create the 10 random question "block" easy enough, when it comes to adding the 30 question "block" it just adds the new random questions to the existing random questions. I want three separate quizzes, each with their own results screens please. (I don't want to daisy-chain to external projects, because the results of each test need to be used within the homepage.)
    It just adds them on to the existing block!! Argh!!
    Little bit ticked off with Adobe...the reason their products are so incredible is because they put no constraints on the user, and you can use their tools to create things even the developers never dreamed of. Like in Photoshop for example, I bet when the dropshadow fx was created, the developers never realised that it would be used to give a metallic 'stamped' look to text by turning it to white and applying it just inside the text.
    Captivate, though amazing most of the time, has a nasty habit of stomping on my toes. You can't set grade boundaries and have quizzes give out grades A+ to F- for example. You can only have 'pass' and 'fail', thus making it rather pointless for use in schools, contrary to how the program is advertised. Another example would be when I wanted to create a replay button. I thought that a button that jumped to the slide it was on would be a simple, no-BS replay button, but for some reason you can't make a button jump to its current slide. I downloaded a widget that worked in the end, but I wish Adobe would get off my back and let me do what I want!
    Anyway, if you could help me out here it would be grand

    I must say I have a little sympathy for the Captivate developers on this occasion.  As you say, they've created an application that does so much, that when you eventually run into a hard boundary of some kind, the effect is somewhat jarring.  However, every application, no matter how good, has limits.  I'm probably one of the worst offenders when it comes to asking the Adobe Captivate Development Team for enhancements (I think I've logged over 70 enhancement requests for Captivate 6 alone).
    In your case, you want to have three different quizzes in one project file, each with it's own separate Quiz Results page.  Lilybiri's blog explains how to set up your own faux Quiz Results pages using system variables and custom user variables, but you're going to find this to be quite a lot of trouble.  Even if YOU want to consider these as three separate quizzes, as far as Captivate is concerned they're just one big quiz with 50 questions.  So Captivate will calculate it's internal results based on a 50 question quiz, even if your users select the 10 question version.  So achieving a final Pass/Fail result is going to be problematic at best.
    As Lilybiri suggested, your better strategy would be to break this up into separate modules so that you can get your three separate quiz results (all done in standard Captivate) as well as correct results based on the actual number of questions done by the user.
    As far as grades A-F is concerned, there's nothing to stop you from using Advanced Actions and User Variables to calculate the user's score as a grade.  You need a user variable that stores the user's grade (e.g. var_Grade). And you need a fairly complex Conditional Advanced Action (e.g. caa_CalculateGrade) with several clauses each of which goes something like:
    If
    cpQuizInfoPointsscored is lesser or equal to [highest score for a particular grade]
    AND
    greater or equal to [lowest score for a particular grade]
    Actions
    Assign var_Grade with [the appropriate grade for that range of scores]
    Your conditional action will need one of these clauses for each separate grade.  Once your variable has been assigned a grade based on the user's score, you can display it in a text caption somewhere on the quiz results page or on a slide thereafter with suitable commendations/ commiserations.

  • How can I make a line at 40 degree angle in Keynote 6

    How can you make a line of 40 degrees (or anywhere between 40 to 45) angle in the new Keynote 6.2.2. It seems they took away that nice feature from the previous version. When I move one end of a line, it locks onto 45 when I get near that angle, and jumps off directly to 34 when I try to move away. Previously you could click on a line to transform the ends into red spots, and move them independently to any angle or length. Now it locks onto 45, or 135 or 90 etc. I don't have any of the guides on or any other feature. This is supposed to happen only when holding shift key (which is also a great feature). If it locks onto the magic angles without holding shift, then there is no sense if having that feature at all.

    Press the command key when dragging, this switches off snapping and allows continuous placement.
    If you like numerical control:     Inspector > Format > Arrange > Rotate

  • How to intersect with any sprite of a certain cast member?

    Hi. I am trying to script a simple 2d platformer engine for a larger University project. I have movement sorted with W and A and gravity. I can get collision detection with the floor by doing
    if sprite 1 intersects sprite 2 then
         gvGrav = 0
    end if
    Sprite 1 is the player and sprite 2 is an instance of the cast member called ground. How would I get this to work with any sprite that is ground? Ill paste the full code below.
    global gvRight
    global gvLeft
    global gvGrav
    global gvDown
    on enterFrame
      -----------MOVE LEFT---------------------
      if keyPressed("a") then
        sprite(4).locH=sprite(4).locH+gvLeft
        _movie.updateStage()
        gvLeft = gvLeft - .5
        if gvLeft < - 15 then
          gvLeft = -15
        end if
      end if
      if not keypressed("a") then
        gvLeft = 0
      end if
      -----------MOVE RIGHT--------------------
      if keyPressed("d") then
        sprite(4).locH=sprite(4).locH+gvRight
        _movie.updateStage()
        gvRight = gvRight + .5
        if gvRight > 15 then
          gvRight = 15
        end if
      end if
      if not keypressed("d") then
        gvRight = 0
      end if 
      -----------GRAVITY-------------------------
      gvGrav = gvGrav
      sprite(4).locV=sprite(4).locV+gvGrav
      _movie.updateStage()
      gvGrav = gvGrav +.5
      if gvGrav > 30 then
        gvGrav = 30
      end if
      -------------GravityCollision----------------------
      if sprite 4 intersects sprite 1 then
        gvGrav = 0
      end if
      if sprite 4 intersects sprite 2 then
        gvGrav = 0
      end if
    end if

    I dare say there's a better way to do this, but an easy way is to set a global variable, do a sendallsprites message, and check the global variable again.
    So, if you had an extra global in your man control script:
    global hitman
    then in your collision checking part you would say this:
      hitman = false
      sendallsprites #checkcollision 4
      if hitman = true then
        gvGrav = 0
      end if
    The #checkcollision message would get sent to all sprites, and if you had a behavior placed on the floor sprites, that was like this:
    global hitman
    property mysprite
    on beginsprite me
      mysprite = the spritenum of me
    end
    on checkcollision me,s
      if sprite s intersects sprite mysprite then
        hitman = true
      end if
    end
    any one of those sprites that intersected with the sprite you ask about would then change the global 'hit man' variable to be true. To make a sprite behave like floor, you would just attach that behavior script.
    Notice how the floor sprite makes a note of its sprite number when it first shows up on the stage, you could do the same with your other script, if it's attached to the man character. Then you wouldn't have to have it hard coded to '4', which would save some headaches later if you have to change the sprite layers.

  • How do I make the video higher quality?

    How do I make dvd's with a higher quality?  I have a Sony AVCHD Camcorder.  I used to use a Macbook Pro and iMovie and iDVD to make DVDs and I could choose to make them a higher quality.  The problem was that it would literally take DAYS to get them done.  I switched to Final Cut, which is quicker, but I can't seem to make the DVDs a higher quality and they are very fuzzy compared to what I used to make.
    My husband assures me that the pros in Hollywood use Final Cut Pro to edit video, so it must be possible to make these a better quality.

    If you still have a copy of iDVD:
    Export from FCP X As a Master File and use the export in iDVD the same way as you did with iMovie.
    Bear in mind all DVD discs will only ever be SD Quality and not HD.
    Better quality requires a jump to Bluray.
    FCP X can burn direct to Bluray if you have the gear.
    Al

  • How do I make transitions between clips smooth?

    how do I make transitions between clips smooth?  Right now, when I play my video in imovie, the clips freeze or jump between clips. 

    Have you tried sharing the final movie using the Share menu, or, alternatively use FILE/FINALIZE PROJECT?
    The final product shouldn't have any lag. iMovie itself should not have any lag, but could depending on your Memory and hard disk configuration.

  • How can I make this shape?

    How can I make this shape in fireworks:
    I want some images in my website to have rounded corners. Im doing this by adding 4 divs with background images and absolutely positioning them, one over each corner of the image. The background images are PNGs with transparent areas. This works as the site's background is a solid color, so the rounded corners dont need to actually be transparent.
    The issue im having is that the pixels on the curve need to be semi transparent. Id love to make this shape as a vector but I dont know how.
    Thanks

    Hi,
    There is another simple way to get the shape desired. Create a rounded rectangle that is twice your corner size - both width and height wise. Now adjust the rounded corners to almost make a circle (pull the yellow corner handle towards the center of the side). Now click the corner and you will be able to toggle between the different corner types. You can now either use the shape as it is (if you need it for corners of a sprite rounded rectangle) or you can cut it up to get the desired wedge.
    - Anita

  • How do you resize just one layer & how do I make this layer not blur when enlarged?

    I am trying to drop a video game sprite into a much larger image and I wish to make the sprite bigger.  Every time I use CTRL + T  just to size the layer by dragging the mouse, once I hit the check mark it blurs the image instead of keeping it looking pixelated.  How do I avoid this?  (Using Elements 7)

    The following should help.
    1. Open your sprite and instead of transform (defaults to bicubic hence the blurring)
        use Image>Resize>Image Size set to resample-constain proportions-nearest neighbor)
        You will have to resize the sprite before you copy and paste (move) into the bigger image.
        The only hard part is setting the right size.
    2. After you resize then copy to your bigger image.
    Hope this helps.
    MTSTUNER

  • How do I make a "Character Select" system?

    I'm making a game for school that is a vertical scrolling shooter (like the Raiden series), based off of the anime Galaxy Angel. For anyone who has seen GA would know there's 5 main characters, all of which I have put in my game. My program is an application (so swing answers only please), and made up of 4 classes: Title Page, Character Select, Main Game, and Credits. I intend to make my program load different Player sprites depending on what character is chosen. Can someone tell me how I can make my Main Game class read which character has been chosen from my Character Select class?

    A very quick and easy way of doing this with Swing is using the JRadioButton class. The following suggestion is similar to a technique used in "How to use Radio Buttons".
    http://java.sun.com/docs/books/tutorial/uiswing/components/button.html#radiobutton
    Inside CharSel class:
    First, declare a class String variable called "userIcon" or something at the top of your program. This will be the path of the icon for your user.
    private static String userIcon=null;When you're setting up the GUI for your CharSel screen, use an array of JRadioButtons for the character buttons. In the for loop where you initialize each button, group them all, and set up the basics (ie: stylize the button to make it feel more like a game), add something like this:
    buttons.addActionListener(this); //assuming you've implemented ActionListener
    buttons[i].setActionCommand("images/charIcon"+i+".gif");
    The i variable is just an int; the current index of your radio button array in your for loop. An action command is simply a String passed to the ActionEvent of your ActionListener.
    You would then add something like the following so you can retrieve the icon's path from other classes:
    public static void setUserIconPath(String s) { this.userIcon = userIcon; }
    public static String getUserIconPath() { return userIcon; }
    //called when a radio button is pressed
    public void actionPerformed(ActionEvent e) {
      //retrieve the action command
      setUserIconPath(e.getActionCommand());
    }When you are writing your actual game classes, you'll create the user image using the static methods:
    ImageIcon portrait = new ImageIcon(CharSel.getUserIconPath());If you wish to avoid the static methods (which may cause problems depending on how you use them), you can set the constructor of your MainGame class to accept the icon's path (or just the ImageIcon itself).
    Alternately, you could simply call a method passing the path/imageicon [i]after you initialize your MainGame class.
    Other techniques may include constant ints and a switch statement (which checks something like CharSel.selectedIcon() == CharSel.BOB). Of course, a more typesafe way of doing that would be to use enums. If you did use enums, you could even include methods for your enum constants (ie: CharSel.Chars.BOB.getImageIcon() may return Bob's ImageIcon).
    Good luck!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How do i make psd files transparent?

    How do i make psd images transparent when I drag and drop the layer onto the stage on flash cs6?
    For  example the way iv been doing it up until now was saving as a psd then  going to file import to library on flash. This is very very time  consuming and would be much easyer if i can just drag and drop the  photoshop layer onto the stage, but the problem is that the image gets a  white box around it and isn't transparent when i do that.
    Is there an option in photoshop or flash to fix this and make the background trasnparent?

    Reminds me of Yoshi from Mario Bros
    I know what you'd like to do but as the first reply mentioned, you can't do that. Until Photoshop is updated to copy with transparency intact to the Windows clipboard, you won't be able to do that. The reason I linked and showed a screenshot of the software GIMP is to prove that it's a Photoshop limitation, not a limitation of Flash or the Windows clipboard.
    Knowing that fact, there is no way for you to copy/paste drag/drop from Photoshop directly into Flash.
    Cartoon animating is essentially identical to how most games work. You create one large master image that contains all the possible variations of your subject (a face, a car, etc) and import that into a game. You do the same when animating, only you're keeping them all separate instead of one image.
    Knowing your experience with Flash is small and growing, I'm not going to make the most optimal recommendation. I'll stick to 2 things I mentioned before but elaborate on them.
    1) Save your assets to actual PNGs with transparency, then import into Flash.
    The reason I'd recommend this the most is because of Flash's update function (which I will explain) and it can be automated a bit (also will be explained).
    So I grabbed a Yoshi sprite sheet and say I made a new pose as you mentioned. In Photoshop I'd then select and copy this new pose alone, with transparency:
    As you know, once you do that you can bring up a 'New Image' dialog and it will already have the size of your copied pixels (with trimmed transparency):
    You can see the size is correct and the preset is clipboard. After that you just paste your new image in and turn off the background to gain transparency. Then you save it out as a separate file. I always use Save For Web for a pinch of file size optimization and overall control:
    Again, I realize this is a lot more than you want to do, but all of this can be automated which will be explained after making it virtually a single button push operation.
    Now we have the image as a separate new PNG image with transparency intact. This image should be imported into Flash's library:
    Now you both have a physical separate copy of this pose in a PNG file (which can be useful for many reasons) and Flash can use that file with it's built in update command for very quick changes.
    Now say you touch up a pose a bit. I'll make it really obvious and change the entire hue. You make your changes in Photoshop, follow the same process (even making size changes to the original image), eventually overwriting the PNG you created for that pose:
    Now in Flash, all you need to do is use the Update function. Right-click on the image in your library, select Update. Because this is a file with a physical location, that is all that is needed to change the image in Flash:
    The power in this is if you make sweeping changes to dozens or hundreds of PNGs, you can do this in one command in Flash. Select all the changed images and hit Update and all your changes will be done at once. You can't do things like this when you copy and paste directly into Flash.
    That said, almost all of the steps above can be automated using Photoshops Actions panel. No need to reinvent the wheel, Actions are fully explained here:
    http://help.adobe.com/en_US/photoshop/cs/using/WSfd1234e1c4b69f30ea53e41001031ab64-7448a.h tml
    I would recommend recording the action after you make your marquee selection around what you want to save as a PNG. Record right up to Save For Web and stop there. Then in the future you press the hotkey you assign and it will extract your selection, open a new document, paste it in, disable the background for transparency and bring you to the dialog you can name the image in. That's pretty easy and automated. Then just import into Flash and enjoy the benefits.
    2) Use Photoshop to create the assets, then a different program to copy/paste into Flash
    Not ideal to need 2 programs, however if you really want to copy and paste directly into Flash, this is the way to go. Get any program that can read the PSD file format, open your PSD in it. If you have enough RAM this really shouldn't be an issue (PS and GIMP side by side, same file open):
    As you make changes to the PSD, just hit reload or revert in your "copy with transparency" supporting program, copy what you need, paste into Flash:
    I'll explain some of the advantages of the previous workflow if you'd like but I think this is enough information overload for now.

  • How do you make movieclips return to frame one when mouse no longer over a button?

    If you like, please see the attached file. I have an instance of a movie clip on the stage that jumps to different labels (within the movieclip) when the large buttons at the top of the scene are in rollover state. The problem is that it stays there when the mouse leaves the button.
    How do I make that symbol go back to frame one (not there) within the movie clip so that it disappears when there is no activity on the buttons?
    Is there a button parameter like MOUSE_OFF (I know that's not one)?
    Thanks, Dan

    use a MouseEvent.MOUSE_OUT listener.

Maybe you are looking for