Ask a Question related to Macromedia Director Lingo, Design and Development.
-
yiannisezn webforumsuser@macromedia.com #1
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
-
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... -
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... -
Subroutine interaction
Hi all, the following structure does not work as intended: sub read_index { my $gedicht_path = shift; my (%author_indexlines,... -
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... -
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... -
JB #2
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
-
vispo webforumsuser@macromedia.com #3
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



Reply With Quote

