1 Replies - 223 Views - Last Post: 28 April 2013 - 04:23 PM Rate Topic: -----

#1 psh  Icon User is offline

  • D.I.C Head

Reputation: -3
  • View blog
  • Posts: 65
  • Joined: 25-March 13

Cant handle 2 key events

Posted 28 April 2013 - 04:07 PM

Im making a car in which the car should avoid or collect objects everything is going fine but my problem is that i cant handle
when the user presses 2 keys .For example up arrow and left..it would be great if you take a look
at my code..language is Lingo thanks :stuart:


property car

on beginSprite me
  car = me.spriteNum
end 

on exitFrame 
  puppetTempo 30
  
   -- slow down 
  if keyPressed(125) then
    puppetTempo 19
    -- go right
  else if keyPressed(124) then
    sprite(car).locH = sprite(2).locH + 3
    -- go faster
  else if keyPressed(126) then
    puppetTempo 40
    -- go left
  else if keyPressed(123) then
    sprite(car).locH = sprite(2).locH - 3
  else if keyPressed(125) and keyPressed(123) then
    -- not working...
    sprite(car).locH = sprite(2).locH  - 3
    puppetTempo 19
  end if






Is This A Good Question/Topic? 0
  • +

Replies To: Cant handle 2 key events

#2 psh  Icon User is offline

  • D.I.C Head

Reputation: -3
  • View blog
  • Posts: 65
  • Joined: 25-March 13

Re: Cant handle 2 key events

Posted 28 April 2013 - 04:23 PM

View Postpsh, on 28 April 2013 - 11:07 PM, said:

Im making a car in which the car should avoid or collect objects everything is going fine but my problem is that i cant handle
when the user presses 2 keys .For example up arrow and left..it would be great if you take a look
at my code..language is Lingo thanks :stuart:/>


property car

on beginSprite me
  car = me.spriteNum
end 

on exitFrame 
  puppetTempo 30
  
   -- slow down 
  if keyPressed(125) then
    puppetTempo 19
    -- go right
  else if keyPressed(124) then
    sprite(car).locH = sprite(2).locH + 3
    -- go faster
  else if keyPressed(126) then
    puppetTempo 40
    -- go left
  else if keyPressed(123) then
    sprite(car).locH = sprite(2).locH - 3
  else if keyPressed(125) and keyPressed(123) then
    -- not working...
    sprite(car).locH = sprite(2).locH  - 3
    puppetTempo 19
  end if





n keydown
problem solved i had to check on keydown and on keyup handlers :gunsmilie:
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1