Keyboard interaction

Ask a Question related to Macromedia Director Lingo, Design and Development.

  1. #1

    Default Keyboard interaction

    I have a member that moves forward when i click the up arrow and moves right when i click the right arrow.
    My problem is that when I hold down the up arrow and then click on the right arrow, the member stops moving forward and turns right. Then i have to click again on the up arrow to go forward.
    Is there any way to, while moving forward, turn right and still moving forward until I release the up arrow?

    Thanks in advanced.



    yiannisezn webforumsuser@macromedia.com Guest

  2. Similar Questions and Discussions

    1. Interaction with a 3D Cube
      I?m developing a webpage where it has to be a 3D cube, and each of its faces has to point to a different URL. I have already constructed and shaded...
    2. Interaction between components
      Hey, I have this page with two components. One has a tilelist the other nothing (yet). So, when I click a element in the tileList, I want some...
    3. Subroutine interaction
      Hi all, the following structure does not work as intended: sub read_index { my $gedicht_path = shift; my (%author_indexlines,...
    4. Sprite Interaction
      Okay, I've tried here once, and I'm going to try again. I'm trying to create interaction between two different sprites. For instance, I have a lever...
    5. Download with Interaction
      I have a script for downloading a file from server to a client machine. But once I click download it will ask me whether to save the file or open the...
  3. #2

    Default Re: Keyboard interaction

    Are you using the keypressed test to test key state? there may be no
    software solution due to how keyboards functions.

    The internal crosspoint matrix switch scheme used in keyboards doesn't
    handle certain combinations of simultinious keys down, this can even
    vary between different brands of keyboards, though as a rule 2 keys at
    once usually works to allow speed typing.

    Game programmers use Control/Option/Shift keys which are guranteed to
    work in conjunction with other keys, Lingo has dedicated calls for
    these, like the ShiftDown.
    JB Guest

  4. #3

    Default Re: Keyboard interaction

    Here is some code that is attached to the red text you drive at [url]http://vispo.com/arteroids[/url] . Hope this helps.

    on enterFrame me
    case 1 of
    --ARROW UP************************************
    (keypressed(126)):
    if pJet < 3 then
    pJet = pJet + 0.3
    --Increase velocity
    end if
    pFlagU = 0
    pFlagD=1
    --ARROW DOWN*******************************
    (keypressed(125)):
    if pJet > -3 then
    pJet = pJet - 0.3
    --Decrease velocity
    end if
    pFlagD=0
    pFlagU=1
    1:
    pFlagU=1
    pFlagD=1
    end case

    pJet = pJet * gFriction[gCurrentMode]
    --This line slows it down because gFriction[gCurrentMode]
    --is a number between 0 and 1, and you always make a number
    --smaller when you multiply it by a number between 0 and 1.
    --gFriction[gCurrentMode] is 1 when there is no friction.

    case 1 of
    --ARROW LEFT***********************************
    (keypressed(123)):
    pAngle=(pAngle - 2*abs(pJet) - 3) mod 360
    --This line makes the id entity turn faster when it is travelling faster.
    pFlagL = 0
    pFlagR=1
    --ARROW RIGHT*********************************
    (keypressed(124)):
    pAngle=(pAngle + 2*abs(pJet) + 3) mod 360
    pFlagR = 0
    pFlagL=1
    otherwise:
    pFlagL=1
    pFlagR=1
    end case

    mpAngle = pAngle * 0.0175 --radians
    pMyLocH = pMyLocH +pMyVelocityFactor*cos(mpAngle)*pJet
    pMyLocV = pMyLocV +pMyVelocityFactor*sin(mpAngle)*pJet
    onstage me
    --the onstage routine keeps it on the stage
    sprite(pMe).loc = point(pMyLocH, pMyLocV)
    sprite(pMe).rotation = pAngle --degrees

    if keypressed (7) then
    --this fires missiles when the "z" key is pressed
    if pFlag then
    --good use of the pFlag to make it so that if you keep the space key down, it only fires once.
    mymissile = getone(gmissile,0)
    if mymissile <> 0 then
    sprite(gSoundManager).playRandomShootingSound()
    setprop(gmissile,mymissile,1)
    sprite(mymissile).member=member(gBulletMemberNumbe r)
    --set the member of sprite mymissile to "bullet"
    sendsprite mymissile #shoot, pMe,pMyLocH,pMyLocV,pAngle
    end if
    end if
    pFlag = 0
    else
    pFlag = 1
    end if --1
    end prepareFrame



    vispo webforumsuser@macromedia.com Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139