A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Slowly sobbing in corner

Hybrid View

  1. #1
    Junior Member
    Join Date
    Aug 2001
    Posts
    5
    Greetings oh wise ones.

    I'm tring to move an image across the screen.
    What I want to do is whenever a button on the keyboard is pressed the figure moves a bit so the more you tap like crazy (track and field or mortal kombat stylee) the faster said image gets to the other side.

    Any clues any ideas anything at all basically that the flash massive think might help would be lovely, cheers.

    ellopeeps.

    (AKA Mark)

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    What I want to do is whenever a button on the keyboard is pressed the figure moves a bit
    So i guess you need to put the 'figure' in a movieclip , give an instance to the clip , for example 'fig' and put that code in your buttons:
    on (release) {
    _root.fig._x +=10;}
    This will make the instance 'fig' move 10 pixels to the right
    gparis

  3. #3
    Bamboozled snoop_doug's Avatar
    Join Date
    Apr 2001
    Posts
    1,278
    furthermore for key pressing youll have to do this

    on (keyPress "q") {
    _root.fig._x += 10;
    }
    on (keyPress "w") {
    _root.fig._x += 10;
    }
    on (keyPress "e") {
    _root.fig._x += 10;
    }
    on (keyPress "r") {
    _root.fig._x += 10;
    }
    on (keyPress "t") {
    _root.fig._x += 10;
    }
    on (keyPress "y") {
    _root.fig._x += 10;
    }

    and keep copying and pasting the code and replacing it with all the button on the keyboard unless someone knows a code to include all butons in one

  4. #4
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    onClipEvent (keyDown) {
    _root.fig._x +=10;}
    I didn't see the key press that'll do the job for any key!
    gparis

  5. #5
    Junior Member
    Join Date
    Aug 2001
    Posts
    5

    Smile Nice, but....

    Bang on,

    cheers snoop. Any word on how to use any key as many times as they want so they can just start hitting keys.

    peeps.

  6. #6
    thats cool for your help people (im on this project with 'ellopeeps')

    the whole game is gonna be 'snail racing'!
    So we now know how to move a specified character across using the keys...

    but what we need to create is a 'finish' line so that when an MC crosses that point it is declared the winner!

    AND we also need to know how to create 3 other random 'snail racers' that participate in the race, but i dont want them to finish in the same place everytime, so how would i do this also!

    all your help is very much appreciated!

    Gav + Dave
    Christon Davies Web Team

  7. #7
    Senior Member
    Join Date
    Feb 2001
    Posts
    1,835
    Hi,

    yes - just like gparis said, you can use onClipEvent(keyDown) - this will trigger when any key is pressed.

    - n.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center