Please help beginner! Few pong questions.

So, I have just started creating my own pong game after
learning the basics of Flash 8. Everything went perfectly until
now, I got a bit stuck.
I got to point where I have fully working menu, multiplayer
and singleplayer, you can play against another person using mouse
and arrows. The scoring system works too and I actually managed to
get the computer to follow the ball but here comes the first
problem. I found a whole actionscript for the ball on the internet
here it is:
onClipEvent(load){
s = {l:10,r:490,t:20,b:405,w:10,h:10};
function setSpeed(){
xspeed = Math.round(Math.random()*5)+1;
yspeed = Math.round(Math.random()*5)+1;
xspeed *= Math.round(Math.random()*2)==1 ? -1 : 1;
yspeed *= Math.round(Math.random()*2)==1 ? -1 : 1;
setSpeed();
_root.cscore = _root.pscore = 0;
onClipEvent(enterFrame){
_x += xspeed;
_y += yspeed;
if(_x+(s.w/2)+xspeed>s.r){
_x = s.r/2;
_y = s.b/2;
setSpeed();
_root.cscore += 1;
if(_x-(s.w/2)+xspeed<s.l){
_x = s.r/2;
_y = s.b/2;
setSpeed();
_root.pscore += 1;
if(_y+(s.h/2)+yspeed>s.b){
_y = s.b-(s.h/2);
yspeed *= -1;
if(_y-(s.h/2)+yspeed<s.t){
_y = s.t+(s.h/2);
yspeed *= -1;
if(this.hitTest(_root.player)){
_x = _root.player._x - _root.player._width/2;
xspeed *= -1;
xspeed *= 1.08;
yspeed *= 1.08;
if(this.hitTest(_root.computer)){
_x = _root.computer._x + _root.computer._width/2;
xspeed *= -1;
xspeed *= 1.08;
yspeed *= 1.08;
As I said I am a beginner and I dont really understand the
code. The problem is that after every hit the ball gets faster and
faster and faster until it is impossible to see it.
Here comes another problem: I have got the enemy just
following the ball so it is impossible to score the script for
enemy is:
onClipEvent(enterFrame){
ydist = _root.ball._y - _y;
_y = _root.ball._y;
Now my question is can someone plese tell me what do I have
to change in the ball code so it stays at the constant speed or it
just increases a little bit. The second qustion is how can I make
the enemy computer not perfect? So you can actually win the game?
Something like hit it randomly.
My last question is: The game should be quiz pong. So if you
score a point a qustion will pop up and you will have to answer it.
What is the best way to do that? I think it should mean somethin
like this: If score=+1 gotoandplay(lets say the question will be at
frame 20) I dont know if that is the way it should be formed in the
action script it is just my guess.
Please if someone can help me at least with one of those
questions I would be incredibly oblidged. thanks

hey, im not great at this easier, but i think the speed
problem can be solved by getting rid of the 2 lines
xspeed *= 1.08;
yspeed *= 1.08;
I think this increases the speed by 8% after every hit. You
can also try lowering the number, but if you go elow 1 it will slow
down.

Similar Messages

  • Please help me with this questions "if I purchased items through mac or windows is it possible to re-download those purchases on Apple TV though iCloud"

    Please help me with this questions "if I purchased items through mac or windows is it possible to re-download those purchases on Apple TV though iCloud"

    It depends on what country you're in and whether or not they're still available in the iTunes Store. Some purchased movies and all rentals won't be available.
    (108225)

  • A few of my built in apps disappeared and I want them back, please help, a few of my built in apps disappeared and I want them back, please help

    a few of my built in apps disappeared and I want them back, please help, a few of my built in apps disappeared and I want them back, please help.  It just happened and I didn't do anything. 
    The camera app
    the I-tunes store
    the App Store
    and Safari all vanished. 

    Check Settings>General>Restrictions to be sure Camera, Safari and Installing Apps are set to On.  If they are check all your screens and inside all your folders.  If you still can't find it go to Settings>General>Reset>Reset Home Screen Layout.  This will restore the home screen to its original configuration but may move other apps around to do so.

  • Please help  me with some questions with batch input session?

    hello everyone.
      I come to some questions  like
    1 What is a batch input session ,
    2  What is the alternative to batch input session?
    3  An ABAP program creates a batch input session.   We need to submit the program and the batch session in back ground. How to do it? 
       would you please help me with the questions, couldn't thank you more.
       Best regards
                                                                          Frank

    Hi
    Batch Input Session:
    BATCH INPUT SESSION is an intermediate step between internal table
    and database table. Data along with the action is stored in session
    ie data for screen fields, to which screen it is passed, program
    name behind it, and how next screen is processed.
    Three processing modes of executing Batch Input Session :-
    Run Visibly : You can correct faulty transactions online & work step-by-step through  the transactions not yet executed.
    Display Errors only : You can correct faulty transactions online.   Transactions not yet executed, but without error, run in the background.
    Run in Background .
    2) What is the alternative to batch input session?
    Call transaction.
    3) An ABAP program creates a batch input session. We need to submit the program and the batch session in back ground. How to do it?
    go to SM36 and create background job by giving
         job name,job class and job steps (JOB SCHEDULING)

  • PLEASE HELP, I have 3 questions...

    Okay, so I just bought my 30GB Ipod and have a few nube questions.
    1. How can I scan the ipod for viruses?
    2. Is it normal that with no music on the ipod it says i have something like 28 or 27 gigs available? Is this space just used up by games and other applications that come previously installed?
    3. For albums that are loaded onto the ipod I have assigned them album art, these are displayed when I play the songs in my itunes, but they dont display while playing the album on my ipod. HELP PLEASE AND THANK YOU!!

    1) As far as I know, viruses aren't an issue for iPods.
    2) This is normal because of the way manfacturer's calculate hard disk space. See the explantion at the bottom of this link.
    http://docs.info.apple.com/article.html?artnum=60955
    3) Sorry really can't help since I'm on a Mac, but I do know that playlists have nothing to do with displaying album art.

  • HT5312 Please help forgot the security question.. And no list: forgot security question? Send to your rescue email to....  Please help me...

    Please help me... Just forgot my security question.. N no list  forgot security question? Send to email ....... Below.. Only the question sould answer..  Please help me...

    Try going to the ExpressLane at https://expresslane.apple.com and then iTunes, iTunes Store, Password and Security Questions and select the Rescue Email to have that resent to you.

  • Please help me with this question ftp

    please help me to continue i don't know how to finished
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.net.URL;
    public class myftp2 {
    static String host = null;
    static String path = "/";
    public static void main(String[] args) {
    if(args.length != 1) {
    usage();
    System.exit(1);
    host = "ftp://"+args[0];
    if( ! isOpen() )
    System.out.println("Cannot connect to "+host+path);
    System.exit(1);
    System.out.println("Connected to "+host+path);
    BufferedReader kb = new BufferedReader( new InputStreamReader(System.in));
    boolean finished = false;
    while( ! finished ) {
    String input;
    String[] cmdArgs;
    System.out.print("myftp> ");
    try {
    input = kb.readLine();
    cmdArgs = input.split("
    s");
    if(cmdArgs[0].equals("exit") ) {
    finished = true;
    else if( cmdArgs[0].equals("dir")) {
    dirCommand();
    else if (cmdArgs[0].equals("get"))
    else if( cmdArgs[0].equals("pwd")) {
    System.out.println(host+path);
    else if( cmdArgs[0].equals("cd")) {
    if(cmdArgs.length!= 2) {
    System.out.println("You must include the directory name");
    else
    cdCommand(cmdArgs[1]);
    else if (cmdArgs[0].equals("cd.."))
    //cdCommand(cmdArgs[1]);
    catch(IOException e){
    System.out.println("Goodbye");
    static void usage() {
    System.out.println("Usage: java myftp <hostname>");
    System.out.println("please write your username:password@<hostname>");
    static boolean isOpen() {
    try {
    URL url = new URL(host+path);
    InputStream in = url.openStream();
    in.close();
    catch(IOException e) {
    System.out.println(e.getMessage());
    return false;
    return true;
    static void dirCommand() {
    String line;
    try {
    URL url = new URL(host+path);
    InputStream in = url.openStream();
    InputStreamReader inStr = new InputStreamReader(in);
    BufferedReader inNet = new BufferedReader(inStr);
    while((line = inNet.readLine()) != null)
    System.out.println(line);
    catch(IOException e) {
    System.out.println("Error: cant list the directory");
    static void cdCommand(String directory) {
    static void cdCommandback(String dir)
    }

    Please stop crossposting this question.
    http://forum.java.sun.com/thread.jspa?threadID=5253698&messageID=10050532#10050532

  • My ipod touch is disabled. Please help me with my questions. It is my first apple device.

    My ipod is disabled. When i turn it on it says to connect to itunes. I can get to where the screen displays a cord and an itunes logo, but itunes does not pop up, nor display my devices. This is probably because I have not synced my ipod with this computer, nor with any computer. How do I sync my ipod with itunes when it is disabled? How do I get itunes to pop up when my ipod is connected to the computer? Please dont give me a link, i really would like a step by step guide. I have itunes downloaded on this computer, but it does not pop up or display my devices. Do I need to create an itunes account? I have so many questions because this is my first apple device. If you were wondering, my ipod touch is disabled because I forgot my passcode. PLEASE help, I dont care if I have to reset my ipod, I just want to be able to use it!

    Use Device Firmware Mode...
    1.     Turn off your ipod To do this, hold the home and sleep buttons for 10 seconds, ignore slide to power off message.
    2.     Release the power button when you see the apple logo (keep holding the home button)
    3.     Keep holding until you see a message.
    Now restore from a backup!
    Alternatively you can wait!

  • Please help me with this question..

    Hi everyone,
    Sorry for asking the same question which was posted many times in this forum.
    I have the following scenario..
    Database name: database1
    schema names: schema1
                  schema2
                  schema3
                  schema4
                  schema5
                  schema6
                  schema7
    workspace is with: schema1
                       schema2
    1. can i create 1 application that need to access tables in both schema1 and schema2 ?
    comments: I think we have to choose "parsing schema" when i am creating an application.
              if i choose the parsing schema as "schema1".
    2.how can i create a "form on a table" or some other wizard based forms which is in schema2?
    3.what priviliges do i need to create "form on a table" or some other wizard based forms which is in schema2?
    4.As my workspace is with schema1 and schema2. How can i create "forms" on tables which are in
    schema3? do i need to "create a view of table in schema3"  in schema1?
    All the above question will raise if i have to create forms or reports with "wizards". Is this stmt correct?
    I mean if i create a form "manually" all i need to look whether i have insert,update and delete priv on
    that object? is it correct?i think this question was answered several times.sorry for the repost.
    Thanks

    It is not necessary to say "please help me" since help comes almost always. Maybe sometimes you need to bump your question after a while. However, back to your question. I can tell you how I solve that problem:
    granting select, insert, update, delete on all tables to the parsing schema
    granting select on all views to the parsing schema
    granting execute on all procedures and packages to the parsing schema
    creating synonyms in the parsing schema for all tables, views, sequences, etc.
    You can do all of this programatically in a loop instead of writing it for each object separatelly.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    ------------------------------------------------------------------------------

  • Please HELP! Music Player Question!

    I have a music player that I am working on. Here is a link to
    the site
    Omyda Player. If you
    click the little blinking arrow it reveals a control panel. Then
    when you press track selector a window within the flash movie, you
    can then chose a track and it will play. Do to the players slim
    size the fonts have to be made small, so small its hard to read
    unless you have good eyes. What I wanted to do is make it so that
    if you hit track selector it pops up a html pop up window. You can
    then choose your track and it sends the request to the flash
    player. I was thinking of going about it this way!
    I have to use java to send a command to the flash player....
    here is the code.
    The code above actually sends commands to what ever flash
    movie you designate, problem is it is only made to send go to frame
    commands.
    Part 2 is the java button.
    Now how do I name the home.html page? I know how to do a
    window with in a window, but not a pop up to a page. Say for
    example the popup is popup.html, how do I name the home.html. Do I
    simply put home.html in target? Part 3 is an example, Is this
    correct? If not how do I do it?
    Now here comes an issue with the flash. The java code above
    goes to a frame within the movie. So now I have to make a script on
    frame 3 of the movie that tells it to make a button press, but I do
    not know how to do it. Originally the movie worked by pressing a
    button that was marked as a button set as a target called
    Selection1 and so on. How would I make a script on frame 3 that
    would press the button on its own? Kinda like a simulated user
    press. Or is there a way to edit the Java code to act as a button
    press? Please HELP! Part 4 is the coding used in the player!

    Its called telling you the forum rules.
    Now for your question, when you say the phone tells the caller that you are engaged, is it the "busy" tone or it diverts the caller to your voice mail box? 
    If you find my post helpful please click the green star on the left under the avatar. Thanks.

  • PLEASE help me settle this question....

    does BlazeDS support data real-time data synchronization? My manager says it does, but i thought that at the last MAX i specifically asked that question and was told that it is only supported under LiveCycle.
    Example:
    I have a textInput synchronized to a field in my database. I update the value in that textInput box and the value in the database is automatically updated immediately, with NO further button pushes or anything.
    Is this available using BlazeDS? He showed me a bunch of new data services in the new FlashBuilder that seem to set this functionality up, but i'm still skeptical.
    One last thing, if you do know the answer will you PLEASE provide me with a link that provides information on the subject. I've googled a bit and i can't seem to get a clear answer.
    HELP!

    Try asking here:
    http://forums.adobe.com/community/opensource/blazeds?view=discussions

  • Please Help!! Two questions...balance on itunes & how to reinstall tunes

    My computer crashed recently and I just had to reinstall my operating system and all programs. These may be dumb questions but I'm not a computer guy...
    1) I had a $46 balance on itunes when this happened, now I have to redownload itunes, is my balance still saved in my account? How will I get to it?
    2) I was lucky enough to transfer my itunes music folders over to an external hard drive before the crash, but I'm a little concerned on how to get them back in my itunes library when I get itunes back up again. Is it as easy as the click and drag method I used to transfer all the songs to my back up hard drive? I know I'm a little screwed because I didn't tranfer my songs the way that I just read to on this website so I'm nervous. I have about 9000 songs to get back. Of course, I lost my playlists because I didn't do it correct but please tell me I still have all my songs.
    Thanks a lot whoever can reassure me and help out.

    i have no idea about the balance thing, but the music to library question is easy if i understand it right. just reinstall itunes, then select, on the itunes menu, file, add folder to library, and then browse through the computer for your external drive and select it. if your drive is partitioned or your music is in more than one folder, just add them one at a time. this wont move your music into the itunes folder per se; it'll just add them to your library and they'll remain in the external drive they were on. hope that actually answers your question and i didn't miss the point entirely.

  • Havent a clue! Please help! Easy ABAP Question!

    Helly Gurus
    I am loading from a dso to a cube and doing a lookup on a second dso.
    eg
    'Name' is in the DSO1
    I lookup 'Address' from DSO2
    Then load to the cube.
    The problem is there may be more than one address so although I have coded the lookup to
    find all addresses, I do know how to get these into my results.
    Only the first address it finds is there.
    loop at DATA_PACKAGE.
        select * from DSO1 where
        NAME = DATA_PACKAGE-NAME.
        if sy-subrc = 0.
          move-corresponding DSO2 to itab1. collect itab1.
        endif.
        endselect.
      endloop.
    What do I need to do to get all of the results?
    I am in 3.5 so do not have the use of an End Routine.
    Thanks
    Tom Tom

    you need to do several treatments in fact you need to add records on the data_package (by the way it is not an easy ABAP question as you mentioned !)
    So
    Treatment 1: select all the records from ods2 table of adresses outside the loop
        select names adresses
        from ods2
        into table g_itab_ods2
          for all entries in data_package
          where name eq data_package-name.
    Treatment 2: delete double records of the internal table.
        delete adjacent duplicates from g_itab_ods2 comparing names adresses.
    Treatment 3: loop over the data_package. Within this loop read the internal ods2 table and loop over it to assign the corresponding adresses. Then append the results to the temporary data_package_tmp and move all the records to the initial data_package.
    loop at data_package assigning <data_fields>.
       read table g_itab_ods2 into l_g_itab_ods2
          with key name = <data_fields>-name.
          if sy-subrc eq 0.
            loop at g_itab_ods2 assigning <adresses>
            where name                = <data_fields>-name.
              <data_fields>-adresses= <adresses>-adresses.
              append <data_fields> to lt_data_package_tmp.
            endloop.
          endif.
        endloop.
        data_package[] = lt_data_package_tmp[].
    free lt_data_package_tmp.
    this should do what you want to do. hope this could help you out.

  • I turned on auto reply for mms now I can't find it please help methe Ask your question.

    need help to find my mms auto reply option I need to turn it off please help

    And no, since there is no "auto-reply MMS" to turn on, there's nothing to turn off. Do you mean "group MMS"?

  • Please help. Simple Socket Question

    Hi. I am writing the basics for a game. Simple. I have a few classes, 1 of which is for connecting and another in which each user inherits a new copy as they join, it contains all their personal variables.
    By having their socket address, how can I access a specific instance of that file?
    Thanks for any help.

    Hi. I am writing the basics for a game. Simple. I
    have a few classes, 1 of which is for connecting and
    another in which each user inherits a new copy as
    they join, it contains all their personal variables.
    By having their socket address, how can I access a
    specific instance of that file?Specific instance of what file? Sockets connect processes to other processes, not to files.

Maybe you are looking for